public final class Camera
- Object
- Camera
A perspective or orthographic camera. The camera builds a view matrix from an
eye position, a look-at target and an up vector, and a projection matrix from
its lens parameters. Combine the two through
getViewProjection() which the
device multiplies with each model matrix.Constructors
public Camera() |
Methods
Inherited methods
Constructor details
Camera
public Camera()Method details
setPerspective
public Camera setPerspective(float fovYDegrees, float near, float far)Configures a perspective projection.
Parameters
fovYDegreesfloat- the vertical field of view in degrees
nearfloat- the near clip plane distance
farfloat- the far clip plane distance
Returns
this camera for chaining
setOrthographic
public Camera setOrthographic(float height, float near, float far)Configures an orthographic projection.
Parameters
heightfloat- the visible world height; width is derived from the aspect
nearfloat- the near clip plane distance
farfloat- the far clip plane distance
Returns
this camera for chaining
setAspect
public Camera setAspect(float aspect)Sets the viewport aspect ratio (width / height). The
RenderView
normally calls this from Renderer.onResize.Parameters
aspectfloat- the width / height ratio
Returns
this camera for chaining
setPosition
public Camera setPosition(float x, float y, float z)Sets the eye (camera) world position.
setTarget
public Camera setTarget(float x, float y, float z)Sets the world space point the camera looks at.
setUp
public Camera setUp(float x, float y, float z)Sets the camera up vector.
getEyeX
public float getEyeX()Returns the eye (camera) world space x coordinate.
getEyeY
public float getEyeY()Returns the eye (camera) world space y coordinate.
getEyeZ
public float getEyeZ()Returns the eye (camera) world space z coordinate.
getViewMatrix
public float[] getViewMatrix()Returns the 16 element column-major view matrix.
getProjectionMatrix
public float[] getProjectionMatrix()Returns the 16 element column-major projection matrix.
getViewProjection
public float[] getViewProjection()Returns the 16 element column-major combined projection * view matrix.