MCPcopy Create free account
hub / github.com/carbonengine/trinity / PrepareFromGrannyRes

Method PrepareFromGrannyRes

trinity/Resources/TriGeometryRes.cpp:1321–1363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1319#endif
1320
1321void TriGeometryRes::PrepareFromGrannyRes( TriGrannyRes* g )
1322{
1323 CCP_STATS_ZONE( __FUNCTION__ );
1324 USE_MAIN_THREAD_RENDER_CONTEXT();
1325
1326 if( g->IsUsingCMF() )
1327 {
1328 const cmf::Data* cmfData = g->GetCMFData();
1329
1330 if( !cmfData )
1331 {
1332 return;
1333 }
1334
1335 m_useCMF = true;
1336
1337 SetupMeshes( *cmfData );
1338 SetupSkeletons( *cmfData );
1339 CreateMeshesFromCMFFile( g->GetCMFContents(), Tr2CpuUsage::READ | Tr2CpuUsage::WRITE, renderContext );
1340 }
1341#if WITH_GRANNY
1342 else
1343 {
1344 granny_file* f = g->GetGrannyFile();
1345 if( !f )
1346 {
1347 return;
1348 }
1349 granny_file_info* gi = GrannyGetFileInfo( f );
1350
1351 m_useCMF = false;
1352
1353 SetupMeshes( gi );
1354 SetupSkeletons( gi );
1355 CreateMeshesFromGrannyFile( gi, Tr2CpuUsage::READ | Tr2CpuUsage::WRITE, renderContext );
1356 }
1357#endif
1358
1359 m_sourceGranny = g;
1360
1361 SetPrepared( true );
1362 SetGood( true );
1363}
1364
1365//This entire function is sus. We should be able to compute this when we upload the mesh to the GPU, as it can never change unless the vertex data changes.
1366void TriGeometryRes::RecalculateBoundingSphere()

Callers 1

CreateGeometryResMethod · 0.80

Calls 2

IsUsingCMFMethod · 0.45
GetCMFDataMethod · 0.45

Tested by

no test coverage detected