Class Camera
java.lang.Object
com.codename1.gpu.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.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatgetEyeX()Returns the eye (camera) world space x coordinate.floatgetEyeY()Returns the eye (camera) world space y coordinate.floatgetEyeZ()Returns the eye (camera) world space z coordinate.float[]Returns the 16 element column-major projection matrix.float[]Returns the 16 element column-major view matrix.float[]Returns the 16 element column-major combined projection * view matrix.setAspect(float aspect) Sets the viewport aspect ratio (width / height).setOrthographic(float height, float near, float far) Configures an orthographic projection.setPerspective(float fovYDegrees, float near, float far) Configures a perspective projection.setPosition(float x, float y, float z) Sets the eye (camera) world position.setTarget(float x, float y, float z) Sets the world space point the camera looks at.setUp(float x, float y, float z) Sets the camera up vector.
-
Constructor Details
-
Camera
public Camera()
-
-
Method Details
-
setPerspective
Configures a perspective projection.
Parameters
-
fovYDegrees: the vertical field of view in degrees -
near: the near clip plane distance -
far: the far clip plane distance
Returns
this camera for chaining
-
-
setOrthographic
Configures an orthographic projection.
Parameters
-
height: the visible world height; width is derived from the aspect -
near: the near clip plane distance -
far: the far clip plane distance
Returns
this camera for chaining
-
-
setAspect
Sets the viewport aspect ratio (width / height). The
RenderViewnormally calls this fromRenderer.onResize.Parameters
aspect: the width / height ratio
Returns
this camera for chaining
-
setPosition
Sets the eye (camera) world position. -
setTarget
Sets the world space point the camera looks at. -
setUp
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.
-