|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jreality.scene.SceneGraphNode
de.jreality.scene.Camera
public class Camera
The camera represents essentially a projection from three dimensions into two, that is a specification of a viewing frustrum. The camera coordinate system is assumed to point down the positive z-axis. (Note: specific backends may flip the orientation of the z-axis. This issue is handled separately from the camera description here).
All instance of Camera require specifying the near and far clipping planes.
The camera can be either perspective or orthographic. If it is perspective, then
its viewing frustum can be specified by giving the field of view setFieldOfView(double)
.
This implies that the camera is on-axis,
that is, the viewing frustum is centered on the z-axis.
There is also support for off-axis cameras (setOnAxis(boolean)
).
Use the setViewPort(Rectangle2D)
method to
specify the desired viewport, which is assumed to lie in the z=1 plane.
In this case the field of view is ignored.
The camera also supports stereo viewing @link #setStereo(boolean). For most desktop environments the only other required parameters are:
setEyeSeparation(double)
),
a horizontal displacement in camera coordinates, andsetFocus(double)
, the z-depth where the two images are identical.setOrientationMatrix(double[])
), a 4x4 transformation matrix
which defines the rotation that has to be applied to the x-axis to get the
line in camera coordinates on which the eyes lie. (This matrix should fix (0,0,0,1)!).
Default eye positions are (-eyeSeparation/2,0,0) and (eyeSeparation, 0,0) in the
camera coordinate system. Use CameraUtility#getNDCToCamera(Camera, double, int)
to generate
the appropriate projection matrices.
Instances of CameraListener
can register with the camera
to be notified
when the camera changes.
Due to refactoring, the camera no longer has enough state to provide the perspective viewing transformation
from/to camera to/from Normalized Device Coordinates (NDC). It basically lacks the aspect ratio of the
output device. This allows to use the same camera for different viewers with
i. e. different window sizes. See CameraUtility
for methods which provide this functionality.
CameraUtility
Constructor Summary | |
---|---|
Camera()
|
|
Camera(String name)
|
Method Summary | |
---|---|
void |
accept(SceneGraphVisitor v)
The accept method for a SceneGraphVisitor. |
void |
addCameraListener(CameraListener listener)
|
double |
getEyeSeparation()
|
double |
getFar()
|
double |
getFieldOfView()
|
double |
getFocalLength()
Values useful in Renderman backend. |
double |
getFocus()
|
double |
getFStop()
Values useful in Renderman backend. |
double |
getNear()
|
double[] |
getOrientationMatrix()
The orientation matrix describes the transformation in camera coordinate system which describes the orientation of the head; the "standard" position is that the eyes are on the x-axis, up is the y-axis, and z is the direction of projection The orientation matrix is used for cameras such as those in the PORTAL. |
Rectangle2D |
getViewPort()
|
boolean |
isOnAxis()
|
boolean |
isPerspective()
|
boolean |
isStereo()
|
void |
removeCameraListener(CameraListener listener)
|
void |
setEyeSeparation(double eyeSeparation)
|
void |
setFar(double d)
|
void |
setFieldOfView(double d)
|
void |
setFocalLength(double focalLength)
|
void |
setFocus(double d)
|
void |
setFStop(double fstop)
|
void |
setNear(double d)
|
void |
setOnAxis(boolean b)
|
void |
setOrientationMatrix(double[] orientationMatrix)
|
void |
setPerspective(boolean b)
|
void |
setStereo(boolean isStereo)
|
void |
setViewPort(Rectangle2D rectangle2D)
|
Methods inherited from class de.jreality.scene.SceneGraphNode |
---|
getName, getOwner, getThreadSafe, isReadOnly, setName, setOwner, setReadOnly, setThreadSafe, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Camera(String name)
public Camera()
Method Detail |
---|
public double getNear()
public void setNear(double d)
public double getFar()
public void setFar(double d)
public double getFieldOfView()
public void setFieldOfView(double d)
public double getFocus()
public void setFocus(double d)
public Rectangle2D getViewPort()
public void setViewPort(Rectangle2D rectangle2D)
public boolean isOnAxis()
public void setOnAxis(boolean b)
public boolean isPerspective()
public void setPerspective(boolean b)
public double getEyeSeparation()
public void setEyeSeparation(double eyeSeparation)
eyeSeparation
- The eyeSeparation to set.public double[] getOrientationMatrix()
public void setOrientationMatrix(double[] orientationMatrix)
public boolean isStereo()
public void setStereo(boolean isStereo)
public void addCameraListener(CameraListener listener)
public void removeCameraListener(CameraListener listener)
public void accept(SceneGraphVisitor v)
SceneGraphNode
accept
in class SceneGraphNode
public double getFocalLength()
public double getFStop()
public void setFStop(double fstop)
public void setFocalLength(double focalLength)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |