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

Method Initialize

trinity/Eve/UI/EveSpherePinIndexTree.cpp:439–539  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

437
438// ------------------------------------------------------------------------------------------------------
439int EveSpherePinIndexTree::Initialize()
440{
441 m_initialized = 0;
442 if( !m_granny || !m_granny->IsGood() )
443 {
444 return 0;
445 }
446
447 if( m_granny->IsUsingCMF() )
448 {
449 const cmf::Data* cmfData = m_granny->GetCMFData();
450
451 if( !cmfData )
452 {
453 return 0;
454 }
455
456 uint32_t triangleCount = cmf::GetStreamElementCount( cmfData->meshes[0].lods[0].ib ) / 3;
457
458 if( m_tree )
459 {
460 ClearTree( m_tree );
461 m_tree = 0;
462 }
463
464 if( m_faces )
465 {
466 delete[] m_faces;
467 m_faces = 0;
468 }
469
470 m_tree = CreateTree( 0, 9 );
471
472 std::vector<Vector2> sphericalVerts;
473 std::vector<Vector3> verts;
474 if( !ExtractVertices( *cmfData, m_granny->GetCMFViewData( cmfData->meshes[0].lods[0].vb ), sphericalVerts, verts ) )
475 {
476 ClearTree( m_tree );
477 m_tree = 0;
478 return 0;
479 }
480
481 m_faces = ExtractFaceData( *cmfData, m_granny->GetCMFContents().GetSection( cmfData->meshes[0].lods[0].ib.index ), verts );
482
483 for( uint32_t i = 0; i < triangleCount; i++ )
484 {
485 AddFaceToTree( m_tree, &m_faces[i], sphericalVerts );
486 }
487
488 m_initialized = 1;
489 return 1;
490 }
491#if WITH_GRANNY
492 else
493 {
494 auto mesh = m_granny->GetGrannyMesh( 0 );
495 if( !mesh || !mesh->PrimaryTopology || !mesh->PrimaryVertexData )
496 {

Callers

nothing calls this directly

Calls 11

ClearTreeFunction · 0.85
CreateTreeFunction · 0.85
ExtractVerticesFunction · 0.85
ExtractFaceDataFunction · 0.85
AddFaceToTreeFunction · 0.85
GetCMFViewDataMethod · 0.80
GetSectionMethod · 0.80
GetGrannyMeshMethod · 0.80
IsGoodMethod · 0.45
IsUsingCMFMethod · 0.45
GetCMFDataMethod · 0.45

Tested by

no test coverage detected