Example usage for javax.media.j3d GeometryArray setCapability

List of usage examples for javax.media.j3d GeometryArray setCapability

Introduction

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

Prototype

public final void setCapability(int bit) 

Source Link

Document

Sets the specified capability bit.

Usage

From source file:CuboidTest.java

GeometryArray getGeom(int format) {
    GeometryArray obj;
    flags = format;//w  w w.j  a  v  a 2s  .co m

    numTris = 0;

    //Switch based on first primitive.
    switch (currPrimType[0]) {
    case TRIANGLES:
        obj = processTriangles();
        obj.setCapability(Geometry.ALLOW_INTERSECT);
        return obj;
    case QUADS:
        obj = processQuads();
        obj.setCapability(Geometry.ALLOW_INTERSECT);
        return obj;
    case QUAD_STRIP:
        obj = processQuadStrips();
        obj.setCapability(Geometry.ALLOW_INTERSECT);
        return obj;
    }
    return null;
}

From source file:GeometryByReferenceTest.java

public GeometryArray createGeometry(int type) {
    GeometryArray tetra = null;
    if (type == 1) {
        tetra = new TriangleArray(12,
                TriangleArray.COORDINATES | TriangleArray.COLOR_3 | TriangleArray.BY_REFERENCE);

        tetra.setCoordRefFloat(floatVerts);
        tetra.setColorRefFloat(floatClrs);

    } else if (type == 2) {
        tetra = new TriangleStripArray(12,
                TriangleStripArray.COORDINATES | TriangleStripArray.COLOR_3 | TriangleStripArray.BY_REFERENCE,
                stripVertexCounts);/*www .  j ava 2 s . c o  m*/
        tetra.setCoordRefFloat(floatVerts);
        tetra.setColorRefFloat(floatClrs);

    } else if (type == 3) { // Indexed Geometry
        tetra = new IndexedTriangleArray(4, IndexedTriangleArray.COORDINATES | IndexedTriangleArray.COLOR_3
                | IndexedTriangleArray.BY_REFERENCE, 12);
        tetra.setCoordRefFloat(indexedFloatVerts);
        tetra.setColorRefFloat(indexedFloatClrs);
        ((IndexedTriangleArray) tetra).setCoordinateIndices(0, indices);
        ((IndexedTriangleArray) tetra).setColorIndices(0, indices);
    } else if (type == 4) { // Indexed strip geometry
        tetra = new IndexedTriangleStripArray(4, IndexedTriangleStripArray.COORDINATES
                | IndexedTriangleStripArray.COLOR_3 | IndexedTriangleStripArray.BY_REFERENCE, 12,
                stripVertexCounts);
        tetra.setCoordRefFloat(indexedFloatVerts);
        tetra.setColorRefFloat(indexedFloatClrs);
        ((IndexedTriangleStripArray) tetra).setCoordinateIndices(0, indices);
        ((IndexedTriangleStripArray) tetra).setColorIndices(0, indices);
    }

    if (tetra != null)
        tetra.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);
    return tetra;
}

From source file:GeometryByReferenceNIOBuffer.java

public GeometryArray createGeometry(int type) {
    GeometryArray tetra = null;
    if (type == 1) {
        tetra = new TriangleArray(12, TriangleArray.COORDINATES | TriangleArray.COLOR_3
                | TriangleArray.BY_REFERENCE | TriangleArray.USE_NIO_BUFFER);

        tetra.setCoordRefBuffer(floatBufferCoord);
        tetra.setColorRefBuffer(floatBufferColor);

    } else if (type == 2) {
        tetra = new TriangleStripArray(
                12, TriangleStripArray.COORDINATES | TriangleStripArray.COLOR_3
                        | TriangleStripArray.BY_REFERENCE | TriangleStripArray.USE_NIO_BUFFER,
                stripVertexCounts);/*from  w  ww .j av  a  2  s. c o m*/
        tetra.setCoordRefBuffer(floatBufferCoord);
        tetra.setColorRefBuffer(floatBufferColor);

    } else if (type == 3) { // Indexed Geometry
        tetra = new IndexedTriangleArray(4,
                IndexedTriangleArray.COORDINATES | IndexedTriangleArray.COLOR_3
                        | IndexedTriangleArray.BY_REFERENCE | IndexedTriangleArray.USE_NIO_BUFFER,
                //IndexedTriangleStripArray.USE_COORD_INDEX_ONLY,
                12);
        tetra.setCoordRefBuffer(indexedFloatBufferCoord);
        tetra.setColorRefBuffer(indexedFloatBufferColor);
        ((IndexedTriangleArray) tetra).setCoordinateIndices(0, indices);
        ((IndexedTriangleArray) tetra).setColorIndices(0, indices);
    } else if (type == 4) { // Indexed strip geometry
        tetra = new IndexedTriangleStripArray(4,
                IndexedTriangleStripArray.COORDINATES | IndexedTriangleStripArray.COLOR_3
                        | IndexedTriangleStripArray.BY_REFERENCE | IndexedTriangleStripArray.USE_NIO_BUFFER
                        | IndexedTriangleStripArray.USE_COORD_INDEX_ONLY,
                12, stripVertexCounts);
        tetra.setCoordRefBuffer(indexedFloatBufferCoord);
        tetra.setColorRefBuffer(indexedFloatBufferColor);
        ((IndexedTriangleStripArray) tetra).setCoordinateIndices(0, indices);
        ((IndexedTriangleStripArray) tetra).setColorIndices(0, indices);
    }

    if (tetra != null)
        tetra.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);
    return tetra;
}