/** * Returns a wired appearance without lighting and anti-aliasing. * * @param color the color of the appearance * @param lineWidth the width of the lines (wires) * @return the appearance */ public Appearance getLinedAppearanceWithoutLighting(Color color, Float lineWidth) { Appearance a = new Appearance(); PolygonAttributes pa = new PolygonAttributes(); pa.setPolygonMode(PolygonAttributes.POLYGON_LINE); pa.setCullFace(PolygonAttributes.CULL_NONE); pa.setBackFaceNormalFlip(true); a.setPolygonAttributes(pa); LineAttributes la = new LineAttributes(); la.setLineAntialiasingEnable(false); la.setLineWidth(lineWidth); a.setLineAttributes(la); float r = color.getRed() / 255.f; float g = color.getGreen() / 255.f; float b = color.getBlue() / 255.f; ColoringAttributes ca = new ColoringAttributes(r, g, b, ColoringAttributes.SHADE_FLAT); a.setColoringAttributes(ca); return a; }
private void setColor (Appearance ap, Color c) { Material m = ap.getMaterial(); m.setAmbientColor(new Color3f(c)); m.setDiffuseColor(new Color3f(c)); float alpha = ((float)c.getAlpha()) / 255; if (alpha < 1.0) { TransparencyAttributes t = new TransparencyAttributes(); t.setTransparencyMode(TransparencyAttributes.BLENDED); t.setTransparency(1 - alpha); ap.setTransparencyAttributes(t); } else ap.setTransparencyAttributes(null); } }
private static Appearance createBlankAppearance () { Appearance ap = new Appearance(); ap.setCapability(Appearance.ALLOW_MATERIAL_READ); ap.setCapability(Appearance.ALLOW_MATERIAL_WRITE); ap.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ); ap.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE); return ap; }
_appear.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_READ); _appear.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_WRITE); _appear.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ); _appear.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE); _appear.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ); _appear.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE); _appear.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_READ); _appear.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_WRITE); _appear.setCapability(Appearance.ALLOW_TEXTURE_UNIT_STATE_READ); _appear.setCapability(Appearance.ALLOW_TEXTURE_UNIT_STATE_WRITE); _appear.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ); _appear.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE); _appear.setCapability(Appearance.ALLOW_MATERIAL_READ); _appear.setCapability(Appearance.ALLOW_MATERIAL_WRITE); _appear.setCapability(Appearance.ALLOW_TEXTURE_READ); _appear.setCapability(Appearance.ALLOW_TEXTURE_WRITE); _appear.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_READ); _appear.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_WRITE); final TextureAttributes att = _appear.getTextureAttributes(); if (att != null) { att.setCapability(TextureAttributes.ALLOW_MODE_READ);
if (!fill) pa.setPolygonMode(PolygonAttributes.POLYGON_LINE); pa.setCullFace(PolygonAttributes.CULL_NONE); ap.setPolygonAttributes(pa); texAttr.setTextureMode(TextureAttributes.REPLACE); ap.setTexture(texture); ap.setTextureAttributes(texAttr); material.setCapability(Material.ALLOW_COMPONENT_WRITE); material.setLightingEnable(true); ap.setMaterial(material); t.setTransparencyMode(TransparencyAttributes.BLENDED); t.setTransparency(1 - alpha); ap.setTransparencyAttributes(t); ca.setColor(col); ap.setLineAttributes(la); ap.setPointAttributes(poa); ap.setColoringAttributes(ca);
texa.setTextureMode(TextureAttributes.REPLACE); texa.setPerspectiveCorrectionMode(TextureAttributes.NICEST); final Appearance appear = new Appearance(); appear.setColoringAttributes(ca); appear.setTransparencyAttributes(ta); appear.setPointAttributes(pointa); appear.setLineAttributes(la); appear.setPolygonAttributes(pa); appear.setMaterial(m); appear.setTextureAttributes(texa); updateDefaultCapabilities(appear);
private static Appearance createCustomAppearance (boolean fill) { Appearance ap = createBlankAppearance(); PolygonAttributes pa = new PolygonAttributes(); if (!fill) pa.setPolygonMode(PolygonAttributes.POLYGON_LINE); pa.setCullFace(PolygonAttributes.CULL_NONE); LineAttributes la = new LineAttributes(); la.setLineWidth(penRadius); la.setLineAntialiasingEnable(view.getSceneAntialiasingEnable()); PointAttributes poa = new PointAttributes(); poa.setPointAntialiasingEnable(view.getSceneAntialiasingEnable()); ap.setPolygonAttributes(pa); ap.setLineAttributes(la); ap.setPointAttributes(poa); Color3f col = new Color3f(penColor); Color3f black = new Color3f(0, 0, 0); Color3f specular = new Color3f(GRAY); // Material properties Material material = new Material(col, black, col, specular, 64); material.setCapability(Material.ALLOW_COMPONENT_READ); material.setCapability(Material.ALLOW_COMPONENT_WRITE); material.setLightingEnable(true); ap.setMaterial(material); return ap; }
Appearance a = new Appearance(); PolygonAttributes pa = new PolygonAttributes(); pa.setPolygonMode(PolygonAttributes.POLYGON_POINT); pa.setCullFace(PolygonAttributes.CULL_NONE); pa.setBackFaceNormalFlip(true); a.setPolygonAttributes(pa); pointAttribute.setPointSize(pointSize); a.setPointAttributes(pointAttribute); a.setMaterial(mat);
Appearance appearance = new Appearance(); pa.setPolygonOffset(polygonOffset); pa.setPolygonOffsetFactor(polygonOffset); appearance.setPolygonAttributes(pa); ta.setTransparencyMode(TransparencyAttributes.BLEND_ZERO); ta.setTransparency(1.f - a); appearance.setTransparencyAttributes(ta); appearance.setMaterial(mat);
final ColoringAttributes ca = new ColoringAttributes(); ca.setColor(new Color3f(1f, 0f, 0f)); final Appearance ap = new Appearance(); ap.setPolygonAttributes(pa); ap.setColoringAttributes(ca); updateDefaultCapabilities(ap);
pa.setCullFace(PolygonAttributes.CULL_NONE); pa.setBackFaceNormalFlip(true); final Appearance ap = new Appearance(); ap.setPolygonAttributes(pa);
Appearance look = new Appearance(); Color3f objColor = new Color3f(0.7f, 0.7f, 0.7f); Color3f black = new Color3f(0.f, 0.f, 0.f); look.setMaterial(new Material(objColor, black, objColor, white, 100.0f)); Appearance blackLook = new Appearance(); blackLook.setMaterial(blackMaterial); Appearance whiteLook = new Appearance(); whiteLook.setMaterial(whiteMaterial); Appearance grayLook = new Appearance(); grayLook.setMaterial(grayMaterial); grayLook.setCapability(Appearance.ALLOW_MATERIAL_READ); grayLook.setCapability(Appearance.ALLOW_MATERIAL_WRITE); final Appearance redLook = new Appearance(); redLook.setMaterial(redMaterial); Appearance objLook = new Appearance(); objLook.setMaterial(objMaterial); grayLook = objLook; final Appearance yellowLook = new Appearance(); yellowLook.setMaterial(yellowMaterial); Bounds bounds = new BoundingSphere(new Point3d(),
la.setLineWidth(2f); la.setLinePattern(LineAttributes.PATTERN_SOLID); final Appearance ap = new Appearance(); ap.setPolygonAttributes(pa); ap.setLineAttributes(la); final Point3d low = new Point3d(); final Point3d up = new Point3d();
yellow, yellow, 100.0f); final Appearance lightGrayLook = new Appearance(); lightGrayLook.setMaterial(lightGrayMaterial); Appearance blackLook = new Appearance(); blackLook.setMaterial(blackMaterial); Appearance whiteLook = new Appearance(); whiteLook.setMaterial(whiteMaterial); Appearance grayLook = new Appearance(); grayLook.setMaterial(grayMaterial); final Appearance redLook = new Appearance(); redLook.setMaterial(redMaterial); final Appearance yellowLook = new Appearance(); yellowLook.setMaterial(yellowMaterial);
else { Appearance ap = shape.getAppearance(); PolygonAttributes pa = ap.getPolygonAttributes(); if (pa == null) pa = new PolygonAttributes(); pa.setCullFace(PolygonAttributes.CULL_NONE); ap.setPolygonAttributes(pa);
/** * mode ombr ou pas. */ public void setEclairage(final boolean _valeur) { shape_.getAppearance().getMaterial().setLightingEnable(_valeur); }
public void detach() { super.detach(); bbox_.setLower(null); bbox_.setUpper(null); shape_.getAppearance().setMaterial(null); shape_.setAppearance(null); shape_.removeAllGeometries(); switch_.removeAllChildren(); }
/** * affiche l'objet en fil de fer. */ public void setFilaire(final boolean _filaire) { if (_filaire) { shape_.getAppearance().getPolygonAttributes().setPolygonMode(PolygonAttributes.POLYGON_LINE); } else { shape_.getAppearance().getPolygonAttributes().setPolygonMode(PolygonAttributes.POLYGON_FILL); } }
if (!fill) pa.setPolygonMode(PolygonAttributes.POLYGON_LINE); pa.setCullFace(PolygonAttributes.CULL_NONE); ap.setPolygonAttributes(pa); texAttr.setTextureMode(TextureAttributes.REPLACE); ap.setTexture(texture); ap.setTextureAttributes(texAttr); material.setCapability(Material.ALLOW_COMPONENT_WRITE); material.setLightingEnable(true); ap.setMaterial(material); t.setTransparencyMode(TransparencyAttributes.BLENDED); t.setTransparency(1 - alpha); ap.setTransparencyAttributes(t); ca.setColor(col); ap.setLineAttributes(la); ap.setPointAttributes(poa); ap.setColoringAttributes(ca);
private static Appearance createCustomAppearance (boolean fill) { Appearance ap = createBlankAppearance(); PolygonAttributes pa = new PolygonAttributes(); if (!fill) pa.setPolygonMode(PolygonAttributes.POLYGON_LINE); pa.setCullFace(PolygonAttributes.CULL_NONE); LineAttributes la = new LineAttributes(); la.setLineWidth(penRadius); la.setLineAntialiasingEnable(view.getSceneAntialiasingEnable()); PointAttributes poa = new PointAttributes(); poa.setPointAntialiasingEnable(view.getSceneAntialiasingEnable()); ap.setPolygonAttributes(pa); ap.setLineAttributes(la); ap.setPointAttributes(poa); Color3f col = new Color3f(penColor); Color3f black = new Color3f(0, 0, 0); Color3f specular = new Color3f(GRAY); // Material properties Material material = new Material(col, black, col, specular, 64); material.setCapability(Material.ALLOW_COMPONENT_READ); material.setCapability(Material.ALLOW_COMPONENT_WRITE); material.setLightingEnable(true); ap.setMaterial(material); return ap; }