Class SceneCameraService

java.lang.Object
com.victorvalentim.zividomelive.SceneCameraService

public final class SceneCameraService extends Object
Activation-scoped access to the shared scene-space orbit camera.

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 Type
    Method
    Description
    void
    apply(processing.opengl.PGraphicsOpenGL graphics)
    Applies the shared scene-camera transform to an open render target.
    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.
    void
    Stops automatic target tracking without changing the current camera target.
    boolean
     
     
    void
    setCollapseGuard(float guard)
    Sets the dead zone that prevents an orbit distance from collapsing through zero.
    void
    setDistanceLimits(float minimum, float maximum)
    Sets the allowed orbit-distance interval.
    void
    setDragSensitivity(float sensitivity)
    Sets direct pointer-drag sensitivity in radians per pixel.
    void
    setInputEnabled(boolean enabled)
    Selects whether navigation input is routed to the scene camera.
    void
    setLerpFactor(float factor)
    Sets the interpolation amount used by programmatic camera movement.
    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.
    void
    trackTarget(Supplier<processing.core.PVector> targetSupplier)
    Tracks a dynamic world-space target once after each scene update.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • orbit

      public OrbitCamera orbit()
      Returns:
      shared scene-space orbit camera; never null during the activation
    • apply

      public void apply(processing.opengl.PGraphicsOpenGL graphics)
      Applies the shared scene-camera transform to an open render target. Call from Scene.sceneRender(PGraphicsOpenGL) between a matching pushMatrix()/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 matching pushMatrix()/popMatrix() pair, in place of apply(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 distance
      maximum - 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 X
      targetY - look-at target Y
      targetZ - look-at target Z
      axisX - rotation-axis X
      axisY - rotation-axis Y
      axisZ - rotation-axis Z
      angle - rotation angle in radians
      distance - orbit distance
    • trackTarget

      public void trackTarget(Supplier<processing.core.PVector> targetSupplier)
      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 PVector as a no-allocation result buffer.

      Parameters:
      targetSupplier - non-null supplier of the latest target; a null result 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