Bouncy Castle Rendering Toolkit 1.0

org.bouncycastle.graphics.rt
Class Camera

java.lang.Object
  |
  +--org.bouncycastle.graphics.rt.Camera

public class Camera
extends java.lang.Object

Class for the generic stationary camera.

Sample RML for a camera is:

      <Camera>
          <Perspective fov="45.0"/>
          <LookAt eye="0, 0, 5" reference="0, 0, 0" up="0, 1, 0"/>
      </Camera>
 

Document Type Definition:

     <!ENTITY %Float       "CDATA">
     <!ENTITY %Point3f     "CDATA">
     <!ENTITY %Vector3f    "CDATA">

     <!ELEMENT Camera ((Perspective | Ortho)?, LookAt, Twist?, DepthOfField?) >
     <!ELEMENT Ortho EMPTY>
     <!ATTLIST Ortho
              left            %Float; "-1"
              right           %Float; "1"
              bottom          %Float; "-1"
              top             %Float; "1"
              near            %Float; "0"
              far             %Float; "Float.POSITIVE_INFINITY">
     <!ELEMENT Perspective EMPTY>
     <!ATTLIST Perspective
              fov             %Float; "45"
              zNear           %Float; "0"
              zFar            %Float; "Float.POSITIVE_INFINITY">
     <!ELEMENT LookAt EMPTY>
     <!ATTLIST LookAt
              eye             %Point3f;  "0, 0, 0"
              reference       %Point3f;  "0, 0, -1"
              up              %Vector3f; "0, 1, 0">
     <!ELEMENT Twist EMPTY>
     <!ATTLIST Twist
              angle           %Float; "0">
     <!ELEMENT DepthOfField EMPTY>
     <!ATTLIST DepthOfField
              fStop           %Float; 
              focalLength     %Float;
              focalDistance   %Float;>
 


Constructor Summary
Camera()
           
 
Method Summary
protected  void calculateViewMatrix(Matrix4f trans)
           
 void configureLenseMask(int samples, boolean jitter)
           
 void depthOfField(double fStop, double focalLength, double focalDistance)
          In the normal situation with a real camera the diameter of the lense opening means that the camera is only capable of rendering objects sharply over a limited range of distances.
 Ray generateRay(int sampleNo, int time, float x, float y)
           
static Camera getInstance(RMLReader in)
           
 java.lang.String getName()
           
 void lookAt(Point3f eye, Point3f ref, Vector3f up)
          set the "look at" details for the camera.
 void ortho(double left, double right, double bottom, double top, double near, double far)
          Define a three dimensional viewing box by giving the left, right, bottom and top clipping plane locations and the distances along the line of sight to the near and far clipping planes.
 void perspective(double fov)
          Specify a perspective projection for the image, with the near clipping plan at 0 and the far one at infinity.
 void perspective(double fov, double zNear, double zFar)
          Specify a perspective viewing pyramid in world coordinates by giving a field of view and the locations of the near(zNear) and far(zFar) clipping planes in the z direction.
 void twist(double twist)
          set a twist about the line of sight.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Camera

public Camera()
Method Detail

getInstance

public static Camera getInstance(RMLReader in)
                          throws java.io.IOException

getName

public java.lang.String getName()

calculateViewMatrix

protected void calculateViewMatrix(Matrix4f trans)

lookAt

public void lookAt(Point3f eye,
                   Point3f ref,
                   Vector3f up)
set the "look at" details for the camera. The parameter eye represents the position of the observer, ref represents the position the observer is looking at, and up provides the direction of world up.
Parameters:
eye - the eye position.
ref - the point we are looking at.
up - the direction of world up.

twist

public void twist(double twist)
set a twist about the line of sight.
Parameters:
the - twist angle, in degrees.

depthOfField

public void depthOfField(double fStop,
                         double focalLength,
                         double focalDistance)
In the normal situation with a real camera the diameter of the lense opening means that the camera is only capable of rendering objects sharply over a limited range of distances. The smaller the opening the wider this range, or depth of field.

The default for a camera in our situation, is that it's a pin-hole and has an infinite depth of field. Finite depth of field, however, adds additional cues for depth perception, as well as adding an aesthetic touch to the image.

To add depth of field to an image we have to specify, a focal distance, a focal length, and the f-stop. The f-stop represents the size of the aperture admitting light into the camera, and the depth of field is determined by the ratio of the focal length to the f-stop and the focal distance.

Generaly the length units are millimeters, but in this case the units used are irrelevant, the units for focal length just need to be the same as for the focal distance.

Parameters:
fStop - the f-stop for the camera.
focalLength - the focal length of the lense.
focalDistance - distance at which objects will appear sharpest.

perspective

public void perspective(double fov)
Specify a perspective projection for the image, with the near clipping plan at 0 and the far one at infinity.
Parameters:
fov - the field of view.

perspective

public void perspective(double fov,
                        double zNear,
                        double zFar)
Specify a perspective viewing pyramid in world coordinates by giving a field of view and the locations of the near(zNear) and far(zFar) clipping planes in the z direction.
Parameters:
fov - the field of view.
zNear - the near clipping plan.
zFar - the far clipping plan.

ortho

public void ortho(double left,
                  double right,
                  double bottom,
                  double top,
                  double near,
                  double far)
Define a three dimensional viewing box by giving the left, right, bottom and top clipping plane locations and the distances along the line of sight to the near and far clipping planes.

configureLenseMask

public void configureLenseMask(int samples,
                               boolean jitter)

generateRay

public Ray generateRay(int sampleNo,
                       int time,
                       float x,
                       float y)

Bouncy Castle Rendering Toolkit 1.0