public void setIntensite(final double _intensite) { intensite_ = _intensite; float red, green, blue; red = (float) (couleur_.getRed() * intensite_ / 255); green = (float) (couleur_.getGreen() * intensite_ / 255); blue = (float) (couleur_.getBlue() * intensite_ / 255); try { l_.setColor(new Color3f(red, green, blue)); } catch (final Exception ex) {} }
public void setCouleur(final Color _couleur) { couleur_ = _couleur; l_.setColor(new Color3f(couleur_)); }
/** * Adds a directional light of color col which shines in the direction vector (x, y, z) */ public static Light directionalLight (double x, double y, double z, Color col) { DirectionalLight light = new DirectionalLight(); light.setColor(new Color3f(col)); light.setInfluencingBounds(INFINITE_BOUNDS); light.setCapability(DirectionalLight.ALLOW_STATE_WRITE); light.setCapability(DirectionalLight.ALLOW_COLOR_WRITE); light.setEnable(true); BranchGroup bg = createBranchGroup(); TransformGroup tg = createTransformGroup(); tg.addChild(light); bg.addChild(tg); lightGroup.addChild(bg); Light l = new Light(bg, tg, light); l.setDirection(new Vector3D(x, y, z)); return l; }
/** * Adds a directional light of color col which shines in the direction vector (x, y, z) */ public static Light directionalLight (double x, double y, double z, Color col) { DirectionalLight light = new DirectionalLight(); light.setColor(new Color3f(col)); light.setInfluencingBounds(INFINITE_BOUNDS); light.setCapability(DirectionalLight.ALLOW_STATE_WRITE); light.setCapability(DirectionalLight.ALLOW_COLOR_WRITE); light.setEnable(true); BranchGroup bg = createBranchGroup(); TransformGroup tg = createTransformGroup(); tg.addChild(light); bg.addChild(tg); lightGroup.addChild(bg); Light l = new Light(bg, tg, light); l.setDirection(new Vector3D(x, y, z)); return l; }