Class Camera

java.lang.Object
org.sunflow.core.Camera
All Implemented Interfaces:
RenderObject

public class Camera extends 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.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getRay(float x, float y, int imageWidth, int imageHeight, double lensX, double lensY, float time)
    Generate a ray passing though the specified point on the image plane.
    float
    getTime(float time)
    Computes actual time from a time sample in the interval [0,1).
    boolean
    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
  • Constructor Details

  • Method Details

    • 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 from
      api - reference to the current scene
      Returns:
      true if the update is succesfull, false otherwise
    • getTime

      public float getTime(float time)
      Computes actual time from a time sample in the interval [0,1). This random number is mapped somewhere between the shutterOpen and shutterClose times.
      Parameters:
      time -
      Returns:
    • getRay

      public Ray getRay(float x, float y, int imageWidth, int imageHeight, double lensX, double lensY, float 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 coordinate
      y - y pixel coordinate
      imageWidth - width of the image in pixels
      imageHeight - height of the image in pixels
      lensX - a random variable in [0,1) to be used for DOF sampling
      lensY - a random variable in [0,1) to be used for DOF sampling
      time - a random variable in [0,1) to be used for motion blur sampling
      Returns:
      a ray passing through the specified pixel, or null