Class SceneCameraService
Camera input configuration and target tracking are restored or cleared automatically when
the activation ends. The facade advances camera interpolation exactly once per Processing
frame; calling OrbitCamera.update() from a scene would advance it twice.
API stability: Advanced Stable.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidapply(processing.opengl.PGraphicsOpenGL graphics) Applies the shared scene-camera transform to an open render target.voidapplyWithViewLighting(processing.opengl.PGraphicsOpenGL graphics) Applies the shared scene-camera transform and installs a camera-synchronized view-lighting rig on an open render target.voidStops automatic target tracking without changing the current camera target.booleanorbit()voidsetCollapseGuard(float guard) Sets the dead zone that prevents an orbit distance from collapsing through zero.voidsetDistanceLimits(float minimum, float maximum) Sets the allowed orbit-distance interval.voidsetDragSensitivity(float sensitivity) Sets direct pointer-drag sensitivity in radians per pixel.voidsetInputEnabled(boolean enabled) Selects whether navigation input is routed to the scene camera.voidsetLerpFactor(float factor) Sets the interpolation amount used by programmatic camera movement.voidsnapToAxisAngle(float targetX, float targetY, float targetZ, float axisX, float axisY, float axisZ, float angle, float distance) Immediately applies a complete orbit pose expressed as an axis-angle rotation.voidtrackTarget(Supplier<processing.core.PVector> targetSupplier) Tracks a dynamic world-space target once after each scene update.
-
Method Details
-
orbit
- Returns:
- shared scene-space orbit camera; never
nullduring the activation
-
apply
public void apply(processing.opengl.PGraphicsOpenGL graphics) Applies the shared scene-camera transform to an open render target. Call fromScene.sceneRender(PGraphicsOpenGL)between a matchingpushMatrix()/popMatrix()pair.- Parameters:
graphics- active scene render target
-
applyWithViewLighting
public void applyWithViewLighting(processing.opengl.PGraphicsOpenGL graphics) Applies the shared scene-camera transform and installs a camera-synchronized view-lighting rig on an open render target.The rig replaces the target's current lights with a neutral ambient light and a warm white spotlight located at the current scene-camera position and aimed at its current look-at target. It remains stable while spherical capture renders multiple cubemap faces because this method only reads camera state; it never advances camera interpolation.
Call from
Scene.sceneRender(PGraphicsOpenGL)between a matchingpushMatrix()/popMatrix()pair, in place ofapply(PGraphicsOpenGL). Additional scene lights may be added after this call.- Parameters:
graphics- active scene render target
-
setInputEnabled
public void setInputEnabled(boolean enabled) Selects whether navigation input is routed to the scene camera.- Parameters:
enabled- true to enable scene-camera mouse input
-
setDistanceLimits
public void setDistanceLimits(float minimum, float maximum) Sets the allowed orbit-distance interval.- Parameters:
minimum- minimum distancemaximum- maximum distance
-
setCollapseGuard
public void setCollapseGuard(float guard) Sets the dead zone that prevents an orbit distance from collapsing through zero.- Parameters:
guard- non-negative dead-zone radius
-
setLerpFactor
public void setLerpFactor(float factor) Sets the interpolation amount used by programmatic camera movement.- Parameters:
factor- interpolation factor in the camera's supported range
-
setDragSensitivity
public void setDragSensitivity(float sensitivity) Sets direct pointer-drag sensitivity in radians per pixel.- Parameters:
sensitivity- non-negative drag sensitivity
-
snapToAxisAngle
public void snapToAxisAngle(float targetX, float targetY, float targetZ, float axisX, float axisY, float axisZ, float angle, float distance) Immediately applies a complete orbit pose expressed as an axis-angle rotation. This root-service convenience keeps ordinary Processing scenes independent from the advanced quaternion package while retaining the same qualified camera mathematics.- Parameters:
targetX- look-at target XtargetY- look-at target YtargetZ- look-at target ZaxisX- rotation-axis XaxisY- rotation-axis YaxisZ- rotation-axis Zangle- rotation angle in radiansdistance- orbit distance
-
trackTarget
Tracks a dynamic world-space target once after each scene update.The supplier runs on the Processing frame thread. Its vector is copied into the camera, so callers may safely reuse one mutable
PVectoras a no-allocation result buffer.- Parameters:
targetSupplier- non-null supplier of the latest target; anullresult skips that frame
-
clearTargetTracking
public void clearTargetTracking()Stops automatic target tracking without changing the current camera target. -
isTrackingTarget
public boolean isTrackingTarget()- Returns:
- whether a dynamic target supplier is configured
-