Example usage for javax.media.j3d IndexedTriangleArray setCoordinateIndex

List of usage examples for javax.media.j3d IndexedTriangleArray setCoordinateIndex

Introduction

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

Prototype

public void setCoordinateIndex(int index, int coordinateIndex) 

Source Link

Document

Sets the coordinate index associated with the vertex at the specified index for this object.

Usage

From source file:KeyNavigatorApp.java

Shape3D createPyramid() {
    IndexedTriangleArray pyGeom = new IndexedTriangleArray(5, GeometryArray.COORDINATES | GeometryArray.COLOR_3,
            12);//from   www  . jav  a2s.c  o  m

    pyGeom.setCoordinate(0, new Point3f(0.0f, 0.7f, 0.0f));
    pyGeom.setCoordinate(1, new Point3f(-0.4f, 0.0f, -0.4f));
    pyGeom.setCoordinate(2, new Point3f(-0.4f, 0.0f, 0.4f));
    pyGeom.setCoordinate(3, new Point3f(0.4f, 0.0f, 0.4f));
    pyGeom.setCoordinate(4, new Point3f(0.4f, 0.0f, -0.4f));

    pyGeom.setCoordinateIndex(0, 0);
    pyGeom.setCoordinateIndex(1, 1);
    pyGeom.setCoordinateIndex(2, 2);
    pyGeom.setCoordinateIndex(3, 0);
    pyGeom.setCoordinateIndex(4, 2);
    pyGeom.setCoordinateIndex(5, 3);
    pyGeom.setCoordinateIndex(6, 0);
    pyGeom.setCoordinateIndex(7, 3);
    pyGeom.setCoordinateIndex(8, 4);
    pyGeom.setCoordinateIndex(9, 0);
    pyGeom.setCoordinateIndex(10, 4);
    pyGeom.setCoordinateIndex(11, 1);

    Color3f c = new Color3f(0.6f, 0.5f, 0.55f);
    pyGeom.setColor(0, c);
    pyGeom.setColor(1, c);
    pyGeom.setColor(2, c);
    pyGeom.setColor(3, c);
    pyGeom.setColor(4, c);

    Shape3D pyramid = new Shape3D(pyGeom);
    return pyramid;
}