Example usage for javax.media.j3d TriangleStripArray TriangleStripArray

List of usage examples for javax.media.j3d TriangleStripArray TriangleStripArray

Introduction

In this page you can find the example usage for javax.media.j3d TriangleStripArray TriangleStripArray.

Prototype

public TriangleStripArray(int vertexCount, int vertexFormat, int texCoordSetCount, int[] texCoordSetMap,
        int stripVertexCounts[]) 

Source Link

Document

Constructs an empty TriangleStripArray object using the specified parameters.

Usage

From source file:InterleavedTest.java

public GeometryArray createGeometry(int type) {
    GeometryArray tetra = null;/*from w w  w  .j  av  a  2s .c  o m*/
    int texCoordSetMap[] = { 0, 0 };

    if (type == 1) {
        tetra = new TriangleArray(12, TriangleArray.COORDINATES | TriangleArray.COLOR_3 |
        /*
        * 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;
}

From source file:InterleavedNIOBuffer.java

public GeometryArray createGeometry(int type) {
    GeometryArray tetra = null;// ww  w.ja  v a  2s .co m
    int texCoordSetMap[] = { 0, 0 };

    if (type == 1) {
        tetra = new TriangleArray(12, TriangleArray.COORDINATES | TriangleArray.COLOR_3 |
        /*
        * TriangleArray.NORMAL_3|
        */
                TriangleArray.TEXTURE_COORDINATE_2 | TriangleArray.INTERLEAVED | TriangleArray.BY_REFERENCE
                | TriangleArray.USE_NIO_BUFFER, 2, texCoordSetMap);

        tetra.setInterleavedVertexBuffer(interleavedBuffer);

    } 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 | TriangleStripArray.USE_NIO_BUFFER, 2, texCoordSetMap,
                stripVertexCounts);
        tetra.setInterleavedVertexBuffer(interleavedBuffer);

    } 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 | IndexedTriangleArray.USE_NIO_BUFFER
                | IndexedTriangleArray.USE_COORD_INDEX_ONLY, 2, texCoordSetMap, 12);
        tetra.setInterleavedVertexBuffer(indexedInterleavedBuffer);
        ((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 | IndexedTriangleStripArray.USE_NIO_BUFFER,
                //IndexedTriangleStripArray.USE_COORD_INDEX_ONLY,
                2, texCoordSetMap, 12, stripVertexCounts);
        tetra.setInterleavedVertexBuffer(indexedInterleavedBuffer);
        ((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;
}