JME 3.0 Mesh

Hi guys,

I was wondering whether anybody could point me to some resources on the new JME 3.0 Mesh object? I’ve been fiddling around trying to set vertices, normals, colours and texture coordinates, however Mesh seems quite different to TriMesh. Basically I’m trying to create my own Mesh to use as a terrain (yea, I know that the new Terrain system is out but I wanted to play with this anyway)…

Any hints / tips would be appreciated. Thanks!

I realize that I am continuously asking for more help; sorry.

Hi there!

For the moment there’s no good tutorial about Mesh class (actually I was the one who volunteer to write one). So for now you can ask here all your questions, and we all will try to cover them up.

In two words there isn’t too much difference in Mesh and TriMesh.

To make a Mesh, you need to:

  1. Define vertexes as vertex buffer.
  2. Define texture coordinates as texture coordinates buffer.
  3. Define indexes as… well as buffer too :slight_smile:
  4. Define normals (optionally, for now).

    Something like this:

    Mesh m = new Mesh();

    Vector3f[] vertexPoints = new Vector3f[…];

    Vector2f[] texturePoints = new Vector2f[…];

    Vector3f[] normals = new Vector3f[…];

    int[] indexes = new int[…];

    // here define all coordinates here

    m.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertexPoints));

    m.setBuffer(Type.TexCoord, 2, BufferUtils.createFloatBuffer(texturePoints));

    m.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(normals));

    m.setBuffer(Type.Index, 1, indexes);



    This is the concept. If you look at the TriMesh tutorial, you will find a lot of common with what I have written. Hope this will give you the starting point :slight_smile:

Thanks KayTrance. Very helpful.