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 Details

    • ALLOW_DIRECTION_READ

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

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

    • 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 Details

    • 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
    • cloneNode

      public Node cloneNode(boolean forceDuplicate)
      Used to create a new instance of the node. This routine is called by cloneTree to duplicate the current node.
      Overrides:
      cloneNode in class Node
      Parameters:
      forceDuplicate - when set to true, causes the duplicateOnCloneTree flag to be ignored. When false, the value of each node's duplicateOnCloneTree variable determines whether NodeComponent data is duplicated or copied.
      See Also: