Material matt=new Material(); matt.setAmbientColor(new Color3f(1,1,1)); matt.setDiffuseColor(new Color3f(0.5f,0.5f,0.7f)); matt.setEmissiveColor(new Color3f(0.2f,0.2f,0.3f)); matt.setShininess(0.5f);
mat.setEmissiveColor(new Color3f(0.5f,0.5f,0.5f)); mat.setAmbientColor(new Color3f(0.1f,0.1f,0.1f)); mat.setDiffuseColor(new Color3f(0.2f,0.3f,0.4f)); mat.setSpecularColor(new Color3f(0.6f,0.3f,0.2f)); mat.setLightingEnable(true);
mat.setEmissiveColor(new Color3f(0.5f,0.5f,0.5f)); mat.setAmbientColor(new Color3f(0.1f,0.1f,0.1f)); mat.setDiffuseColor(new Color3f(0.2f,0.3f,0.4f)); mat.setSpecularColor(new Color3f(0.6f,0.3f,0.2f)); mat.setLightingEnable(true);
Appearance appearance = new Appearance(); Material material = new Material(); material.setDiffuseColor(1.0f, 0.0f, 0.0f); // red material.setSpecularColor(0.2f, 0.2f, 0.2f); // reduce default values appearance.setMaterial(material);
/** * Sets the color of the 6DOF sensor echo. The default is white. This * can be called to set the color before or after the echo geometry is * created. * * @param color the echo color */ public void setEchoColor(Color3f color) { if (echoColor == null) echoColor = new Color3f(color) ; else echoColor.set(color) ; if (echoGeometry != null) { Appearance a = echoGeometry.getAppearance() ; Material m = a.getMaterial() ; m.setDiffuseColor(echoColor) ; } }
@Override public void readObject( DataInput in ) throws IOException { super.readObject( in ); Material attr = (Material)node; attr.setAmbientColor( control.readColor3f( in ) ); attr.setDiffuseColor( control.readColor3f( in ) ); attr.setEmissiveColor( control.readColor3f( in ) ); attr.setSpecularColor( control.readColor3f( in ) ); attr.setLightingEnable( in.readBoolean() ); attr.setColorTarget( in.readInt() ); }
if ((vlist.vertexFormat & GeometryArray.WITH_ALPHA) == 0) { m.setAmbientColor(curColor.x, curColor.y, curColor.z) ; m.setDiffuseColor(curColor.x, curColor.y, curColor.z) ; m.setDiffuseColor(curColor.x, curColor.y, curColor.z, curColor.w) ;
if ((vlist.vertexFormat & GeometryArray.COLOR_4) != GeometryArray.COLOR_4) { m.setAmbientColor(curColor.x, curColor.y, curColor.z) ; m.setDiffuseColor(curColor.x, curColor.y, curColor.z) ; m.setDiffuseColor(curColor.x, curColor.y, curColor.z, curColor.w) ;
/** * Create a default Appearance object using the specified color. * * @param color */ private void initAppearance(final Color3f color) { appearance = new Appearance(); appearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ); final ColoringAttributes colorAttrib = new ColoringAttributes(); colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD); colorAttrib.setColor(color); colorAttrib.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE); appearance.setColoringAttributes(colorAttrib); final Material material = new Material(); material.setDiffuseColor(color); appearance.setMaterial(material); }
if (p.Kd != null) m.setDiffuseColor(p.Kd);
target.setDiffuseColor(newColor); break; case Material.EMISSIVE:
material.setAmbientColor(0.1f, 0.1f, 0.1f); material.setSpecularColor(0.5f, 0.5f, 0.5f); material.setDiffuseColor(0.1f, 0.1f, 0.1f); app.setMaterial(material); return app;
protected Appearance createAppearance() { final Appearance appearance = new Appearance(); appearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ); final PolygonAttributes polyAttrib = new PolygonAttributes(); polyAttrib.setCapability(PolygonAttributes.ALLOW_MODE_WRITE); if (this.shaded) polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_FILL); else polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_LINE); polyAttrib.setCullFace(PolygonAttributes.CULL_NONE); polyAttrib.setBackFaceNormalFlip(true); appearance.setPolygonAttributes(polyAttrib); final ColoringAttributes colorAttrib = new ColoringAttributes(); colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD); if (null != color) // is null when colors are vertex-wise colorAttrib.setColor(color); appearance.setColoringAttributes(colorAttrib); final TransparencyAttributes tr = new TransparencyAttributes(); final int mode = TransparencyAttributes.FASTEST; tr.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE); tr.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE); tr.setTransparencyMode(mode); tr.setTransparency(transparency); appearance.setTransparencyAttributes(tr); final Material material = new Material(); material.setCapability(Material.ALLOW_COMPONENT_WRITE); material.setAmbientColor(0.1f, 0.1f, 0.1f); material.setSpecularColor(0.1f, 0.1f, 0.1f); material.setDiffuseColor(0.1f, 0.1f, 0.1f); appearance.setMaterial(material); return appearance; }
material.setAmbientColor(0.1f, 0.1f, 0.1f); material.setSpecularColor(0.1f, 0.1f, 0.1f); material.setDiffuseColor(0.1f, 0.1f, 0.1f); appearance.setMaterial(material); return appearance;
material.setAmbientColor(0.1f, 0.1f, 0.1f); material.setSpecularColor(0.1f, 0.1f, 0.1f); material.setDiffuseColor(0.1f, 0.1f, 0.1f); appearance.setMaterial(material); return appearance;
if (echoColor != null) { Material m = a.getMaterial() ; m.setDiffuseColor(echoColor) ;
material.setAmbientColor(0.1f, 0.1f, 0.1f); material.setSpecularColor(0.1f, 0.1f, 0.1f); material.setDiffuseColor(0.1f, 0.1f, 0.1f); appearance.setMaterial(material); return appearance;
material.setAmbientColor(0.1f, 0.1f, 0.1f); material.setSpecularColor(0.1f, 0.1f, 0.1f); material.setDiffuseColor(0.1f, 0.1f, 0.1f); appearance.setMaterial(material); return appearance;