public final class VRCameraRig

  1. Object
  2. VRCameraRig
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.

Constructors

public VRCameraRig(VRSettings settings)Creates a rig with the supplied settings.

Methods

public VRSettings getSettings()The settings this rig was created with.
public void setPosition(float x, float y, float z)Sets the head center position in world space.
public void setOrientation(float[] quat4)Sets the head orientation as an {x, y, z, w} quaternion rotating head-local vectors into world space.
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.

Inherited methods

Constructor details

VRCameraRig

public VRCameraRig(VRSettings settings)
Creates a rig with the supplied settings.

Parameters

settings VRSettings
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 Camera
the camera to configure
eye VREye
which eye to compute
aspect float
the per-eye viewport aspect ratio (width / height)