OrbitalCamera

class OrbitalCamera(eye: Vector3 = Vector3.ZERO, lookAt: Vector3 = Vector3.UNIT_Z, var fov: Double = 90.0, var near: Double = 0.1, var far: Double = 1000.0, var projectionType: ProjectionType = ProjectionType.PERSPECTIVE) : Extension, ChangeEvents(source)

Constructors

Link copied to clipboard
constructor(eye: Vector3 = Vector3.ZERO, lookAt: Vector3 = Vector3.UNIT_Z, fov: Double = 90.0, near: Double = 0.1, far: Double = 1000.0, projectionType: ProjectionType = ProjectionType.PERSPECTIVE)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val changed: Event<Unit>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var enabled: Boolean
Link copied to clipboard
val eyeDefault: Vector3
Link copied to clipboard
var far: Double
Link copied to clipboard
var fov: Double
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val hasChanged: Boolean
Link copied to clipboard
var lookAt: Vector3
Link copied to clipboard
val lookAtDefault: Vector3
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var spherical: Spherical
Link copied to clipboard

Functions

Link copied to clipboard
open override fun afterDraw(drawer: Drawer, program: Program)
Link copied to clipboard
fun OrbitalCamera.applyTo(drawer: Drawer)

Enables the perspective camera. Use this faster method instead of .isolated() if you don't need to revert back to the orthographic projection.

Link copied to clipboard
open override fun beforeDraw(drawer: Drawer, program: Program)
Link copied to clipboard
fun defaults(instant: Boolean = false)

Reinitialize the camera to its initial state.

Link copied to clipboard
fun dolly(distance: Double, instant: Boolean = false)

Adjusts the camera's distance from the target by the specified amount. The change in distance is applied immediately if instant is set to true, otherwise it will be interpolated over time with smoothing.

Link copied to clipboard
fun dollyIn(instant: Boolean = false)

Zooms the camera in by decreasing the distance to the target. The zoom is based on an exponential scale factor determined by the zoomSpeed field. If the instant parameter is set to true, the zoom effect is applied immediately; otherwise, it will interpolate the change over time.

Link copied to clipboard
fun dollyOut(instant: Boolean = false)

Zooms the camera out by increasing the distance to the target. The zoom operation is based on an exponential scale factor determined by the zoomSpeed field.

Link copied to clipboard
fun dollyTo(distance: Double, instant: Boolean = false)

Adjusts the camera's distance (radius) to the specified value. If the instant parameter is set to true, the distance change is applied immediately; otherwise, it will be interpolated over time during updates.

Link copied to clipboard
fun OrbitalCamera.isolated(drawer: Drawer, function: Drawer.() -> Unit)

Temporarily enables this camera, calls function to draw using that camera, then disables it by popping the last matrix changes. It makes it easy to combine perspective and orthographic projections in the same program.

Link copied to clipboard
fun pan(x: Double, y: Double, z: Double, instant: Boolean = false)
Link copied to clipboard
fun panTo(target: Vector3, instant: Boolean = false)

Smoothly pans the camera to a specified target position. If the instant parameter is set to true, the panning occurs immediately; otherwise, it will be interpolated over time.

Link copied to clipboard
fun rotate(degreesX: Double, degreesY: Double, instant: Boolean = false)

Rotates the orbital camera by the specified angles in the horizontal and vertical directions. The rotation can be applied instantly or smoothly interpolated over time.

Link copied to clipboard
fun rotateTo(eye: Vector3, instant: Boolean = false)

Rotates the orbital camera to the specified position defined by the eye vector. The rotation can either occur instantly or smoothly interpolated over time, depending on the instant parameter.

fun rotateTo(degreesX: Double, degreesY: Double, instant: Boolean = false)

Rotates the camera to the specified spherical angles. The rotation can occur instantly or smoothly over time based on the instant parameter.

Link copied to clipboard
fun scale(scale: Double, instant: Boolean = false)

Adjusts the magnitude of the orbital camera by the specified scale factor. If the instant parameter is set to true, the adjustment is applied immediately; otherwise, it will be interpolated over time during updates.

Link copied to clipboard
fun scaleTo(scale: Double, instant: Boolean = false)

Adjusts the camera's scaling factor to the specified value. The scaling can either be applied instantly or interpolated over time during updates.

Link copied to clipboard
open override fun setup(program: Program)
Link copied to clipboard
fun setView(lookAt: Vector3, spherical: Spherical, fov: Double)

Sets the view for the orbital camera by updating the look-at position, spherical coordinates, and field of view (FOV). This method initializes both the target and current states of these properties.

Link copied to clipboard
open fun shutdown(program: Program)
Link copied to clipboard
fun update(timeDelta: Double)

Updates the orbital camera state by iteratively applying updates to the camera's parameters based on a fixed time step. The method ensures smooth interpolation of the camera properties (e.g., position, orientation) over a specified time delta.

Link copied to clipboard
fun updateStep(timeDelta: Double)

Updates the camera position, orientation, and view properties such as spherical coordinates, look-at point, field of view, and magnitude based on damping factors and time delta.

Link copied to clipboard
fun viewMatrix(): Matrix44

Computes and returns the view matrix for the orbital camera. The view matrix is calculated using the current spherical coordinates, look-at position, and the up vector (Vector3.UNIT_Y).

Link copied to clipboard
fun zoom(degrees: Double, instant: Boolean = false)

Adjusts the camera's field of view (FOV) by the specified number of degrees. The transition can either happen instantly or be interpolated over time during updates.

Link copied to clipboard
fun zoomTo(degrees: Double, instant: Boolean = false)

Adjusts the camera's field of view (FOV) to the specified number of degrees. If the instant parameter is set to true, the FOV immediately transitions to the specified value; otherwise, it will be interpolated over time during updates.