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

Method GetMeshVertexElements

trinity/Resources/TriGrannyRes.cpp:1136–1176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1134}
1135
1136Be::Result<std::string> TriGrannyRes::GetMeshVertexElements( unsigned int meshIx, std::vector<std::pair<uint32_t, uint32_t>>& vertexElements )
1137{
1138 if( IsUsingCMF() )
1139 {
1140 auto errorMessage = ValidateMeshIndex( meshIx );
1141 if( !BeIsSuccess( errorMessage ) )
1142 {
1143 return errorMessage;
1144 }
1145 vertexElements.clear();
1146 auto decl = BuildFromCMFVertexDecl( m_cmfContents.GetData()->meshes[meshIx].decl );
1147 for( const auto& elem : decl.m_items )
1148 {
1149 vertexElements.emplace_back( static_cast<uint32_t>( elem.m_usage ), static_cast<uint32_t>( elem.m_usageIndex ) );
1150 }
1151 }
1152#if WITH_GRANNY
1153 else
1154 {
1155 granny_file_info* fi = ValidateFileInfo();
1156 if( !fi )
1157 {
1158 return Be::Result<std::string>( "Tried to get file info on an invalid Granny file" );
1159 }
1160
1161 if( (granny_int32x)meshIx >= fi->MeshCount )
1162 {
1163 return Be::Result<std::string>( "Mesh index out of range" );
1164 }
1165
1166 vertexElements.clear();
1167 auto decl = BuildFromGrannyVertexDecl( fi->Meshes[meshIx]->PrimaryVertexData->VertexType );
1168 for( const auto& elem : decl.m_items )
1169 {
1170 vertexElements.emplace_back( static_cast<uint32_t>( elem.m_usage ), static_cast<uint32_t>( elem.m_usageIndex ) );
1171 }
1172 }
1173#endif
1174
1175 return Be::Result<std::string>();
1176}
1177
1178Be::Result<std::string> TriGrannyRes::GetMeshTriangleCount( unsigned int meshIx, uint32_t& count )
1179{

Callers

nothing calls this directly

Calls 5

IsUsingCMFFunction · 0.85
BeIsSuccessFunction · 0.85
BuildFromCMFVertexDeclFunction · 0.85
GetDataMethod · 0.45

Tested by

no test coverage detected