Working with Mesh object in jME3

hi!



This is my first time I use jME3 instead of jME2, and I have some questions regarding Mesh object. While using TriMesh in jme2 instead of Mesh in jme3, I had such thing as setLocalTranslation, which sets a new center coordinates for local object. So my first question is what is the analogue to this for Mesh object in jme3?





Second one. TriMesh had such things as indexBuffer, VertexBuffer, NormalBuffer, etc. Mesh have:

setBuffer(VertexBuffer.Type type, int components, float[] buf)


where VertexBuffer.Type is:
- Type.Index for IndexBuffer,
- Type.Position for Vertex's position buffer, could be set via Vector3f array, and it should then be specified in int components  as 3 (for each coord, right?)
- Type.Normal for NormalIndex

Is this so?


Third question. There is such thing as Mesh.setMode(Mesh.Mode). What is the real difference in further operations like constructing mesh's indexes between different modes (mode.Points, mode.Triangles, mode.TriangleFan, mode.TriangleStrip..)?


And the final question: jme2 had a nice tutorial like HelloTriMesh.. does jme3 have something like HelloMesh? In jme2 this tutorial was very helpful for me.


Thank you! and thanks to the authors of jme3 for a marvelous release!



KayTrance said:

hi!

This is my first time I use jME3 instead of jME2, and I have some questions regarding Mesh object. While using TriMesh in jme2 instead of Mesh in jme3, I had such thing as setLocalTranslation, which sets a new center coordinates for local object. So my first question is what is the analogue to this for Mesh object in jme3?


Second one. TriMesh had such things as indexBuffer, VertexBuffer, NormalBuffer, etc. Mesh have:

setBuffer(VertexBuffer.Type type, int components, float[] buf)


where VertexBuffer.Type is:
- Type.Index for IndexBuffer,
- Type.Position for Vertex's position buffer, could be set via Vector3f array, and it should then be specified in int components  as 3 (for each coord, right?)
- Type.Normal for NormalIndex

Is this so?


Third question. There is such thing as Mesh.setMode(Mesh.Mode). What is the real difference in further operations like constructing mesh's indexes between different modes (mode.Points, mode.Triangles, mode.TriangleFan, mode.TriangleStrip..)?


And the final question: jme2 had a nice tutorial like HelloTriMesh.. does jme3 have something like HelloMesh? In jme2 this tutorial was very helpful for me.


Thank you! and thanks to the authors of jme3 for a marvelous release!

The Mesh is different from TriMesh in the way that its not part of the scene graph anymore (at least not directly). A Mesh doesn't have a transformation then. You associate a Geometry object with Mesh, and then you can change the Geometry's translation as well as attach it to the scene graph. This allows you to share a single mesh with many geometries in the scene graph.

For the types of buffers, Position would be getVertexBuffer() in jme2, Index is getIndexBuffer(), and Normal is getNormalBuffer().

Constructing indices for the enums in VertexBuffer.Mode is kind of specific, so I don't think I'll explain it. Those are rather standard modes that are used often within the computer graphics industry so you can find a lot of information about them online.

Thank you!