Page 1 of 1

Making my own mesh inside of the engine

Posted: Tue Dec 23, 2008 9:56 pm
by CameroKid
I know how to draw something on the engine:

driver->drawIndexedTriangleList(&Vertices[0], VertNumb, &indices[0], TriangleNumb);

but how can I set an IMesh pointer to what I have drawn so I can use it in the engine?

Posted: Tue Dec 23, 2008 10:49 pm
by Ion Dune
You'll have to make your own mesh buffer.

http://irrlicht.sourceforge.net/docu/cl ... uffer.html

Posted: Wed Dec 24, 2008 12:10 am
by CameroKid
Thanks for the reply but that link doesn't help much. Is there a tutorial? This involves making a class right? I'm not sure I want a class. I want to be able to alter the verticals and triangles of the mesh whenever I want. can I do that through a class?

Posted: Wed Dec 24, 2008 2:43 am
by Ion Dune
Just use the public arrays inside the class I linked to instead of your own arrays, then use

Code: Select all

driver->drawMeshBuffer(...)
You will still be able to alter the vertices and triangles of the mesh. Organizing it in a class does not affect that.

There is no tutorial that specifically covers this, but tutorial 3 should get you on the right track.

Posted: Wed Dec 24, 2008 4:39 am
by vitek
I recently posted some code to create a cylinder mesh. I'm thinking you might find it useful.

Travis

Posted: Thu Dec 25, 2008 5:20 am
by CameroKid
Ok I think I'm a bit confused on the S3DVertex object. What is the difference from x, y ,z and nx, ny, and nz. Can someone explain what each value means? I made my own mesh and I see it fine, but when I try to use the mesh in Newton the collision doesn't match.

Posted: Thu Dec 25, 2008 5:29 am
by Ion Dune
x, y, and z are the position values of the vertex. nx, ny, nz is the normal vector which are used for light calculations.

Posted: Fri Dec 26, 2008 4:53 am
by CameroKid
Thanks for the help everything works great. Out of curiosity what are the last two coordinates in a vertex? the Tcoords

Posted: Fri Dec 26, 2008 5:08 am
by Ion Dune

Posted: Mon Dec 29, 2008 6:14 pm
by arras
You may also look at Tutorial 3: Custom SceneNode.