// and add it into the scene graph.
Material m = new Material(objColor, eColor, objColor, sColor, 100.0f);
Appearance a = new Appearance();
m.setLightingEnable(true);
a.setMaterial(m);
Sphere sph = new Sphere(1.0f, Sphere.GENERATE_NORMALS, 180, a);
/*#
* add the main cernter sphere
*/
objScale.addChild(sph);
// Create the transform group node for the each light and initialize
// it to the identity. Enable the TRANSFORM_WRITE capability so that
// our behavior code can modify it at runtime. Add them to the root
// of the subgraph.
Transform3D r = new Transform3D();
TransformGroup l1RotTrans = new TransformGroup();
l1RotTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objScale.addChild(l1RotTrans);
TransformGroup l2RotTrans = new TransformGroup();
l2RotTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objScale.addChild(l2RotTrans);
Vector3d Pos1 = new Vector3d(1.3, 1.3, 1.3);
r.set(Pos1);
TransformGroup errans = new TransformGroup(r);
errans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objScale.addChild(errans);
// Create transformations for the positional lights
t = new Transform3D();
/*#
* set the position of the 2 other spheres
*/
Vector3d lPos1 = new Vector3d(1.7,1.6, 1.5);
t.set(lPos1);
TransformGroup l1Trans = new TransformGroup(t);
l1RotTrans.addChild(l1Trans);
Vector3d lPos2 = new Vector3d(0, 0, 0);
t.set(lPos2);
TransformGroup l2Trans = new TransformGroup(t);
l2RotTrans.addChild(l2Trans);
Vector3d lPos3 = new Vector3d(1.3, 1.3, 1.3);
t.set(lPos3);
TransformGroup l3Trans = new TransformGroup(t);
errans.addChild(l2Trans);
errans.addChild(l3Trans);
// Create Geometry for point lights
ColoringAttributes caL1 = new ColoringAttributes();
ColoringAttributes caL2 = new ColoringAttributes();
ColoringAttributes caL3 = new ColoringAttributes();
caL1.setColor(lColor1);
caL2.setColor(lColor2);
caL3.setColor(lColor3);
Appearance appL1 = new Appearance();
Appearance appL2 = new Appearance();
Appearance appL3 = new Appearance();
appL1.setColoringAttributes(caL1);
appL2.setColoringAttributes(caL2);
appL3.setColoringAttributes(caL3);
l1Trans.addChild(new Sphere(0.05f, appL1));
l2Trans.addChild(new Sphere(0.05f, appL2));
l3Trans.addChild(new Sphere(0.05f, appL3));
// Create lights
AmbientLight aLgt = new AmbientLight(alColor);
Light lgt1 = null;
Light lgt2 = null;
Light lgt3 = null;