Adding vertices to meshBuffer / Creating cube with segments

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
[DEF]
Posts: 17
Joined: Thu Jul 29, 2010 8:30 am

Adding vertices to meshBuffer / Creating cube with segments

Post by [DEF] »

Hi guys,

I've been trying and trying to get my head around this, but the answer keeps eluding me :S

The best I've managed to do is create a function where it makes a 3D grid of vertices, and then links the outside vertices into faces (with messy computations to get the indecies to point to the right vertices to make the triangles xD) but this approach leaves MANY MANY vertices just laying inside the cube (plus takes ages to generate) :S

So I decided to try take a mesh of 8 vertices, and then do some sort of splitting algorithm (not unlike a LOD type thing) to add vertices to the edges of the mesh, and then link them into triangles.

But it's not going so well :(

When I try to use the meshBuffer->append(vertices, vertCount, indices, indCount), things start to disappear or not render at all :S

So what I'm asking is, does anyone have a way of generating a cube mesh that's not as bulky as mine, or can fix my meshBuffer woes? Any help would be much appreciated :D

(just for info, yeah I'm trying to implement a planet-terrain-LOD system, hopefully like the Infinity game, I need a segmented cube, so I can expand it to a sphere :P)

Edit: I found this, but it seems to duplicate vertices at the edges... Is this okay? I don't actually know if duplicated vertices would matter.. :S would there be any way to weld them? Without affecting the indices list/triangles? :S if not, then I guess I'll implement this somehow.
Post Reply