la.setPolygonMode(PolygonAttributes.POLYGON_FILL); la.setCullFace(PolygonAttributes.CULL_NONE); app.setPolygonAttributes(la); Material matt=new Material(); matt.setAmbientColor(new Color3f(1,1,1));
app.setRenderingAttributes(ra); app.setMaterial(mat); app.setPolygonAttributes(pa); sh.setGeometry(lsa); sh.setAppearance(app);
app.setRenderingAttributes(ra); app.setMaterial(mat); app.setPolygonAttributes(pa); sh.setAppearance(app); sh.setPickable(true);
// Because we're about to spin this triangle, be sure to draw // backfaces. If we don't, the back side of the triangle is invisible. Appearance ap = new Appearance(); PolygonAttributes pa = new PolygonAttributes(); pa.setCullFace(PolygonAttributes.CULL_NONE); ap.setPolygonAttributes(pa); shape.setAppearance(ap);
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; }
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; }
/** * Returns the Appearance object for the specified direction and index. This * is composed of the shared Appearance attributes plus the individual * textures. * * @param direction * @param index * @return */ public Appearance getAppearance(final int direction, final int index) { final Appearance a = new Appearance(); a.setCapability(Appearance.ALLOW_TEXTURE_UNIT_STATE_WRITE); a.setCapability(Appearance.ALLOW_TEXTURE_WRITE); a.setCapability(Appearance.ALLOW_TEXGEN_WRITE); a.setMaterial(material); a.setTransparencyAttributes(transAttr); a.setPolygonAttributes(polyAttr); a.setColoringAttributes(colAttr); a.setRenderingAttributes(rendAttr); final TextureUnitState[] tus = new TextureUnitState[2]; tus[0] = new TextureUnitState(getTexture(direction, index, volume), texAttr, getTg(direction)); tus[0].setCapability(TextureUnitState.ALLOW_STATE_WRITE); tus[1] = null; a.setTextureUnitState(tus); return a; }
polyAttrib.setCullFace(PolygonAttributes.CULL_NONE); polyAttrib.setBackFaceNormalFlip(true); app.setPolygonAttributes(polyAttrib);
pa.setCullFace(PolygonAttributes.CULL_NONE); pa.setBackFaceNormalFlip(true); textAppear.setPolygonAttributes(pa);
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; }
polyAttrib.setCullFace(PolygonAttributes.CULL_NONE); polyAttrib.setBackFaceNormalFlip(true); appearance.setPolygonAttributes(polyAttrib);
polyAttrib.setCullFace(PolygonAttributes.CULL_NONE); polyAttrib.setBackFaceNormalFlip(true); appearance.setPolygonAttributes(polyAttrib);
pattr.setCullFace(PolygonAttributes.CULL_NONE); pattr.setBackFaceNormalFlip(true); app.setPolygonAttributes(pattr); BranchGroup bg = new BranchGroup(); bg.setCapability(BranchGroup.ALLOW_DETACH);
pa.setPolygonMode(PolygonAttributes.POLYGON_LINE); pa.setCullFace(PolygonAttributes.CULL_NONE); appearance.setPolygonAttributes(pa); ta = new TransparencyAttributes(); ta.setTransparency(transparency);
@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 }
appearance.setPolygonAttributes(polyAttr);
polyAttrib.setCullFace(PolygonAttributes.CULL_BACK); polyAttrib.setBackFaceNormalFlip(false); appearance.setPolygonAttributes(polyAttrib);
appearance.setPolygonAttributes(polyAttr);