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

Method RebuildCachedData

trinity/Eve/SpaceObject/EveSpaceObject2.cpp:2077–2130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2075}
2076
2077void EveSpaceObject2::RebuildCachedData( BlueAsyncRes* p )
2078{
2079 // build list of block areas we need to render for overlay effects
2080 if( m_mesh )
2081 {
2082 m_mesh->CollectAreaBlocks( m_overlayMeshAreaBlocks[EveMeshOverlayEffect::TYPE_ALL], TRIBATCHTYPE_OPAQUE );
2083 m_mesh->CollectAreaBlocks( m_overlayMeshAreaBlocks[EveMeshOverlayEffect::TYPE_ALL], TRIBATCHTYPE_TRANSPARENT );
2084 m_mesh->CollectAreaBlocks( m_overlayMeshAreaBlocks[EveMeshOverlayEffect::TYPE_ALL], TRIBATCHTYPE_DECAL );
2085 m_mesh->CollectAreaBlocks( m_overlayMeshAreaBlocks[EveMeshOverlayEffect::TYPE_OPAQUEONLY], TRIBATCHTYPE_OPAQUE );
2086 // this list is too long will hold one element for each mesharea at least... Optimize!
2087 for( int i = 0; i < EveMeshOverlayEffect::TYPE_COUNT; ++i )
2088 {
2089 TriRenderBatchAreaBlock::Optimize( m_overlayMeshAreaBlocks[i] );
2090 }
2091
2092 m_mesh->CollectAreaBlocksWithSharedMaterials( m_shadowMeshOpaqueAreas, TRIBATCHTYPE_OPAQUE );
2093 for( auto& collector : m_shadowMeshOpaqueAreas )
2094 {
2095 collector.Optimize();
2096 }
2097 }
2098
2099 // Try to register audio geometry now that the geometry resource is loaded
2100 RegisterAudioGeometry();
2101
2102 // If we already have a model we don't want to go through here
2103 // as it would nuke all current animations.
2104 if( !m_animationUpdater || m_animationUpdater->IsInitialized() )
2105 {
2106 return;
2107 }
2108
2109 if( !m_geometryResFromMesh || !m_geometryResFromMesh->IsGood() )
2110 {
2111 return;
2112 }
2113
2114 if( m_boundingSphereRadius < 0.0f )
2115 {
2116 CCP_LOGWARN( "Bounding sphere not set for '%s' - calculating from '%ls'", m_name.c_str(), m_geometryResFromMesh->GetPath() );
2117 m_geometryResFromMesh->RecalculateBoundingSphere();
2118 Vector4 sphere;
2119 if( m_mesh )
2120 {
2121 m_geometryResFromMesh->GetBoundingSphere( m_mesh->GetMeshIndex(), sphere );
2122 }
2123 else
2124 {
2125 return;
2126 }
2127 m_boundingSphereCenter = Vector3( sphere.x, sphere.y, sphere.z );
2128 m_boundingSphereRadius = sphere.w;
2129 }
2130}
2131
2132bool EveSpaceObject2::OnModified( Be::Var* val )
2133{

Callers

nothing calls this directly

Calls 9

CollectAreaBlocksMethod · 0.80
OptimizeMethod · 0.80
GetMeshIndexMethod · 0.80
Vector3Class · 0.50
IsInitializedMethod · 0.45
IsGoodMethod · 0.45
GetBoundingSphereMethod · 0.45

Tested by

no test coverage detected