/** * Sets the color of all handle boxes. * @param color the color. */ public static void setColor(Color color) { _colorState.setColor(color); _box.dirtyDraw(); }
/** * Sets the color of the quads in this quad group. * Note that if per-vertex colors were specified when this quad * group was constructed, then the color specified here is not used. * @param color the color. */ public void setColor(Color color) { StateSet states = getStates(); ColorState cs = (ColorState)states.find(ColorState.class); if (cs==null) cs = new ColorState(); cs.setColor(color); }
/** * Sets the color of the triangles in this triangle group. * Note that if per-vertex colors were specified when this triangle group was * constructed, then the color specified here is not used. * @param color the color. */ public void setColor(Color color) { StateSet states = getStates(); ColorState cs = (ColorState)states.find(ColorState.class); if (cs==null) cs = new ColorState(); cs.setColor(color); }
Box() { StateSet states = new StateSet(); _materialState = new MaterialState(); _materialState.setColorMaterialFront(GL_AMBIENT_AND_DIFFUSE); _materialState.setSpecularFront(Color.white); _materialState.setShininessFront(100.0f); states.add(_materialState); _colorState = new ColorState(); _colorState.setColor(Color.YELLOW); states.add(_colorState); setStates(states); } protected void draw(DrawContext dc) {
/** * Initializes the triangle group states. */ private static StateSet defaultStateSet(Color color) { StateSet states = new StateSet(); ColorState cs = new ColorState(); cs.setColor(color); LightModelState lms = new LightModelState(); lms.setTwoSide(true); MaterialState ms = new MaterialState(); ms.setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ms.setSpecular(Color.WHITE); ms.setShininess(100.0f); states.add(cs); states.add(lms); states.add(ms); return states; }
/** * Initializes the quad group states. */ private static StateSet defaultStateSet(Color color) { StateSet states = new StateSet(); ColorState cs = new ColorState(); cs.setColor(color); LightModelState lms = new LightModelState(); lms.setTwoSide(true); MaterialState ms = new MaterialState(); ms.setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ms.setSpecular(Color.WHITE); ms.setShininess(100.0f); states.add(cs); states.add(lms); states.add(ms); return states; }
ps.setSize(10f); ColorState cs = new ColorState(); cs.setColor(new Color(82,85,100)); ss.add(ps); ss.add(cs);
public static void main(String[] args) { float[] xyz = makeSineWave(); xyz = addBulge(xyz); xyz = addTear(xyz); float[] rgb = makeColors(xyz); System.out.println("Making QuadGroup ..."); QuadGroup tg = new QuadGroup(true,xyz,rgb); System.out.println("QuadGroup bounding sphere =\n" + tg.getBoundingSphere(true)); StateSet states = new StateSet(); ColorState cs = new ColorState(); cs.setColor(Color.CYAN); states.add(cs); LightModelState lms = new LightModelState(); lms.setTwoSide(true); states.add(lms); MaterialState ms = new MaterialState(); ms.setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ms.setSpecular(Color.white); ms.setShininess(100.0f); states.add(ms); tg.setStates(states); World world = new World(); world.addChild(tg); DemoFrame frame = new DemoFrame(world); OrbitView view = frame.getOrbitView(); view.setWorldSphere(new BoundingSphere(5,5,5,5)); frame.setSize(new Dimension(800,600)); frame.setVisible(true); }
if (color!=null) { ColorState cs = new ColorState(); cs.setColor(color); ss.add(cs);
public static void go() { float[] xyz = makeSineWave(); xyz = addBulge(xyz); xyz = addTear(xyz); float[] rgb = makeColors(xyz); TriangleGroup tg = new TriangleGroup(true,xyz,rgb); System.out.println("TriangleGroup bounding sphere =\n" + tg.getBoundingSphere(true)); StateSet states = new StateSet(); ColorState cs = new ColorState(); cs.setColor(Color.CYAN); states.add(cs); LightModelState lms = new LightModelState(); lms.setTwoSide(true); states.add(lms); MaterialState ms = new MaterialState(); ms.setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ms.setSpecular(Color.WHITE); ms.setShininess(100.0f); states.add(ms); tg.setStates(states); World world = new World(); world.addChild(tg); DemoFrame frame = new DemoFrame(world); OrbitView view = frame.getOrbitView(); view.setWorldSphere(new BoundingSphere(5,5,5,5)); frame.setSize(new Dimension(800,600)); frame.setVisible(true); }
cs.setColor(Color.CYAN); states.add(cs); LightModelState lms = new LightModelState();