artofillusion.object
Class SceneCamera

java.lang.Object
  extended by artofillusion.object.Object3D
      extended by artofillusion.object.SceneCamera

public class SceneCamera
extends Object3D

SceneCamera is a type of Object3D. It represents a camera which the user can position within a scene. It should not be confused with the Camera class.


Nested Class Summary
static class SceneCamera.CameraKeyframe
           
 
Field Summary
 
Fields inherited from class artofillusion.object.Object3D
APPROXIMATELY, CANT_CONVERT, EXACTLY
 
Constructor Summary
SceneCamera()
           
SceneCamera(java.io.DataInputStream in, Scene theScene)
           
 
Method Summary
 void applyImageFilters(ComplexImage image, Scene scene, CoordinateSystem coords)
          Apply all of this camera's filters to an image.
 void applyPoseKeyframe(Keyframe k)
          Modify this object based on a pose keyframe.
 boolean canSetTexture()
          This method tells whether textures can be assigned to the object.
 void configurePoseTrack(PoseTrack track)
          This will be called whenever a new pose track is created for this object.
 void copyObject(Object3D obj)
          Copy all the properties of another object, to make this one identical to it.
 Camera createCamera(int width, int height, CoordinateSystem coords)
          Create a Camera object representing the view through this SceneCamera.
 SceneCamera duplicate()
          Create a new object which is an exact duplicate of this one.
 void edit(EditingWindow parent, ObjectInfo info, java.lang.Runnable cb)
          Display a window in which the user can edit this object.
 void editKeyframe(EditingWindow parent, Keyframe k, ObjectInfo info)
          Allow the user to edit a keyframe returned by getPoseKeyframe().
 BoundingBox getBounds()
          Get a BoundingBox which just encloses the object.
 int getComponentsForFilters()
          Get a list of all image components that should be included in rendered images.
 double getDepthOfField()
           
 int getExtraRequiredComponents()
          Get a list of additional image components, beyond those required by the camera's filters, which should be included in rendered images.
 double getFieldOfView()
           
 double getFocalDistance()
           
 ImageFilter[] getImageFilters()
          Get the list of ImageFilters for this camera.
 Keyframe getPoseKeyframe()
          Return a Keyframe which describes the current pose of this object.
 Property[] getProperties()
          Get a list of editable properties defined by this object.
 java.lang.Object getPropertyValue(int index)
          Get the value of one of this object's editable properties.
 void getRayFromCamera(double x, double y, double dof1, double dof2, Vec3 origin, Vec3 direction)
          Compute a ray from the camera location through a point in its field of, represented in the camera's local coordinate system.
 Mat4 getScreenTransform(int width, int height)
          Get the transform which maps between view coordinates and screen coordinates for this camera.
 WireframeMesh getWireframeMesh()
          Every object should override this method to return a WireframeMesh.
 boolean isEditable()
          If the object can be edited by the user, isEditable() should be overridden to return true.
 boolean isPerspective()
           
 ComplexImage renderScene(Scene theScene, int width, int height, Renderer rend, CoordinateSystem cameraPos)
          This is a utility method which synchronously renders an image of the scene from the viewpoint of this camera.
 void setDepthOfField(double dof)
           
 void setExtraRequiredComponents(int components)
          Set a list of additional image components, beyond those required by the camera's filters, which should be included in rendered images.
 void setFieldOfView(double fieldOfView)
           
 void setFocalDistance(double dist)
           
 void setImageFilters(ImageFilter[] filters)
          Set the list of ImageFilters for this camera.
 void setPerspective(boolean perspective)
           
 void setPropertyValue(int index, java.lang.Object value)
          Set the value of one of this object's editable properties.
 void setSize(double xsize, double ysize, double zsize)
          Resize the object.
 void writeToFile(java.io.DataOutputStream out, Scene theScene)
          The following method writes the object's data to an output stream.
 
Methods inherited from class artofillusion.object.Object3D
canConvertToActor, canConvertToTriangleMesh, canSetMaterial, convertToTriangleMesh, copyTextureAndMaterial, editGesture, getAverageParameterValues, getMaterial, getMaterialMapping, getParameters, getParameterValue, getParameterValues, getPosableObject, getRenderingMesh, getSkeleton, getTexture, getTextureMapping, isClosed, readParameterValue, renderObject, sceneChanged, setMaterial, setParameters, setParameterValue, setParameterValues, setTexture
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SceneCamera

public SceneCamera()

SceneCamera

public SceneCamera(java.io.DataInputStream in,
                   Scene theScene)
            throws java.io.IOException,
                   java.io.InvalidObjectException
Throws:
java.io.IOException
java.io.InvalidObjectException
Method Detail

getFieldOfView

public double getFieldOfView()

setFieldOfView

public void setFieldOfView(double fieldOfView)

getDepthOfField

public double getDepthOfField()

setDepthOfField

public void setDepthOfField(double dof)

getFocalDistance

public double getFocalDistance()

setFocalDistance

public void setFocalDistance(double dist)

isPerspective

public boolean isPerspective()

setPerspective

public void setPerspective(boolean perspective)

getImageFilters

public ImageFilter[] getImageFilters()
Get the list of ImageFilters for this camera.


setImageFilters

public void setImageFilters(ImageFilter[] filters)
Set the list of ImageFilters for this camera.


getExtraRequiredComponents

public int getExtraRequiredComponents()
Get a list of additional image components, beyond those required by the camera's filters, which should be included in rendered images. This is a sum of the constants defined in ComplexImage.


setExtraRequiredComponents

public void setExtraRequiredComponents(int components)
Set a list of additional image components, beyond those required by the camera's filters, which should be included in rendered images. This is a sum of the constants defined in ComplexImage.


getComponentsForFilters

public int getComponentsForFilters()
Get a list of all image components that should be included in rendered images. This includes all those required by this camera's filters, as well as ones specified by setExtraRequiredComponents(). This is a sum of the constants defined in ComplexImage.


applyImageFilters

public void applyImageFilters(ComplexImage image,
                              Scene scene,
                              CoordinateSystem coords)
Apply all of this camera's filters to an image.

Parameters:
image - the image to filter
scene - the Scene which was rendered to create the image
coords - the position of this camera in the scene

getScreenTransform

public Mat4 getScreenTransform(int width,
                               int height)
Get the transform which maps between view coordinates and screen coordinates for this camera.

Parameters:
width - the image width in pixels
height - the image height in pixels

getRayFromCamera

public void getRayFromCamera(double x,
                             double y,
                             double dof1,
                             double dof2,
                             Vec3 origin,
                             Vec3 direction)
Compute a ray from the camera location through a point in its field of, represented in the camera's local coordinate system.

Parameters:
x - the x coordinate of the point in the plane z=1 through which the ray passes
y - the y coordinate of the point in the plane z=1 through which the ray passes
dof1 - this is used for simulating depth of field. dof1 and dof2 are independent values uniformly distributed between 0 and 1. Together, they select the point on the camera which should serve as the ray's origin.
origin - on exit, this contains the ray origin
direction - on exit, this contains the normalized ray direction

duplicate

public SceneCamera duplicate()
Description copied from class: Object3D
Create a new object which is an exact duplicate of this one.

Specified by:
duplicate in class Object3D

copyObject

public void copyObject(Object3D obj)
Description copied from class: Object3D
Copy all the properties of another object, to make this one identical to it. If the two objects are of different classes, this will throw a ClassCastException.

Specified by:
copyObject in class Object3D

getBounds

public BoundingBox getBounds()
Description copied from class: Object3D
Get a BoundingBox which just encloses the object.

Specified by:
getBounds in class Object3D

setSize

public void setSize(double xsize,
                    double ysize,
                    double zsize)
Description copied from class: Object3D
Resize the object. This should be interpreted such that, if setSize() is followed by a call to getBounds(), the dimensions of the BoundingBox will exactly match the dimensions specified in setSize().

Specified by:
setSize in class Object3D

canSetTexture

public boolean canSetTexture()
Description copied from class: Object3D
This method tells whether textures can be assigned to the object. Objects for which it makes no sense to assign a texture (curves, lights, etc.) should override this method to return false.

Overrides:
canSetTexture in class Object3D

getWireframeMesh

public WireframeMesh getWireframeMesh()
Description copied from class: Object3D
Every object should override this method to return a WireframeMesh. This will be used for drawing the object in wireframe mode, and also for drawing "nonrenderable" objects in other rendering modes.

Specified by:
getWireframeMesh in class Object3D

createCamera

public Camera createCamera(int width,
                           int height,
                           CoordinateSystem coords)
Create a Camera object representing the view through this SceneCamera.

Parameters:
width - the width of the image viewed through the Camera
height - the height of the image viewed through the Camera
coords - the CoordinateSystem of this SceneCamera
Returns:
an appropriately configured Camera

renderScene

public ComplexImage renderScene(Scene theScene,
                                int width,
                                int height,
                                Renderer rend,
                                CoordinateSystem cameraPos)
This is a utility method which synchronously renders an image of the scene from the viewpoint of this camera.


isEditable

public boolean isEditable()
Description copied from class: Object3D
If the object can be edited by the user, isEditable() should be overridden to return true. edit() should then create a window and allow the user to edit the object.

Overrides:
isEditable in class Object3D

edit

public void edit(EditingWindow parent,
                 ObjectInfo info,
                 java.lang.Runnable cb)
Description copied from class: Object3D
Display a window in which the user can edit this object.

Overrides:
edit in class Object3D
Parameters:
parent - the window from which this command is being invoked
info - the ObjectInfo corresponding to this object
cb - a callback which will be executed when editing is complete. If the user cancels the operation, it will not be called.

writeToFile

public void writeToFile(java.io.DataOutputStream out,
                        Scene theScene)
                 throws java.io.IOException
Description copied from class: Object3D
The following method writes the object's data to an output stream. Subclasses should override this method, but also call super.writeToFile() to save information about materials, etc. In addition to this method, every Object3D must include a constructor with the signature public Classname(DataInputStream in, Scene theScene) throws IOException, InvalidObjectException which reconstructs the object by reading its data from an input stream. This constructor, similarly, should call the overridden constructor to read information about materials, etc.

Overrides:
writeToFile in class Object3D
Throws:
java.io.IOException

getProperties

public Property[] getProperties()
Description copied from class: Object3D
Get a list of editable properties defined by this object.

Overrides:
getProperties in class Object3D

getPropertyValue

public java.lang.Object getPropertyValue(int index)
Description copied from class: Object3D
Get the value of one of this object's editable properties.

Overrides:
getPropertyValue in class Object3D
Parameters:
index - the index of the property to get

setPropertyValue

public void setPropertyValue(int index,
                             java.lang.Object value)
Description copied from class: Object3D
Set the value of one of this object's editable properties.

Overrides:
setPropertyValue in class Object3D
Parameters:
index - the index of the property to set
value - the value to set for the property

getPoseKeyframe

public Keyframe getPoseKeyframe()
Description copied from class: Object3D
Return a Keyframe which describes the current pose of this object.

Specified by:
getPoseKeyframe in class Object3D

applyPoseKeyframe

public void applyPoseKeyframe(Keyframe k)
Description copied from class: Object3D
Modify this object based on a pose keyframe.

Specified by:
applyPoseKeyframe in class Object3D

configurePoseTrack

public void configurePoseTrack(PoseTrack track)
This will be called whenever a new pose track is created for this object. It allows the object to configure the track by setting its graphable values, subtracks, etc.

Overrides:
configurePoseTrack in class Object3D

editKeyframe

public void editKeyframe(EditingWindow parent,
                         Keyframe k,
                         ObjectInfo info)
Description copied from class: Object3D
Allow the user to edit a keyframe returned by getPoseKeyframe().

Overrides:
editKeyframe in class Object3D


Copyright © 1999-2011 by Peter Eastman.