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

Function GetMeshHash

code/PostProcessing/FindInstancesProcess.h:63–74  ·  view source on GitHub ↗

------------------------------------------------------------------------------- @brief Get a pseudo(!)-hash representing a mesh. * * The hash is built from number of vertices, faces, primitive types, * .... but *not* from the real mesh data. The funcction is not a perfect hash. * @param in Input mesh * @return Hash. */

Source from the content-addressed store, hash-verified

61 * @return Hash.
62 */
63inline uint64_t GetMeshHash(aiMesh* in) {
64 ai_assert(nullptr != in);
65
66 // ... get an unique value representing the vertex format of the mesh
67 const unsigned int fhash = GetMeshVFormatUnique(in);
68
69 // and bake it with number of vertices/faces/bones/matidx/ptypes
70 return ((uint64_t)fhash << 32u) | ((
71 (in->mNumBones << 16u) ^ (in->mNumVertices) ^
72 (in->mNumFaces<<4u) ^ (in->mMaterialIndex<<15) ^
73 (in->mPrimitiveTypes<<28)) & 0xffffffff );
74}
75
76// -------------------------------------------------------------------------------
77/** @brief Perform a component-wise comparison of two arrays

Callers 1

ExecuteMethod · 0.85

Calls 1

GetMeshVFormatUniqueFunction · 0.85

Tested by

no test coverage detected