Java Reference
In-Depth Information
objRoot.addChild (pickingbehavior);
objRoot.compile();
return objRoot;
}
e.8 settInG up of lIGht sources
BranchGroup createBranchEnvironment()
{
// Create the root of the branch graph
BranchGroup branchRoot = new BranchGroup();
// Set up the background
Color3f bgColor = new Color3f(0.05f, 0.05f, 0.5f);
Background bgNode = new Background(bgColor);
bgNode.setApplicationBounds(bounds);
branchRoot.addChild(bgNode);
// Set up the ambient light
Color3f ambientColor = new Color3f(0.55f, 0.55f, 0.55f);
AmbientLight ambientLightNode = new AmbientLight(ambientColor);
ambientLightNode.setInfluencingBounds(bounds);
branchRoot.addChild(ambientLightNode);
// Set up the directional lights
Color3f lightColor = new Color3f(0.65f, 0.65f, 0.65f);
Vector3f light1Direction = new Vector3f(0.0f, -1.0f, -1.0f);
Vector3f light2Direction = new Vector3f(0.0f, -1.0f, 1.0f);
DirectionalLight light1
= new DirectionalLight(lightColor, light1Direction);
light1.setInfluencingBounds(bounds);
branchRoot.addChild(light1);
DirectionalLight light2
= new DirectionalLight(lightColor, light2Direction);
light2.setInfluencingBounds(bounds);
boolean lighton = true;
Color3f spotlightColor = new Color3f(0.8f, 0.8f, 0.75f);
Point3f attenuation = new Point3f(1.0f,0.0f,0.0f);
Vector3f lightDirection = new Vector3f(0.0f, -1.0f, 0.0f);
float spreadangle = 90.0f*ANGLEPAI;
float concentration = 0.0f;
SpotLight spotlight;
Point3f position = new Point3f(0.0f, 4.0f, -3.0f);
Search WWH ::




Custom Search