Eye

public class Eye

Describes the stereoscopic rendering details of an eye.

Nested Classes

class Eye.Type Defines the constants identifying the current eye type. 

Public Constructors

Eye(int type)
Creates a new set of eye parameters.

Public Methods

float[]
getEyeView()
Returns a matrix that transforms from the camera to the current eye.
FieldOfView
getFov()
Returns the field of view for this eye.
float[]
getPerspective(float zNear, float zFar)
Convenience method that returns the perspective projection matrix for this eye.
boolean
getProjectionChanged()
Whether the projection matrix is stale and should be recomputed.
int
getType()
Returns the eye type this object refers to.
Viewport
getViewport()
Returns the viewport for this eye.
void
setProjectionChanged()
Forces to clean up any cached projection matrices.

Inherited Methods

Public Constructors

public Eye (int type)

Creates a new set of eye parameters.

Parameters
type One of the Eye.Type constants describing the eye this object refers to. Behavior is undefined if an invalid eye constant is provided.

Public Methods

public float[] getEyeView ()

Returns a matrix that transforms from the camera to the current eye.

This matrix should premultiply the camera matrix.

Assumes a scale of 1 world unit = 1 meter when applying the interpupillary distance. If this not your case, make sure to call android.opengl.Matrix.scaleM on this matrix to correct it.

The transformation includes head tracking rotation, position shift and interpupillary distance shift. Use this if you just want to get an eye view from your normal view.

Returns
  • A 4x4 column-major representing the transformation from the camera to this eye.

public FieldOfView getFov ()

Returns the field of view for this eye.

Use the getFov().toPerspectiveMatrix method to generate the appropriate perspective projection matrix to use.

Returns
  • The field of view for this eye.

public float[] getPerspective (float zNear, float zFar)

Convenience method that returns the perspective projection matrix for this eye.

Calls getFov().toPerspectiveMatrix to generate the perspective matrix to use.

Parameters
zNear Near Z plane to use in the projection.
zFar Far Z plane to use in the projection.
Returns
  • A 4x4 column-major matrix representing the perspective projection for this eye.

public boolean getProjectionChanged ()

Whether the projection matrix is stale and should be recomputed.

Returns
  • true if projection matrix is stale, false otherwise

public int getType ()

Returns the eye type this object refers to.

Returns
  • The current eye as one of the Eye.Type constants.

public Viewport getViewport ()

Returns the viewport for this eye.

Returns
  • Viewport to use when rendering this eye.

public void setProjectionChanged ()

Forces to clean up any cached projection matrices.

Called by the framework when projection parameters change between frames. Should be called if the eye's field of view object returned by getFov() is changed.