public void setGraphics(EGraphics graphics) { EGraphics.J3DTransparencyOption op = graphics.getTransparencyMode(); TransparencyAttributes ta = getTransparencyAttributes(); ta.setTransparency((float) graphics.getTransparencyFactor()); ta.setTransparencyMode(op.mode); setTransparencyAndRenderingAttributes(ta, op != EGraphics.J3DTransparencyOption.NONE); set3DColor(null, graphics.getColor()); }
/** * Sets the appearance. * * @param shape the new appearance */ private void setAppearance(Shape3D shape) { Appearance sphereApp = new Appearance(); TransparencyAttributes sphereTrans = new TransparencyAttributes(); PolygonAttributes spherePa = new PolygonAttributes(); spherePa.setCullFace(PolygonAttributes.CULL_NONE); sphereApp.setPolygonAttributes(spherePa); sphereTrans.setTransparency(0.6f); sphereTrans.setTransparencyMode(TransparencyAttributes.NICEST); sphereApp.setTransparencyAttributes(sphereTrans); shape.setAppearance(sphereApp); }
private Appearance makeMaterial(float r, float g, float b, float transparency) { Appearance appearance = new Appearance(); Color3f color3f = new Color3f(r, g, b); Material material = new Material(color3f, new Color3f(0f, 0f, 0f), color3f, color3f, 10f); material.setLightingEnable(true); appearance.setMaterial(material); if (!Float.isNaN(transparency)) { TransparencyAttributes ta = new TransparencyAttributes(); ta.setTransparencyMode(TransparencyAttributes.NICEST); ta.setTransparency(transparency); appearance.setTransparencyAttributes(ta); } return appearance; }
private void createGameField() { // Marker #0: game field Appearance app = new BlueAppearance(); TransparencyAttributes ta = new TransparencyAttributes(); ta.setTransparency(0.5f); ta.setTransparencyMode(TransparencyAttributes.BLENDED); app.setTransparencyAttributes(ta); pathObject = new PathObject(app); pathObject.getTransformGroup().addChild(GameController.getInstance().particleGroup); GameController.getInstance().pathObject = pathObject; EnemySpawnController eSpawn = EnemySpawnController.getInstance(); pathObject.addChild(eSpawn); this.markerObjects[0].getTransformGroup().addChild(pathObject); this.markerObjects[0].getTransformGroup().addChild(GameController.getInstance()); }
@Override protected Appearance createAppearance() { Appearance appearance = new Appearance(); appearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ); appearance.setCapability(Appearance.ALLOW_LINE_ATTRIBUTES_READ); LineAttributes lineAttrib = new LineAttributes(); lineAttrib.setCapability(LineAttributes.ALLOW_ANTIALIASING_WRITE); lineAttrib.setCapability(LineAttributes.ALLOW_PATTERN_WRITE); lineAttrib.setCapability(LineAttributes.ALLOW_WIDTH_WRITE); lineAttrib.setLineWidth(linewidth); lineAttrib.setLinePattern(pattern); appearance.setLineAttributes(lineAttrib); PolygonAttributes polyAttrib = new PolygonAttributes(); polyAttrib.setCapability(PolygonAttributes.ALLOW_MODE_WRITE); polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_FILL); polyAttrib.setCullFace(PolygonAttributes.CULL_NONE); polyAttrib.setBackFaceNormalFlip(true); appearance.setPolygonAttributes(polyAttrib); ColoringAttributes colorAttrib = new ColoringAttributes(); colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD); colorAttrib.setColor(color); appearance.setColoringAttributes(colorAttrib); TransparencyAttributes tr = new TransparencyAttributes(); int mode = transparency == 0f ? TransparencyAttributes.NONE : TransparencyAttributes.FASTEST; tr.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE); tr.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE); tr.setTransparencyMode(mode); tr.setTransparency(transparency); appearance.setTransparencyAttributes(tr); 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 protected Appearance createAppearance() { final Appearance appearance = new Appearance(); appearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ); appearance.setCapability(Appearance.ALLOW_LINE_ATTRIBUTES_READ); final PointAttributes pointAttrib = new PointAttributes(); pointAttrib.setCapability(PointAttributes.ALLOW_ANTIALIASING_WRITE); pointAttrib.setCapability(PointAttributes.ALLOW_SIZE_WRITE); pointAttrib.setPointSize(pointsize); appearance.setPointAttributes(pointAttrib); final PolygonAttributes polyAttrib = new PolygonAttributes(); polyAttrib.setCapability(PolygonAttributes.ALLOW_MODE_WRITE); polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_FILL); polyAttrib.setCullFace(PolygonAttributes.CULL_BACK); polyAttrib.setBackFaceNormalFlip(false); appearance.setPolygonAttributes(polyAttrib); final ColoringAttributes colorAttrib = new ColoringAttributes(); colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD); colorAttrib.setColor(color); appearance.setColoringAttributes(colorAttrib); final TransparencyAttributes tr = new TransparencyAttributes(); final int mode = transparency == 0f ? TransparencyAttributes.NONE : 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; }