org.sunflow.core
Class Camera
java.lang.Object
org.sunflow.core.Camera
- All Implemented Interfaces:
- RenderObject
public class Camera
- extends java.lang.Object
- implements RenderObject
This class represents a camera to the renderer. It handles the mapping of
camera space to world space, as well as the mounting of CameraLens
objects which compute the actual projection.
Method Summary |
Ray |
getRay(float x,
float y,
int imageWidth,
int imageHeight,
double lensX,
double lensY,
double time)
Generate a ray passing though the specified point on the image plane. |
boolean |
update(ParameterList pl,
SunflowAPI api)
Update this object given a list of parameters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Camera
public Camera(CameraLens lens)
update
public boolean update(ParameterList pl,
SunflowAPI api)
- Description copied from interface:
RenderObject
- Update this object given a list of parameters. This method is guarenteed
to be called at least once on every object, but it should correctly
handle empty parameter lists. This means that the object should be in a
valid state from the time it is constructed. This method should also
return true or false depending on whether the update was succesfull or
not.
- Specified by:
update
in interface RenderObject
- Parameters:
pl
- list of parameters to read fromapi
- reference to the current scene
- Returns:
true
if the update is succesfull,
false
otherwise
getRay
public Ray getRay(float x,
float y,
int imageWidth,
int imageHeight,
double lensX,
double lensY,
double time)
- Generate a ray passing though the specified point on the image plane.
Additional random variables are provided for the lens to optionally
compute depth-of-field or motion blur effects. Note that the camera may
return
null
for invalid arguments or for pixels which
don't project to anything.
- Parameters:
x
- x pixel coordinatey
- y pixel coordinateimageWidth
- width of the image in pixelsimageHeight
- height of the image in pixelslensX
- a random variable in [0,1) to be used for DOF samplinglensY
- a random variable in [0,1) to be used for DOF samplingtime
- a random variable in [0,1) to be used for motion blur
sampling
- Returns:
- a ray passing through the specified pixel, or
null