Package org.sunflow.core.camera
Class ThinLens
- java.lang.Object
-
- org.sunflow.core.camera.ThinLens
-
- All Implemented Interfaces:
CameraLens
,RenderObject
public class ThinLens extends java.lang.Object implements CameraLens
-
-
Field Summary
Fields Modifier and Type Field Description private float
aspect
private float
au
private float
av
private float
focusDistance
private float
fov
private float
lensRadius
private float
lensRotation
private float
lensRotationRadians
private int
lensSides
private float
shiftX
private float
shiftY
-
Constructor Summary
Constructors Constructor Description ThinLens()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Ray
getRay(float x, float y, int imageWidth, int imageHeight, double lensX, double lensY, double time)
Create a newray
to be cast through pixel (x,y) on the image plane.private void
update()
boolean
update(ParameterList pl, SunflowAPI api)
Update this object given a list of parameters.
-
-
-
Field Detail
-
au
private float au
-
av
private float av
-
aspect
private float aspect
-
fov
private float fov
-
shiftX
private float shiftX
-
shiftY
private float shiftY
-
focusDistance
private float focusDistance
-
lensRadius
private float lensRadius
-
lensSides
private int lensSides
-
lensRotation
private float lensRotation
-
lensRotationRadians
private float lensRotationRadians
-
-
Method Detail
-
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 interfaceRenderObject
- Parameters:
pl
- list of parameters to read fromapi
- reference to the current scene- Returns:
true
if the update is succesfull,false
otherwise
-
update
private void update()
-
getRay
public Ray getRay(float x, float y, int imageWidth, int imageHeight, double lensX, double lensY, double time)
Description copied from interface:CameraLens
Create a newray
to be cast through pixel (x,y) on the image plane. Two sampling parameters are provided for lens sampling. They are guarenteed to be in the interval [0,1). They can be used to perturb the position of the source of the ray on the lens of the camera for DOF effects. A third sampling parameter is provided for motion blur effects. Note that theCamera
class already handles camera movement motion blur. Rays should be generated in camera space - that is, with the eye at the origin, looking down the -Z axis, with +Y pointing up.- Specified by:
getRay
in interfaceCameraLens
- Parameters:
x
- x coordinate of the (sub)pixely
- y coordinate of the (sub)pixelimageWidth
- image width in pixelsimageHeight
- image height in pixelslensX
- x lens sampling parameterlensY
- y lens sampling parametertime
- time sampling parameter- Returns:
- a new ray passing through the given pixel
-
-