MCPcopy Create free account
hub / github.com/assimp/assimp / GetMeshVFormatUnique

Function GetMeshVFormatUnique

code/PostProcessing/ProcessHelper.cpp:166–196  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

164
165// -------------------------------------------------------------------------------
166unsigned int GetMeshVFormatUnique(const aiMesh *pcMesh) {
167 ai_assert(nullptr != pcMesh);
168
169 // FIX: the hash may never be 0. Otherwise a comparison against
170 // nullptr could be successful
171 unsigned int iRet = 1;
172
173 // normals
174 if (pcMesh->HasNormals()) iRet |= 0x2;
175 // tangents and bitangents
176 if (pcMesh->HasTangentsAndBitangents()) iRet |= 0x4;
177
178
179 static_assert(8 >= AI_MAX_NUMBER_OF_COLOR_SETS, "static_assert(8 >= AI_MAX_NUMBER_OF_COLOR_SETS)");
180 static_assert(8 >= AI_MAX_NUMBER_OF_TEXTURECOORDS, "static_assert(8 >= AI_MAX_NUMBER_OF_TEXTURECOORDS)");
181
182 // texture coordinates
183 unsigned int p = 0;
184 while (pcMesh->HasTextureCoords(p)) {
185 iRet |= (0x100 << p);
186 if (3 == pcMesh->mNumUVComponents[p])
187 iRet |= (0x10000 << p);
188
189 ++p;
190 }
191 // vertex colors
192 p = 0;
193 while (pcMesh->HasVertexColors(p))
194 iRet |= (0x1000000 << p++);
195 return iRet;
196}
197
198// -------------------------------------------------------------------------------
199VertexWeightTable *ComputeVertexBoneWeightTable(const aiMesh *pMesh) {

Callers 3

ExecuteMethod · 0.85
GetMeshHashFunction · 0.85
GetMeshVFormatFunction · 0.85

Calls 4

HasNormalsMethod · 0.45
HasTextureCoordsMethod · 0.45
HasVertexColorsMethod · 0.45

Tested by

no test coverage detected