Class DirectionalLight


  • public class DirectionalLight
    extends Light
    A DirectionalLight node defines an oriented light with an origin at infinity. It has the same attributes as a Light node, with the addition of a directional vector to specify the direction in which the light shines. A directional light has parallel light rays that travel in one direction along the specified vector. Directional light contributes to diffuse and specular reflections, which in turn depend on the orientation of an object's surface but not its position. A directional light does not contribute to ambient reflections.
    • Field Detail

      • ALLOW_DIRECTION_READ

        public static final int ALLOW_DIRECTION_READ
        Specifies that the Node allows access to its object's direction information.
        See Also:
        Constant Field Values
      • ALLOW_DIRECTION_WRITE

        public static final int ALLOW_DIRECTION_WRITE
        Specifies that the Node allows writing to its object's direction information.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DirectionalLight

        public DirectionalLight()
        Constructs a DirectionalLight node with default parameters. The default values are as follows:
          direction : (0,0,-1)
      • DirectionalLight

        public DirectionalLight​(javax.vecmath.Color3f color,
                                javax.vecmath.Vector3f direction)
        Constructs and initializes a directional light.
        Parameters:
        color - the color of the light source
        direction - the direction vector pointing from the light to the object
      • DirectionalLight

        public DirectionalLight​(boolean lightOn,
                                javax.vecmath.Color3f color,
                                javax.vecmath.Vector3f direction)
        Constructs and initializes a directional light.
        Parameters:
        lightOn - flag indicating whether this light is on or off
        color - the color of the light source
        direction - the direction vector pointing from the light to the object
    • Method Detail

      • setDirection

        public void setDirection​(javax.vecmath.Vector3f direction)
        Set light direction.
        Parameters:
        direction - the new direction
        Throws:
        CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
      • setDirection

        public void setDirection​(float x,
                                 float y,
                                 float z)
        Set light direction.
        Parameters:
        x - the new X direction
        y - the new Y direction
        z - the new Z direction
        Throws:
        CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
      • getDirection

        public void getDirection​(javax.vecmath.Vector3f direction)
        Gets this Light's current direction and places it in the parameter specified.
        Parameters:
        direction - the vector that will receive this node's direction
        Throws:
        CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph