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);
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);
/** * 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); }
public void setColor(final Color3f c) { colAttr.setColor(c); }
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);
@Override public void readObject( DataInput in ) throws IOException { super.readObject( in ); ColoringAttributes attr = (ColoringAttributes)node; attr.setColor( control.readColor3f(in) ); attr.setShadeModel( in.readInt() ); }
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; }
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; }
/** * 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); } }
/** * 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); }
continue; ca.setColor(resetColor); appearance.setColoringAttributes(ca); LineArray segments = (LineArray) shape.getGeometry();
public void addVertex(Image3DUniverse univ, Color3f color, float x, float y, float z) { BranchGroup bg = new BranchGroup(); bg.setCapability(BranchGroup.ALLOW_DETACH); TransformGroup tg = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setTranslation(new Vector3f(x, y, z)); tg.setTransform(t3d); bg.addChild(tg); Appearance app = new Appearance(); ColoringAttributes cattr = new ColoringAttributes(); cattr.setColor(color); app.setColoringAttributes(cattr); tg.addChild(new Sphere(0.1f, app)); univ.getScene().addChild(bg); }
textColor.setColor(color); textAppear.setColoringAttributes(textColor);
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; }
colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD); if (null != color) // is null when colors are vertex-wise colorAttrib.setColor(color); appearance.setColoringAttributes(colorAttrib);
colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD); if (null != color) // is null when colors are vertex-wise colorAttrib.setColor(color); appearance.setColoringAttributes(colorAttrib);
appearance.setTransparencyAttributes(ta); ca = new ColoringAttributes(); ca.setColor(color); appearance.setColoringAttributes(ca);
colAttr.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE); colAttr.setShadeModel(ColoringAttributes.NICEST); colAttr.setColor(1f, 1f, 1f); appearance.setColoringAttributes(colAttr);
colAttr.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE); colAttr.setShadeModel(ColoringAttributes.NICEST); colAttr.setColor(1f, 1f, 1f); appearance.setColoringAttributes(colAttr);