Package rosequartz.gfx
Class PerspectiveCamera
- All Implemented Interfaces:
Serializable
,Cloneable
,CameraConfiguration.CameraConfigurationHolder
Represents a camera with a symmetrical perspective projection, primarily used in 3D games.
Objects that are closer to the camera appear bigger, while objects that are further away appear smaller.
- See Also:
- Serialized Form
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPerspectiveCamera(CameraConfiguration configuration)
Creates a new PerspectiveCamera from a CameraConfiguration -
Method Summary
Modifier and TypeMethodDescriptionclone()
Calculates the projection matrix for the current values of the camera.setAspectRatio(float aspectRatio)
Sets the aspect ratio of the camera.setAspectRatio(float width, float height)
Sets the aspect ratio of the camera from width and height.setFieldOfView(float fovRad)
Sets the field of view (FOV) of the camera IN RADIANS.setFieldOfViewDegrees(float fovDeg)
Sets the field of view (FOV) of the camera IN DEGREES.toString()
Methods inherited from class rosequartz.gfx.Camera
getConfiguration, getProjectionViewMatrix, getViewMatrix, setClipPlanes, setConfiguration
-
Field Details
-
fov
public float fov -
aspectRatio
public float aspectRatio
-
-
Constructor Details
-
PerspectiveCamera
Creates a new PerspectiveCamera from a CameraConfiguration- Parameters:
configuration
- configuration of the camera
-
-
Method Details
-
setFieldOfView
Sets the field of view (FOV) of the camera IN RADIANS. The default fov is PI/2 radians.- Parameters:
fovRad
- the angle between the left and right borders of the camera IN RADIANS- Returns:
- this
-
setFieldOfViewDegrees
Sets the field of view (FOV) of the camera IN DEGREES. The default fov is 45 degrees.- Parameters:
fovDeg
- the angle between the left and right borders of the camera IN DEGREES- Returns:
- this
-
setAspectRatio
Sets the aspect ratio of the camera. The default aspect ratio is 1:1.- Parameters:
aspectRatio
- aspect ratio- Returns:
- this
-
setAspectRatio
Sets the aspect ratio of the camera from width and height. The default aspect ratio is 1:1.- Parameters:
width
- width of the cameraheight
- height of the camera- Returns:
- this
-
getProjectionMatrix
Description copied from class:Camera
Calculates the projection matrix for the current values of the camera.- Specified by:
getProjectionMatrix
in classCamera<PerspectiveCamera>
- Returns:
- projection matrix
-
clone
- Specified by:
clone
in classCamera<PerspectiveCamera>
-
toString
-