Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f, 204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca);
Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f, 204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca);
Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f, 204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca);
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]; for (int i = 0; i < 2; i++) {
ca.setShadeModel(ColoringAttributes.SHADE_GOURAUD); ca.setColor(new Color3f(0.2f,0.5f,0.9f)); app.setColoringAttributes(ca); app.setRenderingAttributes(ra); app.setMaterial(mat);
ca.setShadeModel(ColoringAttributes.SHADE_GOURAUD); ca.setColor(new Color3f(0.2f,0.5f,0.9f)); app.setColoringAttributes(ca); app.setRenderingAttributes(ra); app.setMaterial(mat);
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);
Group lineGroup = new Group(); Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(black, ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca); Computing comp = new Computing(); comp.do_the_job(); Point3f[] plaPts = new Point3f[Computing.computed_values.size()]; for(int i = 0; i < Computing.computed_values.size(); i++) { plaPts[i] = new Point3f((float)Computing.computed_values.get(i).getX(), (float)Computing.computed_values.get(i).getY(), (float)Computing.computed_values.get(i).getZ()); } PointArray pla = new PointArray(Computing.computed_values.size(), GeometryArray.COORDINATES); pla.setCoordinates(0, plaPts); Shape3D plShape = new Shape3D(pla, app); lineGroup.addChild(plShape); return lineGroup;
BranchGroup group = new BranchGroup(); //Content branch. PolygonAttributes p = new PolygonAttributes(); //Not sure how to make it transparent/try code above. Appearance planeAppearance = new Appearance(); planeAppearance.setPolygonAttributes (p); Color3f planeColor = new Color3f (1.0f, 1.0f, 1.0f); //This makes it white. ColoringAttributes planeCA = new ColoringAttributes (planeColor, 1); planeAppearance.setColoringAttributes(planeCA); QuadArray plane = new QuadArray (4, QuadArray.COORDINATES); //This makes the plane. plane.setCoordinate(0, new Point3f(-5f, -5f, -15f)); //You specify your own cornerpoints... plane.setCoordinate(1, new Point3f(5f, -5f, -15f)); plane.setCoordinate(2, new Point3f(5f, 5f, -15f)); plane.setCoordinate(3, new Point3f(-5f, 5f, -15f)); group.addChild(new Shape3D(plane, planeAppearance)); //Add plane to content branch.
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); } }
public Appearance getAppearance(final CubeData cdata, final int index) { final Appearance a = new Appearance(); a.setMaterial(material); a.setTransparencyAttributes(transAttr); a.setPolygonAttributes(polyAttr); a.setColoringAttributes(colAttr); a.setRenderingAttributes(rendAttr); a.setTexture(getTexture(cdata, index)); a.setTexCoordGeneration(cdata.tg); a.setTextureAttributes(texAttr); return a; }
/** * 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.setColoringAttributes(ca); LineArray segments = (LineArray) shape.getGeometry(); int nSegs = segments.getVertexCount();
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); }
colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD); app.setColoringAttributes(colorAttrib);
final ColoringAttributes textColor = new ColoringAttributes(); 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; }
@Override public void buildGraph() { Appearance app = (Appearance)node; app.setPolygonAttributes( (PolygonAttributes)control.getSymbolTable().getJ3dNode(polygonAttributes) ); app.setRenderingAttributes( (RenderingAttributes)control.getSymbolTable().getJ3dNode(renderingAttributes) ); app.setColoringAttributes( (ColoringAttributes)control.getSymbolTable().getJ3dNode(coloringAttributes) ); app.setLineAttributes( (LineAttributes)control.getSymbolTable().getJ3dNode(lineAttributes) ); app.setMaterial( (Material)control.getSymbolTable().getJ3dNode(material) ); app.setPointAttributes( (PointAttributes)control.getSymbolTable().getJ3dNode(pointAttributes) ); app.setTexCoordGeneration( (TexCoordGeneration)control.getSymbolTable().getJ3dNode(texCoordGeneration) ); app.setTextureAttributes( (TextureAttributes)control.getSymbolTable().getJ3dNode(textureAttributes) ); app.setTexture( (Texture)control.getSymbolTable().getJ3dNode(texture) ); TextureUnitState[] texUnitState = new TextureUnitState[ textureUnitState.length ]; for(int i=0; i<textureUnitState.length; i++) texUnitState[i] = (TextureUnitState)control.getSymbolTable().getJ3dNode(textureUnitState[i]); if (texUnitState.length>0) // TODO - remove if, workaround for bug in daily app.setTextureUnitState( texUnitState ); app.setTransparencyAttributes( (TransparencyAttributes)control.getSymbolTable().getJ3dNode(transparencyAttributes) ); super.buildGraph(); // Must be last call in method }