RenderingAttributes ra=new RenderingAttributes(); ra.setIgnoreVertexColors(true); 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);
/** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ @Override public NodeComponent cloneNodeComponent() { ColoringAttributes ca = new ColoringAttributes(); ca.duplicateNodeComponent(this); return ca; }
/** * 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); }
Appearance appearanceGreen = new Appearance(); ColoringAttributes coloringAttributesGreen = new ColoringAttributes(); coloringAttributesGreen.setColor(new Color3f(Color.green)); appearanceGreen.setColoringAttributes(coloringAttributesGreen); Shape3D shapeLine = new Shape3D(lineX, appearanceGreen); scene.addChild(shapeLine);
appearance.setLineAttributes(lineAttributes); ColoringAttributes colorAttributes = new ColoringAttributes(); colorAttributes.setCapability(ColoringAttributes.ALLOW_COLOR_READ); colorAttributes.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE); colorAttributes.setColor(EDGE_COLOR_3f); appearance.setColoringAttributes(colorAttributes);
/** * Use the currently selected color to paint an edge. * * @param shape a Java3D shape - must be a LineArray * */ void highlightEdge(Shape3D shape) { Color3f highlightColor = volumes.getSelectedColor(); if (shape.getGeometry() instanceof LineArray) { Appearance appearance = shape.getAppearance(); ColoringAttributes ca = appearance.getColoringAttributes(); Color3f before = new Color3f(); appearance.setColoringAttributes(ca); ca.getColor(before); ca.setColor(highlightColor); } }
@Override public void readObject( DataInput in ) throws IOException { super.readObject( in ); ColoringAttributes attr = (ColoringAttributes)node; attr.setColor( control.readColor3f(in) ); attr.setShadeModel( in.readInt() ); }
app.setPolygonAttributes(polyAttrib); final ColoringAttributes colorAttrib = new ColoringAttributes(); colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD);
@Override protected SceneGraphObject createNode() { return new ColoringAttributes(); }
/** * Returns a String representation of this ColoringAttributes object. * If the scene graph is live only those values with their * Capability read bit set will be displayed. */ @Override public String toString() { StringBuffer str = new StringBuffer(getNamePrefix()); str.append("org.scijava.java3d.ColoringAttributes: "); String shadingModes[] = { "FASTEST", "NICEST", "SHADE_FLAT", "SHADE_GOURAUD" }; try { Color3f color=new Color3f(); getColor( color ); str.append( "Color="+color ); } catch (CapabilityNotSetException e) {str.append("Color=N/A");} try { str.append( " ShadeModel="+shadingModes[getShadeModel()] ); } catch (CapabilityNotSetException ex) {str.append("ShadeModel=N/A");} return new String(str); }
/** * Set the color for all the textures that were loaded by this * AppearanceCreator. Pixel values below the threshold are not rendered. * * @param c */ public void setColor(final Color3f c) { colAttr.setColor(c); }
@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() ); }
material.setLightingEnable(false); colAttr = new ColoringAttributes(); colAttr.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE); colAttr.setShadeModel(ColoringAttributes.NICEST); if (color == null) { colAttr.setColor(1f, 1f, 1f); colAttr.setColor(color);
private Appearance createAppearance(final Color3f color) { final Appearance a = new Appearance(); final PolygonAttributes pa = new PolygonAttributes(); pa.setPolygonMode(PolygonAttributes.POLYGON_FILL); pa.setCullFace(PolygonAttributes.CULL_NONE); a.setPolygonAttributes(pa); final ColoringAttributes ca = new ColoringAttributes(); ca.setColor(color); a.setColoringAttributes(ca); return a; }
object.setCoordinates(0, shape.coordsArray); ColoringAttributes colorAtt = new ColoringAttributes(surf.getColor(), ColoringAttributes.FASTEST); PointAttributes pointStyle = new PointAttributes(); object.setCoordinates(0, shape.coordsArray); ColoringAttributes colorAtt = new ColoringAttributes(surf.getColor(), ColoringAttributes.FASTEST); appearance.setColoringAttributes(colorAtt);
public void setColor(final Color3f c) { colAttr.setColor(c); }
material.setLightingEnable(true); colAttr = new ColoringAttributes(); colAttr.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE); colAttr.setShadeModel(ColoringAttributes.NICEST); if (color == null) { colAttr.setColor(1f, 1f, 1f); colAttr.setColor(color);
RenderingAttributes ra=new RenderingAttributes(); ra.setIgnoreVertexColors(true); 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);
public Appearance createTextAppearance() { final Appearance textAppear = new Appearance(); final ColoringAttributes textColor = new ColoringAttributes(); textColor.setColor(color); textAppear.setColoringAttributes(textColor); final PolygonAttributes pa = new PolygonAttributes(); pa.setCullFace(PolygonAttributes.CULL_NONE); pa.setBackFaceNormalFlip(true); textAppear.setPolygonAttributes(pa); return textAppear; }