0
\$\begingroup\$

I have just read this tutorial about how to load a 3D model file. Its render routine uses a recursive_render function to scan all nodes.

My question:

  1. What does a aiNode struct store?
  2. What the difference between this method and above method:

    for (int i=0; i < scene->mNumMesh; ++i) {
       draw scene->mMeshes[i];
    }
    
\$\endgroup\$
1
\$\begingroup\$

1) The aiNode struct is defined in the Assimp library. Here you can find it its definition on the official documentation:

Public Attributes
aiNode **       mChildren       // The child nodes of this node.
unsigned int *  mMeshes         // The meshes of this node.
aiString        mName           // The name of the node.
unsigned int    mNumChildren    // The number of child nodes of this node.
unsigned int    mNumMeshes      // The number of meshes of this node.
aiNode *        mParent         // Parent node.
aiMatrix4x4     mTransformation // The transformation relative to the node's parent. 

2) I don't know what is the difference between "your method" and recursive_render, but looks like you are missing a lot of information (childs, etc). I'd have a closer look to recursive_render

\$\endgroup\$
  • \$\begingroup\$ thanks for reply, that is what i do not understands, why they are divided model into more "nodes" but not only meshes? \$\endgroup\$ – Bình Nguyên Jun 20 '12 at 15:29
  • \$\begingroup\$ For a definition of "node", I recommend that you read the section about "The Node Hierarchy" from assimp.sourceforge.net/lib_html/data.html. "A node can potentially refer to single or multiple meshes. The meshes are not stored inside the node, but instead in an array of aiMesh inside the aiScene. A node only refers to them by their array index. This also means that multiple nodes can refer to the same mesh, which provides a simple form of instancing." \$\endgroup\$ – Dan Jun 20 '12 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.