public classCardboardDeviceParams

Defines the physical parameters of a Cardboard-compatible device.

The model assumes the following for any Cardboard device:

  1. Lenses are parallel to the screen of the inserted device.
  2. The center of each lens is at the same height from the bottom of the inserted device.
  3. Lenses are symmetrically placed with respect to the center of the inserted device screen.
  4. The size of the area visible from the center of each lens is the same.

These parameters might be different for variations of different devices or lenses. For simplicity, they can be stored in the NFC tag of the Cardboard.

Nested Classes

enum CardboardDeviceParams.VerticalAlignmentType Enum indicating the strategy for aligning the phone display vertically with respect to center of the lenses.

Public Constructors

CardboardDeviceParams()
CardboardDeviceParams( CardboardDeviceParamsparams)

Public Methods

staticCardboardDeviceParams cardboardV1DeviceParams()
staticCardboardDeviceParams createFromInputStream(InputStreaminputStream)
staticCardboardDeviceParams createFromNfcContents(NdefMessage tagContents)
staticCardboardDeviceParams createFromUri(Uri uri)
boolean equals(Objectother)
Distortion getDistortion()
boolean getHasMagnet()
float getInterLensDistance()
FieldOfView getLeftEyeMaxFov()
String getModel()
float getScreenToLensDistance()
String getVendor()
CardboardDeviceParams.VerticalAlignmentType getVerticalAlignment()
float getVerticalDistanceToLensCenter()
static boolean isCardboardUri(Uri uri)
boolean isDefault()
void setHasMagnet(boolean magnet)
void setInterLensDistance(float interLensDistance)
void setModel(Stringmodel)
void setScreenToLensDistance(float screenToLensDistance)
void setVendor(Stringvendor)
void setVerticalAlignment(CardboardDeviceParams.VerticalAlignmentTypeverticalAlignment)
void setVerticalDistanceToLensCenter(float verticalDistanceToLensCenter)
String toString()
Uri toUri()
boolean writeToOutputStream(OutputStreamoutputStream)

Inherited Methods

From class java.lang.Object

Public Constructors

publicCardboardDeviceParams()

Initializes Cardboard device parameters to default values for Cardboard v2.

Consider using HeadMountedDisplayManagerto access Cardboard devices parameters more optimized for your headset.

publicCardboardDeviceParams(CardboardDeviceParamsparams)

Creates a copy of an existing device params object.

Parameters
params Device parameters to copy.

Public Methods

public staticCardboardDeviceParamscardboardV1DeviceParams()

Sets parameters to Cardboard v1.0.0

public staticCardboardDeviceParamscreateFromInputStream(InputStreaminputStream)

Initializes the physical parameters of a Cardboard device from anInputStream.

Caller is responsible for closing stream.

Parameters
inputStream input stream containing device params.
Returns
  • A new Cardboard device parameters object ornullin case of error.

public staticCardboardDeviceParamscreateFromNfcContents(NdefMessage tagContents)

Initializes physical parameters from the contents of a Cardboard NFC tag.

Parameters
tagContents Contents of the Cardboard NFC tag.
Returns
  • A new Cardboard device parameters object ornullin case of error.

public staticCardboardDeviceParamscreateFromUri(Uri uri)

Initializes the physical parameters of a Cardboard device from a Uri.

Parameters
uri Uri to read the parameters from.
Returns
  • A new Cardboard device parameters object ornullin case of error.

public booleanequals(Objectother)

Compares this instance with the specified object and indicates if they are equal.

Parameters
other The object to compare this instance with.
Returns
  • trueif the objects are equal,falseotherwise.

publicDistortiongetDistortion()

Returns the lens distortion model.

Returns
  • The lens distortion model.

public booleangetHasMagnet()

Returns whether or not the cardboard device has a magnet.

Returns
  • True if a magnet exists, false otherwise.

public floatgetInterLensDistance()

Returns the inter lens distance for the device.

Returns
  • The inter lens distance in meters.

publicFieldOfViewgetLeftEyeMaxFov()

Returns the left eye's maximum field of view visible through the lens. The actual rendered field of view will be limited by this and also by the size of the screen. When rendering, a mirrored field of view is expected to be applied to the right eye.

Returns
  • The left eye's maximum field of view.

publicStringgetModel()

Returns the device model string.

Returns
  • A string identifying the device model.

public floatgetScreenToLensDistance()

Returns the screen to lens distance in meters.

Returns
  • The screen to lens distance in meters.

publicStringgetVendor()

Returns the device vendor string.

Returns
  • A string identifying the device vendor.

publicCardboardDeviceParams.VerticalAlignmentTypegetVerticalAlignment()

Get the vertical alignment strategy.

public floatgetVerticalDistanceToLensCenter()

Returns the vertical distance to the lens center.

Returns
  • The vertical distance to the lens center from the bottom or top edge of the inserted device, measured in meters.

public static booleanisCardboardUri(Uri uri)

Return true if given URI identifies a Cardboard device.

public booleanisDefault()

public voidsetHasMagnet(boolean magnet)

Sets whether this cardboard device has a magnet.

public voidsetInterLensDistance(float interLensDistance)

Sets the inter lens distance of the device.

Parameters
interLensDistance The distance between the center of each lens in meters.

public voidsetModel(Stringmodel)

Sets the device model string.

Parameters
model The device model string to set.

public voidsetScreenToLensDistance(float screenToLensDistance)

Sets the distance from the screen to the optical center of the lens.

This value impacts the the scale applied when rendering.

Parameters
screenToLensDistance The screen to lens distance in meters.

public voidsetVendor(Stringvendor)

Sets the device vendor string.

Parameters
vendor The vendor string to set.

public voidsetVerticalAlignment(CardboardDeviceParams.VerticalAlignmentTypeverticalAlignment)

Set the vertical alignment strategy.

public voidsetVerticalDistanceToLensCenter(float verticalDistanceToLensCenter)

Sets the vertical distance to the lens center.

Parameters
verticalDistanceToLensCenter The vertical distance from the center of the lenses to the bottom or top edge of the inserted device. Measured in meters.

publicStringtoString()

Returns a string containing a concise, human-readable description of this object.

Returns
  • A printable representation of this object.

public UritoUri()

Encodes the current Cardboard device parameters into a Uri.

The returned Uri can be written into the Cardboard NFC tag, a file, or encoded in a QR code.

Additional extra parameters can be added to the returned URL by using theUri.buildUpon()andUri.Builder.appendQueryParameter(key, value)methods. The parameter key name URI_KEY_PARAMS is reserved.

Returns
  • A Uri encoding the current Cardboard device parameters.

public booleanwriteToOutputStream(OutputStreamoutputStream)

Attempts to write the parameters into the given output stream.

Caller is responsible for closing stream.

Parameters
outputStream OutputStream in which the parameters are stored.
Returns
  • whether the parameters were successfully written.

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android动画学习笔记-Android Animation
  2. android 开启Https单向认证
  3. textview设置文本每行的行间距
  4. Android如何设置TextView的行间距、行高
  5. Eclipse安装Android教程
  6. Launcher研究资料收集(3)--.LauncherAppl
  7. [转]Android 技术专题系列之九 -- 图形系统
  8. 如何使用Android Studio开发/调试Android
  9. Android 3D引擎汇总
  10. android中的格式化字符串