List of usage examples for javax.media.j3d QuadArray setColor
public void setColor(int index, float color[])
From source file:FarbWurfelAsQuads.java
/** * Erstellung des ColorCube/* w w w .j a v a 2 s . c om*/ * * @return */ private QuadArray makeCube() { QuadArray plane = new QuadArray(24, GeometryArray.COORDINATES | GeometryArray.COLOR_3); // Punkte und Farben Point3f pa = new Point3f(-1.0f, 1.0f, -1.0f); Point3f pb = new Point3f(-1.0f, -1.0f, -1.0f); Point3f pc = new Point3f(1.0f, -1.0f, -1.0f); Point3f pd = new Point3f(1.0f, 1.0f, -1.0f); Point3f pe = new Point3f(-1.0f, 1.0f, 1.0f); Point3f pf = new Point3f(-1.0f, -1.0f, 1.0f); Point3f pg = new Point3f(1.0f, -1.0f, 1.0f); Point3f ph = new Point3f(1.0f, 1.0f, 1.0f); // Coloreigenschaften Color3f red = new Color3f(1.0f, 0.0f, 0.0f); Color3f blue = new Color3f(0.0f, 0.0f, 1.0f); Color3f green = new Color3f(0.0f, 1.0f, 0.0f); Color3f cyan = new Color3f(0.0f, 1.0f, 1.0f); Color3f yellow = new Color3f(1.0f, 1.0f, 0.0f); Color3f magenta = new Color3f(1.0f, 0.0f, 1.0f); // 1. Seite plane.setCoordinate(0, pa); plane.setColor(0, red); plane.setCoordinate(1, pb); plane.setColor(1, red); plane.setCoordinate(2, pc); plane.setColor(2, red); plane.setCoordinate(3, pd); plane.setColor(3, red); // 2. Seite plane.setCoordinate(4, pe); plane.setColor(4, blue); plane.setCoordinate(5, pf); plane.setColor(5, blue); plane.setCoordinate(6, pg); plane.setColor(6, blue); plane.setCoordinate(7, ph); plane.setColor(7, blue); // 3. Seite plane.setCoordinate(8, pe); plane.setColor(8, green); plane.setCoordinate(9, pf); plane.setColor(9, green); plane.setCoordinate(10, pb); plane.setColor(10, green); plane.setCoordinate(11, pa); plane.setColor(11, green); // 4. Seite plane.setCoordinate(12, pd); plane.setColor(12, cyan); plane.setCoordinate(13, pc); plane.setColor(13, cyan); plane.setCoordinate(14, pg); plane.setColor(14, cyan); plane.setCoordinate(15, ph); plane.setColor(15, cyan); // 5. Seite plane.setCoordinate(16, pe); plane.setColor(16, yellow); plane.setCoordinate(17, pa); plane.setColor(17, yellow); plane.setCoordinate(18, pd); plane.setColor(18, yellow); plane.setCoordinate(19, ph); plane.setColor(19, yellow); // 6. Seite plane.setCoordinate(20, pf); plane.setColor(20, magenta); plane.setCoordinate(21, pb); plane.setColor(21, magenta); plane.setCoordinate(22, pc); plane.setColor(22, magenta); plane.setCoordinate(23, pg); plane.setColor(23, magenta); // ubergib den Wurfel return plane; }