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

Method DetermineAreaBoundsAndVertCount

trinity/Resources/TriGeometryRes.cpp:695–732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693
694#if WITH_GRANNY
695void TriGeometryRes::DetermineAreaBoundsAndVertCount( TriGeometryResAreaData& area, granny_mesh* grannyMesh, int bytesPerVertex )
696{
697 CCP_STATS_ZONE( __FUNCTION__ );
698
699 // Determine bounds for area
700 // Assume that position is the first component
701
702 // set up some data for the vertex fetcher.
703 unsigned int positionOffset;
704 Tr2VertexDefinition::DataType positionType;
705 GetVertexPositionOffsetAndType( grannyMesh, positionOffset, positionType );
706
707 BoundingBoxInitialize( area.m_minBounds, area.m_maxBounds );
708
709 std::set<int32_t> vertexIndicesSeen;
710
711 for( int vIx = 0; vIx < area.m_primitiveCount * 3; ++vIx )
712 {
713 int index;
714
715 if( grannyMesh->PrimaryTopology->Indices16 )
716 {
717 index = grannyMesh->PrimaryTopology->Indices16[vIx + area.m_firstIndex];
718 }
719 else
720 {
721 index = grannyMesh->PrimaryTopology->Indices[vIx + area.m_firstIndex];
722 }
723
724 vertexIndicesSeen.insert( index );
725
726 // vertices are NOT GUARENTEED to be float3 or fp16_4, so this helps with that.
727 Vector3 vertexPosition;
728 GetMeshVertexPosition( grannyMesh, index, vertexPosition, (unsigned int)bytesPerVertex, positionOffset, positionType );
729
730 BoundingBoxUpdate( area.m_minBounds, area.m_maxBounds, vertexPosition );
731 }
732}
733#endif
734
735#if WITH_GRANNY

Callers

nothing calls this directly

Calls 4

BoundingBoxInitializeFunction · 0.85
GetMeshVertexPositionFunction · 0.85
BoundingBoxUpdateFunction · 0.85

Tested by

no test coverage detected