Google cardBoard Android API (七):Eye

18 篇文章 0 订阅
18 篇文章 0 订阅
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)

Public Methods

float[]
FieldOfView
getFov()
float[]
getPerspective(float zNear, float zFar)
boolean
int
Viewport
void

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.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值