TransformGroup tg2 = new TransformGroup (); //set the appearance of the product boxes (transparent) Appearance app = new Appearance(); app.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.BLENDED,0.2f)); //create a box having length = l, breadth = b and height = h Box box = new Box( (float )item[p].getLength(), (float) item[p].getBreadth(), (float) item[p].getHeight(), app); // vector to translate the item box to the position (x, y, z) Vector3f position = new Vector3f((float) x, (float) y, (float) z); //creation of a 3D transform group Transform3D transform = new Transform3D(); transform.setTranslation(position); tg2.setTransform(transform); //add new item box to the transform group tg2.addChild(box); tg2.setCapability(Group.ALLOW_CHILDREN_EXTEND); BranchGroup scene = new BranchGroup(); scene.addChild(tg2); scene1.addChild(scene);
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; }
appearance.setLineAttributes( lineAtts ); final TransparencyAttributes transAtts = new TransparencyAttributes( TransparencyAttributes.BLENDED, 0.2f ); appearance.setTransparencyAttributes( transAtts ); final RenderingAttributes renderingAtts = new RenderingAttributes(); renderingAtts.setAlphaTestFunction( RenderingAttributes.GREATER_OR_EQUAL );
appearance.setLineAttributes( lineAtts ); final TransparencyAttributes transAtts = new TransparencyAttributes( TransparencyAttributes.BLENDED, 0.2f ); appearance.setTransparencyAttributes( transAtts ); final RenderingAttributes renderingAtts = new RenderingAttributes(); renderingAtts.setAlphaTestFunction( RenderingAttributes.GREATER_OR_EQUAL );
a.setTransparencyAttributes( new TransparencyAttributes(TransparencyAttributes.NICEST, p.transparencyLevel));
/** * Creates Appearance for this Shape3D. This sets transparency * for the object (we want the text to be "floating" in space, * so only the text itself should be non-transparent. Also, the * appearance disables lighting for the object; the text will * simply be colored, not lit. */ private Appearance setupAppearance(Texture2D t2d) { Appearance appearance = getAppearance(); if (appearance == null) { TransparencyAttributes transp = new TransparencyAttributes(); transp.setTransparencyMode(TransparencyAttributes.BLENDED); transp.setTransparency(0f); appearance = new Appearance(); appearance.setTransparencyAttributes(transp); appearance.setTexture(t2d); Material m = new Material(); m.setLightingEnable(false); appearance.setMaterial(m); appearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE); appearance.setCapability(Appearance.ALLOW_TEXTURE_READ); appearance.setCapabilityIsFrequent(Appearance.ALLOW_TEXTURE_READ); }else{ appearance.setTexture(t2d); } return appearance; }
/** * 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; }
tr.setTransparencyMode(mode); tr.setTransparency(transparency); app.setTransparencyAttributes(tr);
ta.setTransparency(surf.getTransparency()); ta.setTransparencyMode(ta.BLENDED); appearance.setTransparencyAttributes(ta);
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; }
tr.setTransparencyMode(mode); tr.setTransparency(transparency); appearance.setTransparencyAttributes(tr);
tr.setTransparencyMode(mode); tr.setTransparency(transparency); appearance.setTransparencyAttributes(tr);
ta.setTransparency(transparency); ta.setTransparencyMode(TransparencyAttributes.FASTEST); appearance.setTransparencyAttributes(ta); ca = new ColoringAttributes(); ca.setColor(color);
@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 }
transAttr.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE); transAttr.setTransparencyMode(TransparencyAttributes.BLENDED); appearance.setTransparencyAttributes(transAttr);
transAttr.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE); transAttr.setTransparencyMode(TransparencyAttributes.BLENDED); appearance.setTransparencyAttributes(transAttr);
tr.setTransparencyMode(mode); tr.setTransparency(transparency); appearance.setTransparencyAttributes(tr);
tr.setTransparencyMode(mode); tr.setTransparency(transparency); appearance.setTransparencyAttributes(tr);
(TransparencyAttributes.ALLOW_BLEND_FUNCTION_WRITE) ; a.setTransparencyAttributes(ta) ; a.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ) ; a.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE) ;
(TransparencyAttributes.ALLOW_BLEND_FUNCTION_WRITE) ; a.setTransparencyAttributes(tra) ; a.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ) ; a.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE) ;