GeneralizedOrbital

class GeneralizedOrbital(eye: Vector3 = Vector3.UNIT_Z * 10.0, lookAt: Vector3 = Vector3.ZERO, var fov: Double = 90.0, var near: Double = 0.1, var far: Double = 1000.0) : Extension, ChangeEvents(source)

An orbital camera and its mouse/keyboard controls in a single Extension -- the way Orbital combines OrbitalCamera and OrbitalControls, except there's no separate camera/controls pair to wire together here, and the projection matrix comes from generalizedProjection instead of Drawer.perspective/Drawer.ortho.

That swap replaces OrbitalCamera's discrete ProjectionType -- PERSPECTIVE vs ORTHOGONAL, each with its own size field (fov vs a separate ortho magnitude) -- with a single continuous perspective blend (0.0 fully parallel, 1.0 fully perspective) applied to one viewport rectangle, sized by fov at the current orbit radius (the eye-to-lookAt distance) rather than at near. For a full perspective projection that choice of reference distance doesn't matter -- generalizedProjection's perspective divide rescales the rectangle by each point's actual distance regardless of where it was measured, the usual similar-triangles invariance of a frustum -- but it matters a great deal once perspective drops below 1.0: with no such rescaling left, an orthographic projection uses the rectangle's size directly as the visible width of the whole scene, at every depth, so it has to already be in scale with the orbit rather than a sliver measured a fraction of a unit from the eye. One consequence: dolly (mouse wheel) changes what's visible in both modes now, since it changes that reference distance -- there's no separate ortho magnitude/near/far bookkeeping, and no mode where scrolling does nothing.

Constructors

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

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val changed: Event<Unit>
Link copied to clipboard

Damping factor for camera motion, set to 0 for no damping.

Link copied to clipboard
Link copied to clipboard
open override var enabled: Boolean
Link copied to clipboard
var eye: Vector3

The camera's world-space position; setting it re-derives spherical from lookAt.

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
Link copied to clipboard
var lookAt: Vector3
Link copied to clipboard
val lookAtDefault: Vector3
Link copied to clipboard

The near clip plane's distance from the eye at perspective = 1.0; the effective near clip distance tapers linearly to 0.0 as perspective drops toward 0.0 -- see beforeDraw.

Link copied to clipboard
var offset: Vector2

Shifts generalizedProjection's viewportCenter in x/y, in the same world units as the viewport rectangle itself -- an off-axis (sheared) frustum shift, the way a lens-shift lens or a tiled/CAVE display's off-center screen would, without moving or rotating the eye. Vector2.ZERO is the ordinary on-axis frustum. Damped like the other orbit properties -- set it directly for an instant change, or animate it smoothly with offsetTo.

Link copied to clipboard
val offsetDefault: Vector2
Link copied to clipboard
var offsetEnd: Vector2
Link copied to clipboard

0.0 = fully parallel (orthographic), 1.0 = fully perspective; see generalizedProjection. Damped like the other orbit properties -- set it directly for an instant change, or animate it smoothly with perspectiveTo.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var spherical: Spherical
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun afterDraw(drawer: Drawer, program: Program)
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 (construction-time) state.

Link copied to clipboard
fun dolly(distance: Double, instant: Boolean = false)
Link copied to clipboard
fun dollyIn(amount: Double = 1.0, instant: Boolean = false)
Link copied to clipboard
fun dollyOut(amount: Double = 1.0, instant: Boolean = false)
Link copied to clipboard
fun dollyTo(distance: Double, instant: Boolean = false)
Link copied to clipboard
fun dollyZoomTo(distance: Double, instant: Boolean = false)

Dollies to distance the way DemoGeneralizedPerspective01 establishes a dolly zoom -- compensating fov as the eye moves so whatever sits at lookAt keeps the same apparent size, leaving only the depth-dependent stretch/compression (the Vertigo effect) visible elsewhere in the scene. The demo derives its viewport size from subjectDistance / distance; since fov plays the same role here that viewport size did there (both feed the same 2 * distance * tan(fov / 2) viewport-height formula beforeDraw uses -- see the class doc), the equivalent invariant to hold is distance * tan(fov / 2) = constant. That constant is taken from the current target (sphericalEnd's radius and fovEnd) at the moment this is called, not spherical/fov directly, so chained or repeated calls compose the way dolly/zoom do instead of resetting to whatever framing happened to be on screen.

Link copied to clipboard
fun isolated(drawFunction: Drawer.() -> Unit)
Link copied to clipboard
fun isolatedWithTarget(target: RenderTarget, drawFunction: Drawer.() -> Unit)
Link copied to clipboard
fun offsetTo(target: Vector2, instant: Boolean = false)
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)
Link copied to clipboard
fun perspectiveTo(value: Double, instant: Boolean = false)
Link copied to clipboard
fun rotate(degreesX: Double, degreesY: Double, instant: Boolean = false)
Link copied to clipboard
fun rotateTo(eye: Vector3, instant: Boolean = false)
fun rotateTo(degreesX: Double, degreesY: Double, instant: Boolean = false)
Link copied to clipboard
open override fun setup(program: Program)
Link copied to clipboard
fun setView(lookAt: Vector3, spherical: Spherical, fov: Double, perspective: Double, offset: Vector2 = Vector2.ZERO)
Link copied to clipboard
open fun shutdown(program: Program)
Link copied to clipboard
fun update(timeDelta: Double)
Link copied to clipboard
fun zoom(degrees: Double, instant: Boolean = false)
Link copied to clipboard
fun zoomTo(degrees: Double, instant: Boolean = false)