RenderingAttributes ra=new RenderingAttributes(); ra.setIgnoreVertexColors(true); app.setRenderingAttributes(ra); Shape3D plShape = new Shape3D(pla, app);
ca.setColor(new Color3f(0.2f,0.5f,0.9f)); app.setColoringAttributes(ca); app.setRenderingAttributes(ra); app.setMaterial(mat); app.setPolygonAttributes(pa);
ca.setColor(new Color3f(0.2f,0.5f,0.9f)); app.setColoringAttributes(ca); app.setRenderingAttributes(ra); app.setMaterial(mat); app.setPolygonAttributes(pa);
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; }
renderingAtts.setAlphaTestFunction( RenderingAttributes.GREATER_OR_EQUAL ); renderingAtts.setAlphaTestValue( 0.3f ); appearance.setRenderingAttributes( renderingAtts );
renderingAtts.setAlphaTestFunction( RenderingAttributes.GREATER_OR_EQUAL ); renderingAtts.setAlphaTestValue( 0.3f ); appearance.setRenderingAttributes( renderingAtts );
/** * 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; }
/** * @see PointList.PointListListener#renamed(BenesNamedPoint) */ @Override public void renamed(final BenesNamedPoint p) { final int i = points.indexOf(p); getChild(i).setName(points.get(i).getName()); Group bg = (Group) getChild(i); bg = (Group) bg.getChild(0); bg = (Group) bg.getChild(2); final OrientedShape3D os = (OrientedShape3D) bg.getChild(0); final Text2D t2d = new Text2D(p.getName(), color, "Helvetica", 24, Font.PLAIN); t2d.setRectangleScaleFactor(0.03f); final Geometry g = t2d.getGeometry(); final Appearance a = t2d.getAppearance(); final RenderingAttributes ra = new RenderingAttributes(); ra.setDepthTestFunction(RenderingAttributes.ALWAYS); a.setRenderingAttributes(ra); g.setCapability(Geometry.ALLOW_INTERSECT); os.setGeometry(g); os.setAppearance(a); }
final RenderingAttributes ra = new RenderingAttributes(); ra.setDepthTestFunction(RenderingAttributes.ALWAYS); a.setRenderingAttributes(ra); g.setCapability(Geometry.ALLOW_INTERSECT); os.setGeometry(g);
private void addText(final Group bg, final String s, final Point3f pos, final Color3f c) { final Transform3D translation = new Transform3D(); translation.setTranslation(new Vector3f(-radius, -radius, 0)); final TransformGroup tg = new TransformGroup(translation); final Text2D t2d = new Text2D(s, c, "Helvetica", 24, Font.PLAIN); t2d.setRectangleScaleFactor(0.03f); final Geometry g = t2d.getGeometry(); final Appearance a = t2d.getAppearance(); final RenderingAttributes ra = new RenderingAttributes(); ra.setDepthTestFunction(RenderingAttributes.ALWAYS); a.setRenderingAttributes(ra); g.setCapability(Geometry.ALLOW_INTERSECT); final OrientedShape3D textShape = new OrientedShape3D(); textShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE); textShape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE); textShape.setAlignmentMode(OrientedShape3D.ROTATE_ABOUT_POINT); textShape.setAlignmentAxis(0.0f, 1.0f, 0.0f); textShape.setRotationPoint(new Point3f()); textShape.setConstantScaleEnable(true); textShape.setGeometry(g); textShape.setAppearance(a); tg.setCapability(ENABLE_PICK_REPORTING); tg.setPickable(true); tg.addChild(textShape); bg.addChild(tg); }
@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 }
rendAttr.setAlphaTestValue(0.1f); rendAttr.setAlphaTestFunction(RenderingAttributes.GREATER); appearance.setRenderingAttributes(rendAttr);
rendAttr.setAlphaTestValue(0.1f); rendAttr.setAlphaTestFunction(RenderingAttributes.GREATER); appearance.setRenderingAttributes(rendAttr);