| 1134 | } |
| 1135 | |
| 1136 | Be::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 | |
| 1178 | Be::Result<std::string> TriGrannyRes::GetMeshTriangleCount( unsigned int meshIx, uint32_t& count ) |
| 1179 | { |
nothing calls this directly
no test coverage detected