Class Camera
- java.lang.Object
-
- de.coreengine.rendering.renderable.Camera
-
public class Camera extends Object
Represent a moveable camera in the 3d world- Author:
- Darius Dinger
-
-
Constructor Summary
Constructors Constructor Description Camera()Creating new camera at (0, 0, 0) with no rotation Reclaculate all matrices
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.vecmath.Matrix4fgetFacingMatrix()Getting cameras facing matrix, where the object every time facing the camerajavax.vecmath.Matrix4fgetFacingMVPMatrix(float x, float y, float z)Getting cameras current view projection matrix, where the object every time facing the camerafloatgetFarPlane()Gets cameras far plane distancefloatgetFov()Gets cameras field of viewfloatgetNearPlane()Gets cameras near plane distancefloatgetPitch()Gets cameras pitch (rotation around the x axis) in degreesjavax.vecmath.Vector3fgetPosition()Gets cameras current position in world space as 3d vectorjavax.vecmath.Matrix4fgetProjectionMatrix()CameraRaygetRay()floatgetRoll()Gets cameras roll (rotation around the z axis) in degreesjavax.vecmath.Matrix4fgetRotX()Gets the current rotation matrix around the x axisjavax.vecmath.Matrix4fgetRotY()Gets the current rotation matrix around the y axisjavax.vecmath.Matrix4fgetRotZ()Gets the current rotation matrix around the z axisjavax.vecmath.Matrix4fgetViewMatrix()javax.vecmath.Matrix4fgetViewProjectionMatrix()Getting cameras current view projection matrixfloatgetYaw()Gets cameras yaw (rotation around the y axis) in degreesvoidrecalcViewMatrix()Recalculate view matrix from position and rotation from this cameravoidrecalcViewProjectionMatrix()Recalculate view projection matrix from view andprojection matrix from this cameravoidsetFarPlane(float farPlane)Setting new camera far planevoidsetFov(float fov)Setting new camera field of viewvoidsetNearPlane(float nearPlane)Setting new camera near planevoidsetPitch(float pitch)Setting new camera pitch and sets camera rotated to true if it has changedvoidsetRoll(float roll)Setting new camera roll and sets camera rotated to true if it has changedvoidsetX(float x)Setting new camera x position and sets moved to true if it has changedvoidsetY(float y)Setting new camera y position and sets moved to true if it has changedvoidsetYaw(float yaw)Setting new camera yaw and sets camera rotated to true if it has changedvoidsetZ(float z)Setting new camera z position and sets moved to true if it has changedvoidupdateViewMatrix()Check if camera was moved.
-
-
-
Method Detail
-
updateViewMatrix
public void updateViewMatrix()
Check if camera was moved. if then and update matrices setting moved and rotated variables to false
-
recalcViewProjectionMatrix
public final void recalcViewProjectionMatrix()
Recalculate view projection matrix from view andprojection matrix from this camera
-
recalcViewMatrix
public final void recalcViewMatrix()
Recalculate view matrix from position and rotation from this camera
-
setPitch
public void setPitch(float pitch)
Setting new camera pitch and sets camera rotated to true if it has changed- Parameters:
pitch- New camera pitch
-
setYaw
public void setYaw(float yaw)
Setting new camera yaw and sets camera rotated to true if it has changed- Parameters:
yaw- New camera yaw
-
setRoll
public void setRoll(float roll)
Setting new camera roll and sets camera rotated to true if it has changed- Parameters:
roll- New camera roll
-
setX
public void setX(float x)
Setting new camera x position and sets moved to true if it has changed- Parameters:
x- New camera x position
-
setY
public void setY(float y)
Setting new camera y position and sets moved to true if it has changed- Parameters:
y- New camera y position
-
setZ
public void setZ(float z)
Setting new camera z position and sets moved to true if it has changed- Parameters:
z- New camera z position
-
setFarPlane
public void setFarPlane(float farPlane)
Setting new camera far plane- Parameters:
farPlane- New camera far plane
-
setNearPlane
public void setNearPlane(float nearPlane)
Setting new camera near plane- Parameters:
nearPlane- New camera near plane
-
setFov
public void setFov(float fov)
Setting new camera field of view- Parameters:
fov- New camera fov
-
getProjectionMatrix
public javax.vecmath.Matrix4f getProjectionMatrix()
-
getViewMatrix
public javax.vecmath.Matrix4f getViewMatrix()
-
getFov
public float getFov()
Gets cameras field of view- Returns:
- New cameras fov
-
getNearPlane
public float getNearPlane()
Gets cameras near plane distance- Returns:
- Cameras near plane distance
-
getFarPlane
public float getFarPlane()
Gets cameras far plane distance- Returns:
- Cameras far plane distance
-
getPosition
public javax.vecmath.Vector3f getPosition()
Gets cameras current position in world space as 3d vector- Returns:
- Current position as 3d vector
-
getPitch
public float getPitch()
Gets cameras pitch (rotation around the x axis) in degrees- Returns:
- Cameras pitch in degrees
-
getYaw
public float getYaw()
Gets cameras yaw (rotation around the y axis) in degrees- Returns:
- Cameras yaw in degrees
-
getRoll
public float getRoll()
Gets cameras roll (rotation around the z axis) in degrees- Returns:
- Cameras roll in degrees
-
getViewProjectionMatrix
public javax.vecmath.Matrix4f getViewProjectionMatrix()
Getting cameras current view projection matrix- Returns:
- View proejction matrix of the camera
-
getFacingMVPMatrix
public javax.vecmath.Matrix4f getFacingMVPMatrix(float x, float y, float z)Getting cameras current view projection matrix, where the object every time facing the camera- Parameters:
x- X offset of the matrixy- Y offset of the matrixz- Z offset of the matrix- Returns:
- View projection matrix of the camera
-
getRotX
public javax.vecmath.Matrix4f getRotX()
Gets the current rotation matrix around the x axis- Returns:
- X axis rotation matrix
-
getRotY
public javax.vecmath.Matrix4f getRotY()
Gets the current rotation matrix around the y axis- Returns:
- Y axis rotation matrix
-
getRotZ
public javax.vecmath.Matrix4f getRotZ()
Gets the current rotation matrix around the z axis- Returns:
- Z axis rotation matrix
-
getFacingMatrix
public javax.vecmath.Matrix4f getFacingMatrix()
Getting cameras facing matrix, where the object every time facing the camera- Returns:
- Facing matrix of the camera
-
getRay
public CameraRay getRay()
- Returns:
- Current ray the camera is looking to
-
-