/** * Sets the diffuse color for front faces. * @param diffuse the diffuse color. */ public void setDiffuseFront(Color diffuse) { _diffuseFront = toArray(diffuse); _diffuseFrontSet = true; }
/** * Gets the emissive color for back faces. * @return the emissive color. */ public Color getEmissiveBack() { return toColor(_emissiveBack); }
/** * 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; }
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; }
public static void main(String[] args) { StateSet states = new StateSet(); MaterialState ms = new MaterialState(); ms.setColorMaterialFront(GL_AMBIENT_AND_DIFFUSE); ms.setSpecularFront(Color.white); ms.setShininessFront(100.0f); states.add(ms); ColorCubeDemo cc1 = new ColorCubeDemo(); ColorCubeDemo cc2 = new ColorCubeDemo(); cc1.setStates(states); cc2.setStates(states); TransformGroup tg1 = new TransformGroup(Matrix44.translate(-2,0,0)); TransformGroup tg2 = new TransformGroup(Matrix44.translate( 2,0,0)); tg1.addChild(cc1); tg2.addChild(cc2); World world = new World(); world.addChild(tg1); world.addChild(tg2); DemoFrame frame = new DemoFrame(world); frame.setVisible(true); } }
lms.setTwoSide(true); ss.add(lms); MaterialState ms = new MaterialState(); ms.setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ms.setSpecular(Color.white); ms.setShininess(100.0f); ss.add(ms); return ss;
/** * Sets the ambient color for front and back faces. * @param ambient the ambient color. */ public void setAmbient(Color ambient) { _ambientFront = _ambientBack = toArray(ambient); _ambientFrontSet = _ambientBackSet = true; }
/** * Gets the ambient color for front faces. * @return the ambient color. */ public Color getAmbientFront() { return toColor(_ambientFront); }
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); }
/** * Sets the specular color for back faces. * @param specular the specular color. */ public void setSpecularBack(Color specular) { _specularBack = toArray(specular); _specularBackSet = true; }
/** * Gets the diffuse color for back faces. * @return the diffuse color. */ public Color getDiffuseBack() { return toColor(_diffuseBack); }
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); }
/** * Sets the emissive color for front and back faces. * @param emissive the emissive color. */ public void setEmissive(Color emissive) { _emissiveFront = _emissiveBack = toArray(emissive); _emissiveFrontSet = _emissiveBackSet = true; }
/** * Gets the specular color for front faces. * @return the specular color. */ public Color getSpecularFront() { return toColor(_specularFront); }
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); pg.setStates(states);
/** * Sets the diffuse color for front and back faces. * @param diffuse the diffuse color. */ public void setDiffuse(Color diffuse) { _diffuseFront = _diffuseBack = toArray(diffuse); _diffuseFrontSet = _diffuseBackSet = true; }
/** * Gets the ambient color for back faces. * @return the ambient color. */ public Color getAmbientBack() { return toColor(_ambientBack); }
/** * Sets the diffuse color for back faces. * @param diffuse the diffuse color. */ public void setDiffuseBack(Color diffuse) { _diffuseBack = toArray(diffuse); _diffuseBackSet = true; }
/** * Gets the diffuse color for front faces. * @return the diffuse color. */ public Color getDiffuseFront() { return toColor(_diffuseFront); }