From mesh to geometry

From previous chapters you remember that a scene is made up of spatials. A spatial can either be an invisible node, or a visible geometry. Have another look at the following two lines from our WireframeShapes.java example:

Box mesh = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry("Box", mesh);

You notice that the magic ingredient that makes a geometry visible is a polygon mesh: first you create a mesh shape (here the box), then you wrap the geometry object around it. The advantage is that you can reuse the same mesh in several geometries.

The mesh data type is just a shape—pure, unaltered vertex data. The com.jme3.scene.Geometry data type combines the inner mesh, the surface material, and transformations into ...

Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.