This section explains how mjbWorld stores 3D shapes
geometryBean
The shapes below are derived from geometryBean which stores all the vertex information
- Indexed face Set (IFS)
- box
- cone
- cylinder
- Elivation grid
- extrusion
- sphere
- text
- raster
- blob (a custom extension of IFS to allow non rigid shapes)
Issues with using Indexed arrays
When you instantiate non-indexed geometric primitive there is a one-to-one correspondence between the per-vertex component array sizes and the number of vertices used to define your geometry:
triangle = new TriangleArray(10, ....
^
|
ten verices define the Triangle array
When using an indexed primitive, the vertex count specifies the number of possible (or defined) vertices. The index count defines the actual number of vertices (drawn from the set in the per-vertex component arrays) that define the geometry. So:
itriangle = new IndexedTriangleArray(10, GeometryArray.COORDINATES, 2)
^ ^
| |
total number of verts loaded |
|
selecting only 2 of the 10 loaded
itriangle = new IndexedTriangleArray(10, GeometryArray.COORDINATES, 100)
^ ^
| |
total number of verts loaded |
|
selecting 100 from the 10 loaded
(re-using)
This can cause a lot of duplication duplication. If each of your vertices is the same color, and you have 100 vertices to load, then you duplicate the color 100 times.





