I created a simple terrain class with a list of vertices and indices, but now I'm trying to figure out how to integrate it into a SceneNode for collision and octree visibility and what not.
I've looked at the IMeshBuffer class and IMesh class, but which do I use?? Do I create an IMesh class then fill up its MeshBuffers with triangles??
Also, I noticed that IMeshBuffer uses the vertices with only 1 texcoordinate, but I need 2. Is there a way to use IMeshBuffers and still use 2 texcoords??
IMeshBuffers or IMesh for custom meshes??
well i've been trying to solve my problem and this is what i've come up with.
inside my custom class i declared
irr::scene::SMesh *Mesh;
irr::scene::SMeshBuffer *MeshBuffer;
i then call
irr::video::S3DVertex v;
MeshBuffer->Vertices.push_back(v);
and i do this for each vertex in my object setting the right values for v.
After I filled the vertices and the Indices list as above, I then call
MeshBuffer->recalculateBoundingBox();
Mesh->recalculateBoundingBox();
Mesh->addMeshBuffer(MeshBuffer);
When I have finished doing the above stuff, inside of main I try the following but when I run the application it crashes with some sort of memory error
scene::ISceneNode *node=0;
node = smgr->addOctTreeSceneNode(myNode->getMesh());
and all myNode->getMesh() does is return the Mesh variable in my class.
I went into COctTreeSceneNode.cpp and found that the memory crash is happening inside of the createTree(IMesh *mesh) function, happening right when it calls:
mesh->getMeshBuffercount();
i know this because i commented all the code out within that if statement and I got no crashing. but i can call this function just fine within my own class without any crashing whatsoever, that is why i am confused. I know that createTree takes an IMesh * variable, and my Mesh is SMesh type, but it should translate over, shouldn't it?
Anyway, anybody have any ideas on what's going on?? I posted my source code here just in case anybody would like to help me
http://cs.selu.edu/~soconnell/MyIrrlicht.cpp
http;//cs.selu.edu/~soconnell/CTerrainNode.h
inside my custom class i declared
irr::scene::SMesh *Mesh;
irr::scene::SMeshBuffer *MeshBuffer;
i then call
irr::video::S3DVertex v;
MeshBuffer->Vertices.push_back(v);
and i do this for each vertex in my object setting the right values for v.
After I filled the vertices and the Indices list as above, I then call
MeshBuffer->recalculateBoundingBox();
Mesh->recalculateBoundingBox();
Mesh->addMeshBuffer(MeshBuffer);
When I have finished doing the above stuff, inside of main I try the following but when I run the application it crashes with some sort of memory error
scene::ISceneNode *node=0;
node = smgr->addOctTreeSceneNode(myNode->getMesh());
and all myNode->getMesh() does is return the Mesh variable in my class.
I went into COctTreeSceneNode.cpp and found that the memory crash is happening inside of the createTree(IMesh *mesh) function, happening right when it calls:
mesh->getMeshBuffercount();
i know this because i commented all the code out within that if statement and I got no crashing. but i can call this function just fine within my own class without any crashing whatsoever, that is why i am confused. I know that createTree takes an IMesh * variable, and my Mesh is SMesh type, but it should translate over, shouldn't it?
Anyway, anybody have any ideas on what's going on?? I posted my source code here just in case anybody would like to help me

http://cs.selu.edu/~soconnell/MyIrrlicht.cpp
http;//cs.selu.edu/~soconnell/CTerrainNode.h