Material mat = new Material(); float b = color.getBlue() / 255.f; mat.setDiffuseColor(r, g, b); mat.setSpecularColor(1.f, 1.f, 1.f); mat.setShininess(20.f); mat.setColorTarget(vertexColoringType); mat.setLightingEnable(true); a.setMaterial(mat);
/** * recupere la brillance de l'objet. */ public float getBrillance() { return shape_.getAppearance().getMaterial().getShininess(); }
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 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; }
pa.setCullFace(PolygonAttributes.CULL_NONE); pa.setBackFaceNormalFlip(true); final Material m = new Material(); m.setCapability(Material.ALLOW_COMPONENT_READ); m.setCapability(Material.ALLOW_COMPONENT_WRITE); m.setShininess(2); m.setLightingEnable(false); final TextureAttributes texa = new TextureAttributes(); texa.setCapability(TextureAttributes.ALLOW_MODE_WRITE);
Color3f red = new Color3f(1, 0, 0); Color3f yellow = new Color3f(0,1,1); Material lightGrayMaterial = new Material(lightGray, black, lightGray, white, 100.0f); Material blackMaterial = new Material(lightGray, black, black, lightGray, 10.0f); Material whiteMaterial = new Material(white, white, white, white, 100.0f); Material grayMaterial = new Material(gray, black, gray, gray, 100.0f); Material redMaterial = new Material(red, black, red, red, 100.0f); Material yellowMaterial = new Material(yellow, black, yellow, yellow, 100.0f);
Material mat = app.getMaterial(); if ( mat != null ) { mat.getAmbientColor( ambient ); mat.getDiffuseColor( diffuse ); mat.getSpecularColor( specular ); mat.getEmissiveColor( emmisive ); shininess = mat.getShininess();
/** * mode ombr ou pas. */ public void setEclairage(final boolean _valeur) { shape_.getAppearance().getMaterial().setLightingEnable(_valeur); }
/** * modifie la brillance de l'objet. */ public void setBrillance(final double _b) { shape_.getAppearance().getMaterial().setShininess((float) _b); }
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; }
Color3f yellow = new Color3f(1,1,0); Material objMaterial = new Material(objColor, black, objColor, white, 100.0f); Material blackMaterial = new Material(objColor, black, black, objColor, 10.0f); Material whiteMaterial = new Material(white, white, white, white, 100.0f); Material grayMaterial = new Material(gray, black, gray, gray, 100.0f); Material redMaterial = new Material(red, black, red, red, 100.0f); Material yellowMaterial = new Material(yellow, black, yellow, yellow, 100); look.setMaterial(new Material(objColor, black, objColor, white, 100.0f)); Appearance blackLook = new Appearance();
/** * Returns a solid appearance. * @return the appearance */ private Appearance getColoredAppearance() { Appearance a = new Appearance(); PolygonAttributes pa = new PolygonAttributes(); pa.setCullFace(PolygonAttributes.CULL_NONE); // see both sides of shape pa.setPolygonMode(PolygonAttributes.POLYGON_FILL); pa.setBackFaceNormalFlip(true); a.setPolygonAttributes(pa); LineAttributes la = new LineAttributes(); la.setLineAntialiasingEnable(true); la.setLineWidth(1.f); a.setLineAttributes(la); Material mat = new Material(); mat.setSpecularColor(1.f, 1.f, 0.8f); mat.setDiffuseColor(1.f, 0.4f, 0.1f); mat.setShininess(20.f); mat.setLightingEnable(true); a.setMaterial(mat); return a; }
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);
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); } }
Material mat = new Material(); float b = color.getBlue() / 255.f; mat.setDiffuseColor(r, g, b); mat.setSpecularColor(1.f, 1.f, 1.f); mat.setShininess(20.f); mat.setLightingEnable(true); a.setMaterial(mat);
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);
Material mat = new Material(); float b = color.getBlue() / 255.f; mat.setDiffuseColor(r, g, b); mat.setSpecularColor(1.f, 1.f, 1.f); mat.setShininess(20.f); mat.setLightingEnable(true); a.setMaterial(mat);
Material mat = new Material(); mat.setSpecularColor(1.f, 1.f, 1.f); mat.setDiffuseColor(r, g, b); mat.setShininess(20.f); mat.setLightingEnable(true); mat.setColorTarget(vertexColoringType);
Material mat = new Material(); mat.setDiffuseColor(r, g, b); mat.setSpecularColor(1.f, 1.f, 1.f); mat.setShininess(20.f); mat.setColorTarget(vertexColoringType); mat.setLightingEnable(true); a.setMaterial(mat); } else {