Example usage for javax.media.j3d IndexedTriangleArray setCoordinate

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

Introduction

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

Prototype

public void setCoordinate(int index, float coordinate[]) 

Source Link

Document

Sets the coordinate 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  w  w  w  .j a v a 2 s  .  co  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;
}