List of usage examples for javax.media.j3d GeometryArray setInterleavedVertices
public void setInterleavedVertices(float[] vertexData)
From source file:InterleavedTest.java
public GeometryArray createGeometry(int type) { GeometryArray tetra = null; int texCoordSetMap[] = { 0, 0 }; if (type == 1) { tetra = new TriangleArray(12, TriangleArray.COORDINATES | TriangleArray.COLOR_3 | /*/*from ww w . j av a 2 s .co m*/ * TriangleArray.NORMAL_3| */ TriangleArray.TEXTURE_COORDINATE_2 | TriangleArray.INTERLEAVED | TriangleArray.BY_REFERENCE, 2, texCoordSetMap); tetra.setInterleavedVertices(interleaved); } else if (type == 2) { tetra = new TriangleStripArray(12, TriangleStripArray.COORDINATES | TriangleStripArray.COLOR_3 | /* * TriangleArray.NORMAL_3| */ TriangleArray.TEXTURE_COORDINATE_2 | TriangleStripArray.INTERLEAVED | TriangleStripArray.BY_REFERENCE, 2, texCoordSetMap, stripVertexCounts); tetra.setInterleavedVertices(interleaved); } else if (type == 3) { // Indexed Geometry tetra = new IndexedTriangleArray(4, IndexedTriangleArray.COORDINATES | IndexedTriangleArray.COLOR_3 | /* * IndexedTriangleArray.NORMAL_3| */ IndexedTriangleArray.TEXTURE_COORDINATE_2 | IndexedTriangleArray.INTERLEAVED | IndexedTriangleArray.BY_REFERENCE, 2, texCoordSetMap, 12); tetra.setInterleavedVertices(indexedInterleaved); ((IndexedTriangleArray) tetra).setCoordinateIndices(0, indices); ((IndexedTriangleArray) tetra).setColorIndices(0, indices); ((IndexedTriangleArray) tetra).setTextureCoordinateIndices(0, 0, indices); ((IndexedTriangleArray) tetra).setTextureCoordinateIndices(1, 0, indices); } else if (type == 4) { // Indexed strip geometry tetra = new IndexedTriangleStripArray(4, IndexedTriangleStripArray.COORDINATES | IndexedTriangleStripArray.COLOR_3 | /* * IndexedTriangleArray.NORMAL_3| */ IndexedTriangleArray.TEXTURE_COORDINATE_2 | IndexedTriangleStripArray.INTERLEAVED | IndexedTriangleStripArray.BY_REFERENCE, 2, texCoordSetMap, 12, stripVertexCounts); tetra.setInterleavedVertices(indexedInterleaved); ((IndexedTriangleStripArray) tetra).setCoordinateIndices(0, indices); ((IndexedTriangleStripArray) tetra).setColorIndices(0, indices); ((IndexedTriangleStripArray) tetra).setTextureCoordinateIndices(0, 0, indices); ((IndexedTriangleStripArray) tetra).setTextureCoordinateIndices(1, 0, indices); } else if (type == 5) { // Interleaved array } return tetra; }