Archived

This topic is now archived and is closed to further replies.

Kaviar

showing more frames in Jim Adams NodeTree demo

Recommended Posts

Kaviar    122
Hi! In my x file I have to frames. A plane and a cube. (I think I am on my own to figure this problem out but I give it a shot here anyway) In the normal NodeTree only the first frame is rendered. so I started to change the cNodeTree class so it would work more like cObject (but still I wan''t the nodetree to work) has anyone got this to work? I started out to move the structs sPolygon, sNode and sGroup and all variables that is depending of the mesh to the struct sMesh such as sPolygon *m_Polygons; // List of polygons unsigned long m_NumGroups; // # of texture groups sGroup *m_Groups; // Texture groups unsigned long m_VertexFVF; // Mesh vertex FVF unsigned long m_VertexSize; // Size of mesh vertex the cNodeTreeMesh::Create(...) now only contains m_Frame = Mesh->GetParentFrame(); ReadFrames(m_Frame, TreeType, MaxSize, MaxPolygons); ReadFrames itself loops through all Frames and calls CreateMesh(sMesh *Mesh, int TreeType, float MaxSize, long MaxPolygons) CreateMesh is like the old cNodeTreeMesh::Create(...) oxcept it uses Mesh-> infront of the old member variables such as Mesh->m_VertexFVF = ... Now this works fine until I get to the render function then I get the normal look of the window when I mess up some important stuff and you get green and pink broad lines over the screen. so I removed the m_Graphics->GetDeviceCOM()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, Mesh->m_Mesh->GetNumVertices(),0, Mesh->m_Groups.NumPolygonsToDraw); and put in Mesh->m_Mesh->DrawSubset(i); instead and now it works fine. until I take my larger x files and this one crashes in the IsPolygonContained() Vertex[0] = (sVertex*)&m_Mesh->m_VertexPtr[m_Mesh->m_VertexSize * Polygon->Vertex0]; I get the vertex for sometimes but it crashes on some Polygon numbers like when Polygon->Vertex0 = 1571 or simular. I''m not sure how happy Jim Adams would be if I sent the class to someone who would look at it...? well any ideas are really appreciated!

Share this post


Link to post
Share on other sites
Jim Adams    440
Only a single mesh is used for the NodeTree. As long as you use only one Mesh template is your .X file, then you should be okay. If you need to use more than one mesh, you''ll have to expand on the class by using multiple nodes (one for each mesh), or by having each node point to seperate vertex/index buffers as well.

Also, if you haven''t already, you may want to download the Update#1 which uses index buffers to sort the nodes. I think an old version of the code caused the blinking lines.

Jim Adams

Share this post


Link to post
Share on other sites