/***************** loadCB.c Ver 1.0 LDT version of physical objects loading *****************/ #include "ldt.h" #define PostProcessPriority_PO 10 /***************************************************************** Name: Description: Create callback for LDT Author: Mircea Petrescu Date: 6/29/98 Modified: *****************************************************************/ int PO_iCreateGeneral( LDT_tdst_Link *pLink ) { PO_tdxHandleToPhysicalObject _hPhysicalObject; _hPhysicalObject = PO_fn_hAllocPhysicalObject(); pLink->pObject=(void *)_hPhysicalObject; return 0; } /***************************************************************** Name: Description: Load callback for LDT Author: Mircea Petrescu Date: 6/29/98 Modified: *****************************************************************/ HREF g_hRefPO; #define iPOGeneral_VS 0 #define iCSGeneral_ZDR 1 int PO_iLoadGeneral( LDT_tdst_Link *pLink ) { LDT_tdeParseResult result=ParseResult_BeginSection; PO_tdxHandleToPhysicalObject _hPhysicalObject=( PO_tdxHandleToPhysicalObject )pLink->pObject; char sFile[MAX_PATH], sParent[MAX_PATH], sAction[MAX_PATH], sIdent[MAX_PATH]; char sz_SectionNameForCS[MAX_PATH]; char sz_LongPathForLinkTable[MAX_PATH]; int iLen=LDT_ComputeSectionName(pLink,sz_LongPathForLinkTable); SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&PO_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hPhysicalObject),1,iLen); while( result!=ParseResult_EndSection ) { result=LDT_GetNextEntry(); switch( result ) { case ParseResult_Entry: /* an entry */ { char *szEntry=LDT_szGetEntryName(); switch (*(short *)szEntry) { case 'SV' : /* VS */ { _hPhysicalObject->_hVisualSet = (GEO_tdxHandleToVisualSet)LDT_LoadSection( LDT_szGetParam( 1 ) ); LDT_AddToRefsTable( g_hRefPO, (void *)pLink, iPOGeneral_VS, 0 ); } break; case 'SC' : /* CS */ { LDT_SplitSectionName( LDT_szGetParam( 1 ), sFile, sParent, sAction, sIdent); strcpy(sz_SectionNameForCS,sFile); strcat(sz_SectionNameForCS,"^"); strcat(sz_SectionNameForCS,C_Section_AllCollideSets); strcat(sz_SectionNameForCS,":^"); if( sParent[0] ) { strcat(sz_SectionNameForCS,sParent); strcat(sz_SectionNameForCS,":"); } strcat(sz_SectionNameForCS,sAction); strcat(sz_SectionNameForCS,":"); strcat(sz_SectionNameForCS,sIdent); _hPhysicalObject->_hCollideSet = (PCS_tdxHandleToPhysicalCollSet)LDT_LoadSection( sz_SectionNameForCS ); } break; case 'VB' : /* BV -bounding volume */ { } break; } } } } return 0; } void PO_vPostProcessLDT( HREF hRef ) { LDT_tdst_Link *pObject; LDT_tdst_Link *pGetFrom; int iType; short xCount; long *pVal; while( LDT_GetRefFromTable( hRef, &pObject, &pGetFrom, &iType, &xCount, &pVal )==0 ) { switch( iType ) { case iPOGeneral_VS: { PO_tdxHandleToPhysicalObject _hPhysicalObject=( PO_tdxHandleToPhysicalObject )pObject->pObject; HIE_fn_vComputeOnePoBoundingVolume(_hPhysicalObject); } break; case iCSGeneral_ZDR: { ACP_tdxHandleOfObject _hGeometricObject=(ACP_tdxHandleOfObject)pGetFrom->pObject; PCS_tdxHandleToPhysicalCollSet _hCollideSet=(PCS_tdxHandleToPhysicalCollSet)pObject->pObject; COL_fn_bCreateOctree(_hGeometricObject,10,5,4); PCS_fn_vSetZdrGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject); } break; } } } void PO_fn_vRegisterAllScriptSections(void) { LDT_RegisterType( C_Section_POGeneral, PO_iCreateGeneral, PO_iLoadGeneral, LDT_REG_SECTION ); g_hRefPO=LDT_RegisterSolver( PO_vPostProcessLDT, PostProcessPriority_PO ); }