BranchGroup lineGroup = new BranchGroup(); Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f, 204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca);
BranchGroup lineGroup = new BranchGroup(); Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f, 204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca); for (int j = 0; j <2; j++) { plaPts[count] = new Point3f(i/10.0f,j/10.0f,0); colPts[count]=new Color3f(i/3.0f,j/3.0f,(float) ((i+j)/3.0));//my arbitrary color set :) count++;
BranchGroup lineGroup = new BranchGroup(); Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f, 204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca);
for(int i=0;i<24;i++)pts[i]=new Point3f(); Color3f [] clrs=new Color3f[24]; for(int i=0;i<24;i++)clrs[i]=new Color3f(0.5f,0.5f,0.5f); pa.setCullFace(PolygonAttributes.CULL_NONE); Material mat=new Material(); 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); RenderingAttributes ra=new RenderingAttributes(); ColoringAttributes ca=new ColoringAttributes(); ca.setShadeModel(ColoringAttributes.SHADE_GOURAUD); ca.setColor(new Color3f(0.2f,0.5f,0.9f)); app.setColoringAttributes(ca); app.setRenderingAttributes(ra); light1.setColor(new Color3f(1f,1f,1f)); light1.setDirection(new Vector3f(0,1,0)); objRotate.addChild(light1); DirectionalLight light2=new DirectionalLight(); light2.setInfluencingBounds(new BoundingSphere(new Point3d(5.0,0,0),10.0)); light2.setColor(new Color3f(0.5f,1f,0.5f)); light2.setDirection(new Vector3f(0,-1,0)); objRotate.addChild(light2);
BranchGroup lineGroup = new BranchGroup(); Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f,204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca); Point3f[] plaPts = new Point3f[5]; app.setPolygonAttributes(la); 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); matt.setSpecularColor(new Color3f(0.4f,0.6f,0.9f)); matt.setLightingEnable(true); al.setColor(new Color3f(1,1,1));
for(int i=0;i<24;i++)pts[i]=new Point3f(); Color3f [] clrs=new Color3f[24]; for(int i=0;i<24;i++)clrs[i]=new Color3f(0.5f,0.5f,0.5f); pa.setCullFace(PolygonAttributes.CULL_NONE); Material mat=new Material(); 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); RenderingAttributes ra=new RenderingAttributes(); ColoringAttributes ca=new ColoringAttributes(); ca.setShadeModel(ColoringAttributes.SHADE_GOURAUD); ca.setColor(new Color3f(0.2f,0.5f,0.9f)); app.setColoringAttributes(ca); app.setRenderingAttributes(ra); DirectionalLight light1=new DirectionalLight(); light1.setInfluencingBounds(new BoundingSphere(new Point3d(-5.0,0,0),10.0)); light1.setColor(new Color3f(1f,1f,1f)); light1.setDirection(new Vector3f(0,1,0)); objRotate.addChild(light1); DirectionalLight light2=new DirectionalLight(); light2.setInfluencingBounds(new BoundingSphere(new Point3d(5.0,0,0),10.0)); light2.setColor(new Color3f(0.5f,1f,0.5f)); light2.setDirection(new Vector3f(0,-1,0)); objRotate.addChild(light2);
@Override protected Object clone() { ColoringAttributesRetained cr = (ColoringAttributesRetained)super.clone(); cr.color = new Color3f(color); // shadeModel is copied in super.clone() return cr; }
synchronized public void addTo3DViewer(final Image3DUniverse univ, final Color c, final ImagePlus colorImage) { if (c == null) throw new RuntimeException("In addTo3DViewer, Color can no longer be null"); addTo3DViewer(univ, new Color3f(c), colorImage); }
void setIntensity(float intensity) { Color3f newLightColor = new Color3f(color.x * intensity, color.y * intensity, color.z * intensity); if (theLight != null) theLight.setColor(newLightColor); this.intensity = intensity; }
/** * Sets this material's ambient color and sends a message notifying * the interested structures of the change. * This specifies how much ambient light is reflected by * the surface. The ambient light color is the product of this * color and the material diffuseColor. * @param color the material's ambient color */ final void setAmbientColor(Color3f color) { initAmbientColor(color); sendMessage(AMBIENT_COLOR_CHANGED, new Color3f(color)); }
/** * Sets this material's diffuse color and sends a message notifying * the interested structures of the change. * This is the color of the material when illuminated by a light source. * @param color the new diffuse color */ final void setDiffuseColor(Color3f color) { initDiffuseColor(color); sendMessage(DIFFUSE_COLOR_CHANGED, new Color3f(color)); }
/** * Sets this material's diffuse color and sends a message notifying * the interested structures of the change. * @param r the new diffuse color's red component * @param g the new diffuse color's green component * @param b the new diffuse color's blue component */ final void setDiffuseColor(float r, float g, float b) { initDiffuseColor(r, g, b); sendMessage(DIFFUSE_COLOR_CHANGED, new Color3f(r, g, b)); }
/** * Sets this material's specular color and sends a message notifying * the interested structures of the change. * This is the specular highlight color of the material. * @param color the new specular color */ final void setSpecularColor(Color3f color) { initSpecularColor(color); sendMessage(SPECULAR_COLOR_CHANGED, new Color3f(color)); }
/** * Sets the color of this light node and send a message * @param color the value of this new light color */ void setColor(Color3f color) { initColor(color); sendMessage(COLOR_CHANGED, new Color3f(color)); }
/** * Sets this material's emissive color and sends a message notifying * the interested structures of the change. * This is the color of light, if any, that the material emits. * @param color the new emissive color */ final void setEmissiveColor(Color3f color) { initEmissiveColor(color); sendMessage(EMISSIVE_COLOR_CHANGED, new Color3f(color)); }
/** * Sets this material's emissive color and sends a message notifying * the interested structures of the change. * This is the color of light, if any, that the material emits. * @param r the new emissive color's red component * @param g the new emissive color's green component * @param b the new emissive color's blue component */ final void setEmissiveColor(float r, float g, float b) { initEmissiveColor(r, g, b); sendMessage(EMISSIVE_COLOR_CHANGED, new Color3f(r, g, b)); }
@Override public void writeObject( DataOutput out ) throws IOException { super.writeObject( out ); ColoringAttributes attr = (ColoringAttributes)node; Color3f clr = new Color3f(); attr.getColor( clr ); control.writeColor3f( out, clr ); out.writeInt( attr.getShadeModel() ); }
@Override public void colorUpdated(Color3f newColor) { if (newColor == null) { final int val = c.getImage().getProcessor().getColorModel().getRGB(c.getThreshold()); newColor = new Color3f(new Color(val)); } mesh.setColor(newColor); }
private void readSpecular(ObjectFileParser st) throws ParsingErrorException { Color3f p = new Color3f(); st.getNumber(); p.x = (float)st.nval; st.getNumber(); p.y = (float)st.nval; st.getNumber(); p.z = (float)st.nval; cur.Ks = p; st.skipToNextLine(); } // End of readSpecular
private void readAmbient(ObjectFileParser st) throws ParsingErrorException { Color3f p = new Color3f(); st.getNumber(); p.x = (float)st.nval; st.getNumber(); p.y = (float)st.nval; st.getNumber(); p.z = (float)st.nval; cur.Ka = p; st.skipToNextLine(); } // End of readAmbient