375

Lighting the environment
SpotLight Example Code


TransformGroup group = new TransformGroup( );
. . .
SpotLight light = new SpotLight( );
light.setEnable( true );
light.setColor( new Color3f( 1.0f, 1.0f, 1.0f ) );
light.setPosition( new Point3f( 0.0f, 1.0f, 0.0f ) );
light.setAttenuation( new Point3f( 1.0f, 0.0f, 0.0f ) );
light.setDirection( new Vector3f( 1.0f, 0.0f, 0.0f ) );
light.setSpreadAngle( 0.785f );  // 45 degrees
light.setConcentration( 0.0f );  // Unfocused
. . .
light.setInfluencingBounds( bounds );
group.addChild( light );