259

Lighting the environment
SpotLight example code

  • Create a light
    SpotLight myLight = new SpotLight( );
    myLight.setEnable( true );
    myLight.setColor( new Color3f( 1.0f, 1.0f, 1.0f ) );
    myLight.setPosition( new Point3f( 0.0f, 1.0f, 0.0f ) );
    myLight.setAttenuation( new Point3f( 1.0f, 0.0f, 0.0f ) );
    myLight.setDirection( new Vector3f( 1.0f, 0.0f, 0.0f ) );
    myLight.setSpreadAngle( 0.785f ); // 45 degrees
    myLight.setConcentration( 3.0f ); // Unfocused

  • Set its influencing bounds
    BoundingSphere myBounds = new BoundingSphere(
        new Point3d( ), 1000.0 );
    myLight.setInfluencingBounds( myBounds );