branchgroup.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
branchgroup.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
// TODO use light factories
AmbientLight alight = new AmbientLight(true,new Color3f(0.5f,0.5f,0.5f));
alight.setEnable(true);
rootGroup.addChild(alight);
BoundingSphere bounds = new BoundingSphere (new Point3d (0, 0.0, 0), 1E100);
alight.setInfluencingBounds(bounds);
lights = new DirectionalLight[1];
for (int i=0; i<lights.length; ++i) {
// TODO : position lights around the object
lights[i] = new DirectionalLight(true,new Color3f(1.0f,1.0f,1.0f),new Vector3f(-1,-1,-1));
lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_READ);
lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_WRITE);
lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_READ);
lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_WRITE);
lights[i].setEnable(true);