Class DirectionalLight

java.lang.Object
  |
  +--Light
        |
        +--DirectionalLight

public class DirectionalLight
extends Light

DirectionalLight represents a light source that illuminates along parallel rays.


Field Summary
 Vector Direction
          Stores the direction the light travels in.
 
Fields inherited from class Light
Intensity
 
Constructor Summary
DirectionalLight()
          Create a default light.
DirectionalLight(Vector v)
          Create a new directional light that shines along given direction vector.
 
Method Summary
 void print(SceneWriter os)
          Print a human readable version of the light definition to the given destination
 void read(SceneReader is)
          Read the light from the given source.
 void write(SceneWriter os)
          Write the light to the given destination
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Direction

public Vector Direction
Stores the direction the light travels in.

Constructor Detail

DirectionalLight

public DirectionalLight()
Create a default light.


DirectionalLight

public DirectionalLight(Vector v)
Create a new directional light that shines along given direction vector.

Parameters:
v - the direction of the light rays
Method Detail

read

public void read(SceneReader is)
          throws java.io.IOException,
                 java.lang.NumberFormatException
Read the light from the given source.

Specified by:
read in class Light
Parameters:
is - the source to read from.
Throws:
java.io.IOException - if the light can not be read.
java.io.NumberFormatException - if there a number format error is encountered.
java.lang.NumberFormatException

write

public void write(SceneWriter os)
           throws java.io.IOException
Write the light to the given destination

Specified by:
write in class Light
Parameters:
os - The destination to write to
Throws:
java.io.IOException - if the write fails.

print

public void print(SceneWriter os)
           throws java.io.IOException
Print a human readable version of the light definition to the given destination

Specified by:
print in class Light
Parameters:
os - The destination to write to
Throws:
java.io.IOException - if the write fails.