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

Function get_bounding_box_for_node

samples/SimpleOpenGL/Sample_SimpleOpenGL.c:85–117  ·  view source on GitHub ↗

---------------------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

83
84/* ---------------------------------------------------------------------------- */
85void get_bounding_box_for_node (const C_STRUCT aiNode* nd,
86 C_STRUCT aiVector3D* min,
87 C_STRUCT aiVector3D* max,
88 C_STRUCT aiMatrix4x4* trafo
89){
90 C_STRUCT aiMatrix4x4 prev;
91 unsigned int n = 0, t;
92
93 prev = *trafo;
94 aiMultiplyMatrix4(trafo,&nd->mTransformation);
95
96 for (; n < nd->mNumMeshes; ++n) {
97 const C_STRUCT aiMesh* mesh = scene->mMeshes[nd->mMeshes[n]];
98 for (t = 0; t < mesh->mNumVertices; ++t) {
99
100 C_STRUCT aiVector3D tmp = mesh->mVertices[t];
101 aiTransformVecByMatrix4(&tmp,trafo);
102
103 min->x = aisgl_min(min->x,tmp.x);
104 min->y = aisgl_min(min->y,tmp.y);
105 min->z = aisgl_min(min->z,tmp.z);
106
107 max->x = aisgl_max(max->x,tmp.x);
108 max->y = aisgl_max(max->y,tmp.y);
109 max->z = aisgl_max(max->z,tmp.z);
110 }
111 }
112
113 for (n = 0; n < nd->mNumChildren; ++n) {
114 get_bounding_box_for_node(nd->mChildren[n],min,max,trafo);
115 }
116 *trafo = prev;
117}
118
119/* ---------------------------------------------------------------------------- */
120void get_bounding_box(C_STRUCT aiVector3D* min, C_STRUCT aiVector3D* max)

Callers 1

get_bounding_boxFunction · 0.70

Calls 2

aiMultiplyMatrix4Function · 0.85
aiTransformVecByMatrix4Function · 0.85

Tested by

no test coverage detected