Making my own mesh inside of the engine

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
CameroKid
Posts: 71
Joined: Tue Jul 11, 2006 8:54 pm

Making my own mesh inside of the engine

Post 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?
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

You'll have to make your own mesh buffer.

http://irrlicht.sourceforge.net/docu/cl ... uffer.html
CameroKid
Posts: 71
Joined: Tue Jul 11, 2006 8:54 pm

Post 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?
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post 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.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I recently posted some code to create a cylinder mesh. I'm thinking you might find it useful.

Travis
CameroKid
Posts: 71
Joined: Tue Jul 11, 2006 8:54 pm

Post 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.
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post 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.
CameroKid
Posts: 71
Joined: Tue Jul 11, 2006 8:54 pm

Post by CameroKid »

Thanks for the help everything works great. Out of curiosity what are the last two coordinates in a vertex? the Tcoords
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

You may also look at Tutorial 3: Custom SceneNode.
Post Reply