Class VRCameraRig

java.lang.Object
com.codename1.vr.VRCameraRig

public final class VRCameraRig extends Object
Computes per-eye cameras for stereo rendering: a head position and orientation plus a VRSettings interpupillary distance yield a com.codename1.gpu.Camera per VREye. Pure math over the existing gpu camera; usable from any thread that owns the target camera.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a rig with the supplied settings.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(Camera out, VREye eye, float aspect)
    Configures out as the camera for the supplied eye: positioned at the head center offset by half the interpupillary distance along the head's right vector, looking along the head's forward vector.
    The settings this rig was created with.
    void
    setOrientation(float[] quat4)
    Sets the head orientation as an {x, y, z, w} quaternion rotating head-local vectors into world space.
    void
    setPosition(float x, float y, float z)
    Sets the head center position in world space.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VRCameraRig

      public VRCameraRig(VRSettings settings)

      Creates a rig with the supplied settings.

      Parameters
      • settings: the eye separation and lens parameters
  • Method Details

    • getSettings

      public VRSettings getSettings()
      The settings this rig was created with.
    • setPosition

      public void setPosition(float x, float y, float z)
      Sets the head center position in world space.
    • setOrientation

      public void setOrientation(float[] quat4)
      Sets the head orientation as an {x, y, z, w} quaternion rotating head-local vectors into world space.
    • apply

      public void apply(Camera out, VREye eye, float aspect)

      Configures out as the camera for the supplied eye: positioned at the head center offset by half the interpupillary distance along the head's right vector, looking along the head's forward vector.

      Parameters
      • out: the camera to configure

      • eye: which eye to compute

      • aspect: the per-eye viewport aspect ratio (width / height)