List of usage examples for javax.media.j3d IndexedTriangleArray setColor
public void setColor(int index, float color[])
From source file:KeyNavigatorApp.java
Shape3D createPyramid() { IndexedTriangleArray pyGeom = new IndexedTriangleArray(5, GeometryArray.COORDINATES | GeometryArray.COLOR_3, 12);/* ww w. j a v a 2s . 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; }