Class Scene

java.lang.Object
  extended by Scene
All Implemented Interfaces:
CloneableEx, java.lang.Cloneable

public class Scene
extends java.lang.Object
implements CloneableEx

A class that contains all information necessary to render a scene, including objects in the scene, lights in the scene, viewport dimensions, and global scene properties.


Field Summary
static float DEFAULT_MIN_RAY_WEIGHT
           
static int DEFAULT_RECURSION_DEPTH
           
static double EPSILON
           
 
Constructor Summary
Scene()
          Constructs the default (empty) scene.
 
Method Summary
 java.lang.Object clone()
          Returns a copy of the object.
 Air getAir()
          Returns the medium rays travel through when not in an object.
 javax.vecmath.Color3f getAmbientLight()
          Returns the ambient light in the scene.
 Camera getCamera()
          Returns the scene's camera.
 int getHeight()
          Returns the height of the viewport in pixels.
 java.util.ArrayList<Light> getLights()
          Returns the lights in the scene.
 float getMinimumRayWeight()
          Returns the minimum weight of a ray.
 int getRecursionDepth()
          Returns the maximum recursion depth of a traced ray.
 java.util.ArrayList<Shape> getShapes()
          Returns the shapes in the scene.
 java.awt.Dimension getViewportDimensions()
          Returns the dimensions of the viewport in pixels.
 int getWidth()
          Returns the width of the viewport in pixels.
 boolean LoadScene(java.io.File file)
          Loads a scene from the specified file.
 boolean LoadScene(java.lang.String data)
          Loads a scene from a string containing the scene data.
 void reset()
          Resets the scene back to the default (empty) state.
 void setAir(Air air)
          Sets the medium rays travel through when not inside an object.
 void setMinimumRayWeight(float minWeight)
          Sets the minimum weight of a ray.
 void setRecursionDepth(int depth)
          Sets the maximum recursion depth of a traced ray.
 void setViewportDimensions(int width, int height, float aspectRatio)
          Sets the dimensions of the viewport.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RECURSION_DEPTH

public static final int DEFAULT_RECURSION_DEPTH
See Also:
Constant Field Values

EPSILON

public static final double EPSILON
See Also:
Constant Field Values

DEFAULT_MIN_RAY_WEIGHT

public static final float DEFAULT_MIN_RAY_WEIGHT
See Also:
Constant Field Values
Constructor Detail

Scene

public Scene()
Constructs the default (empty) scene.

Method Detail

clone

public java.lang.Object clone()
Description copied from interface: CloneableEx
Returns a copy of the object.

Specified by:
clone in interface CloneableEx
Overrides:
clone in class java.lang.Object
Returns:
A copy of the object.

reset

public void reset()
Resets the scene back to the default (empty) state.


LoadScene

public boolean LoadScene(java.io.File file)
                  throws java.io.FileNotFoundException,
                         java.io.IOException
Loads a scene from the specified file. All previous scene data is discarded.

Parameters:
file - The file containing scene data.
Returns:
true if the scene was loaded properly, otherwise false.
Throws:
java.io.FileNotFoundException
java.io.IOException

LoadScene

public boolean LoadScene(java.lang.String data)
Loads a scene from a string containing the scene data. All previous scene data is discarded.

Parameters:
data - The string containing the scene data.
Returns:
true if the scene was loaded properly, otherwise false.

getShapes

public java.util.ArrayList<Shape> getShapes()
Returns the shapes in the scene.

Returns:
The shapes in the scene.

getLights

public java.util.ArrayList<Light> getLights()
Returns the lights in the scene.

Returns:
The lights in the scene.

getAmbientLight

public javax.vecmath.Color3f getAmbientLight()
Returns the ambient light in the scene.

Returns:
The ambient light in the scene.

getCamera

public Camera getCamera()
Returns the scene's camera.

Returns:
The scene's camera.

getViewportDimensions

public java.awt.Dimension getViewportDimensions()
Returns the dimensions of the viewport in pixels.

Returns:
The dimensions of the viewport.

setViewportDimensions

public void setViewportDimensions(int width,
                                  int height,
                                  float aspectRatio)
Sets the dimensions of the viewport. If aspectRatio is non-zero the dimension with the greatest value is used to determine the other dimensions aspect correct value. Otherwise, if both dimensions are non-zero the viewport dimensions are set to those values. Using negative values for any parameter is undefined.

Parameters:
width - The width of the viewport in pixels.
height - The height of the viewport in pixels.
aspectRatio - The aspect ratio of the viewport.

getWidth

public int getWidth()
Returns the width of the viewport in pixels.

Returns:
The width of the viewport.

getHeight

public int getHeight()
Returns the height of the viewport in pixels.

Returns:
The height of the viewport.

setRecursionDepth

public void setRecursionDepth(int depth)
Sets the maximum recursion depth of a traced ray.

Parameters:
depth - The number of recursions a ray will traverse.

getRecursionDepth

public int getRecursionDepth()
Returns the maximum recursion depth of a traced ray.

Returns:
The maximum recursion depth.

setMinimumRayWeight

public void setMinimumRayWeight(float minWeight)
Sets the minimum weight of a ray. If the weight of a ray falls below this minimum it will be discarded even if the maximum recursion depth has not yet been reached.

Parameters:
minWeight - The minimum ray weight.

getMinimumRayWeight

public float getMinimumRayWeight()
Returns the minimum weight of a ray.

Returns:
The minimum ray weight.

setAir

public void setAir(Air air)
Sets the medium rays travel through when not inside an object.

Parameters:
air - The air to set.

getAir

public Air getAir()
Returns the medium rays travel through when not in an object.

Returns:
The scene's air.