net.sf.j3d.threeD.raytracer.shaders
Class ShaderParameters

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable
          extended by net.sf.j3d.threeD.raytracer.shaders.ShaderParameters
All Implemented Interfaces:
Serializable, Cloneable, Map

public class ShaderParameters
extends Hashtable

A ShaderParameters object stores parameters needed by most Shader implementations.

Author:
Mike Murray
See Also:
Serialized Form

Field Summary
 RGB fogColor
           
 double fogDensity
           
 double fogRatio
           
 
Constructor Summary
ShaderParameters(Vector point, Vector viewerDirection, Vector lightDirection, Light light, Light[] otherLights, Surface[] otherSurfaces)
           
ShaderParameters(Vector point, Vector viewerDirection, Vector lightDirection, Light light, Light[] otherLights, Surface surface, Surface[] otherSurfaces)
          Constructs a new ShaderParameters object using the specified arguments.
 
Method Summary
 void addEnterance()
          Adds one to the reflection count and the enterance count.
 void addExit()
          Adds one to the reflection count and the exit count.
 void addReflection()
          Adds one to the reflection count stored by this ShaderParameters object.
 Light[] getAllLights()
           
 int getEnteranceCount()
           
 int getExitCount()
           
 Light getLight()
           
 Vector getLightDirection()
           
 Light[] getOtherLights()
           
 Surface[] getOtherSurfaces()
           
 Vector getPoint()
           
 int getReflectionCount()
           
 Surface getSurface()
           
 Vector getViewerDirection()
           
 void setLight(Light l)
          Sets the Light to the specified Light object.
 void setLightDirection(Vector l)
          Sets the direction toward the light to the specified Vector object.
 void setOtherLights(Light[] l)
          Sets the other Lights to those stored in the specified array.
 void setOtherSurfaces(Surface[] s)
          Sets the other Surfaces to those stored in the specified array.
 void setPoint(Vector p)
          Sets the point to be shaded to the specified Vector object.
 void setSurface(Surface surface)
           
 void setViewerDirection(Vector v)
          Sets the direction toward the viewer to the specified Vector object.
 String toString()
           
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

fogColor

public RGB fogColor

fogRatio

public double fogRatio

fogDensity

public double fogDensity
Constructor Detail

ShaderParameters

public ShaderParameters(Vector point,
                        Vector viewerDirection,
                        Vector lightDirection,
                        Light light,
                        Light[] otherLights,
                        Surface surface,
                        Surface[] otherSurfaces)
Constructs a new ShaderParameters object using the specified arguments.

Parameters:
point - Vector object representing the point to be shaded.
viewerDirection - Vector object representing the direction toward the viewer (should be unit length).
lightDirection - Vector object representing the direction toward the light (should be unit length).
light - Light object representing the light.
otherLights - Array of Light objects representing other lights in the scene.
surface - Surface object to be shaded.
otherSurfaces - Array of other Surface objects in the scene.

ShaderParameters

public ShaderParameters(Vector point,
                        Vector viewerDirection,
                        Vector lightDirection,
                        Light light,
                        Light[] otherLights,
                        Surface[] otherSurfaces)
Method Detail

setPoint

public void setPoint(Vector p)
Sets the point to be shaded to the specified Vector object.

Parameters:
p - Vector object to use.

getPoint

public Vector getPoint()
Returns:
A Vector object representing the point to be shaded.

setViewerDirection

public void setViewerDirection(Vector v)
Sets the direction toward the viewer to the specified Vector object.

Parameters:
v - Vector object to use.

getViewerDirection

public Vector getViewerDirection()
Returns:
A Vector object representing the direction toward the viewer (this can be expected to be unit length).

setLightDirection

public void setLightDirection(Vector l)
Sets the direction toward the light to the specified Vector object.

Parameters:
l - Vector object to use.

getLightDirection

public Vector getLightDirection()
Returns:
A Vector object representing the direction toward the light (this can be expected to be unit length).

setLight

public void setLight(Light l)
Sets the Light to the specified Light object.

Parameters:
l - Light object to use.

getLight

public Light getLight()
Returns:
A Light object representing the light.

setOtherLights

public void setOtherLights(Light[] l)
Sets the other Lights to those stored in the specified array.

Parameters:
l - Array of Light objects to use.

getOtherLights

public Light[] getOtherLights()
Returns:
An array of Light objects representing the other lights in the scene.

setSurface

public void setSurface(Surface surface)
Parameters:
surface - The new Surface object.

getSurface

public Surface getSurface()
Returns:
The Surface object to be shaded.

setOtherSurfaces

public void setOtherSurfaces(Surface[] s)
Sets the other Surfaces to those stored in the specified array.

Parameters:
s - Array of Surface objects to use.

getOtherSurfaces

public Surface[] getOtherSurfaces()
Returns:
An array of other Surface objects in the scene.

getAllLights

public Light[] getAllLights()

getReflectionCount

public int getReflectionCount()
Returns:
The number of reflections (or other types of direction change) undergone.

getEnteranceCount

public int getEnteranceCount()
Returns:
The number of surface enterances undergone.

getExitCount

public int getExitCount()
Returns:
The number of surface exits undergone.

addReflection

public void addReflection()
Adds one to the reflection count stored by this ShaderParameters object.


addEnterance

public void addEnterance()
Adds one to the reflection count and the enterance count.


addExit

public void addExit()
Adds one to the reflection count and the exit count. This method may result in a random warning if exit count is greater than enterance count.


toString

public String toString()
Overrides:
toString in class Hashtable