Class: shaka.ui.VRWebgl

Constructor

new VRWebgl(videonon-null, playernon-null, canvasnon-null, gl, projectionMode, hfovopt)

Parameters:
Name Type Attributes Default Description
video HTMLMediaElement
player shaka.Player
canvas HTMLCanvasElement
gl WebGLRenderingContext
projectionMode string
hfov number <optional>
180 Horizontal field of view of the content, in degrees. Only used by the fisheye projection.
Implements:
Source:

Members

ANIMATION_DURATION_ :number

Type:
  • number
Source:

IDENTITY_MATRIX_ :Float32Array

Never modified.
Type:
  • Float32Array
Source:

MAX_FIELD_OF_VIEW :number

The maximum field of view, in degrees.
Type:
  • number
Source:

MIN_FIELD_OF_VIEW :number

The minimum field of view, in degrees.
Type:
  • number
Source:

canvas_ :HTMLCanvasElement

Type:
  • HTMLCanvasElement
Source:

cont_ :number

Type:
  • number
Source:

currentQuaternion_ :Float32Array

Type:
  • Float32Array
Source:

diff_ :Float32Array

Type:
  • Float32Array
Source:

fieldOfView_ :number

Type:
  • number
Source:

geometry_ :?{vertices: !Array<number>, textureCoords: !Array<number>, indices: !Array<number>}

Type:
  • ?{vertices: !Array<number>, textureCoords: !Array<number>, indices: !Array<number>}
Source:

gl_ :WebGLRenderingContext

Type:
  • WebGLRenderingContext
Source:

hfov_ :number

Type:
  • number
Source:

identityMatrix_ :Float32Array

Type:
  • Float32Array
Source:

initialForward_ :Array<number>

The direction of the initial view, used as the north.
Type:
  • Array<number>
Source:

modelViewMatrixUniform_ :WebGLUniformLocation

Type:
  • WebGLUniformLocation
Source:

originalQuaternion_ :Float32Array

Type:
  • Float32Array
Source:

positionX_ :number

Type:
  • number
Source:

positionY_ :number

Type:
  • number
Source:

previousCanvasHeight_ :number

Type:
  • number
Source:

previousCanvasWidth_ :number

Type:
  • number
Source:

projectionMatrix_ :Float32Array

Type:
  • Float32Array
Source:

projectionMatrixUniform_ :WebGLUniformLocation

Type:
  • WebGLUniformLocation
Source:

projectionMode_ :string

Type:
  • string
Source:

rotationMatrix_ :Float32Array

Reused by rotateViewGlobal, which runs for every pointer move and device orientation event.
Type:
  • Float32Array
Source:

samplerUniform_ :WebGLUniformLocation

Type:
  • WebGLUniformLocation
Source:

shaderProgram_ :WebGLProgram

Type:
  • WebGLProgram
Source:

stereoscopicMode_ :boolean

Type:
  • boolean
Source:

texture_ :WebGLTexture

Type:
  • WebGLTexture
Source:

textureCoordAttribute_ :number

Type:
  • number
Source:

vertexPositionAttribute_ :number

Type:
  • number
Source:

verticesBuffer_ :WebGLBuffer

Type:
  • WebGLBuffer
Source:

verticesIndexBuffer_ :WebGLBuffer

Type:
  • WebGLBuffer
Source:

verticesTextureCoordBuffer_ :WebGLBuffer

Type:
  • WebGLBuffer
Source:

video_ :HTMLVideoElement

Type:
  • HTMLVideoElement
Source:

viewMatrix_ :Float32Array

Type:
  • Float32Array
Source:

viewProjectionMatrix_ :Float32Array

Type:
  • Float32Array
Source:

vpMatrixUniform_ :WebGLUniformLocation

Type:
  • WebGLUniformLocation
Source:

Methods

getForward_(viewMatrixnon-null) → {Array<number>}

Parameters:
Name Type Description
viewMatrix Float32Array
Source:
Returns:
The direction the view looks at, in world coordinates.
Type
Array<number>

getAspectRatio_() → {number}

Returns the aspect ratio of the displayed viewport, so that the perspective projection does not stretch the image. The canvas is displayed at the size of the video container, so the client size is what the user sees. In stereoscopic mode each eye gets half of the width.
Source:
Returns:
Type
number

getCubeInsetU_() → {number}

Returns a horizontal inset of half a texel, so that the cube faces are not sampled at the exact edge they share with the adjacent face of the atlas. Otherwise the edges of the cube can become visible while moving the view.
Source:
Returns:
Type
number

getCubeInsetV_() → {number}

Returns a vertical inset of half a texel, see getCubeInsetU_.
Source:
Returns:
Type
number

getFieldOfView() → {number}

Source:
Returns:
Type
number

getGLShader_(glType) → {WebGLShader}

Read and generate WebGL shader
Parameters:
Name Type Description
glType number Type of shader requested.
Source:
Returns:
Type
WebGLShader

getHfov() → {number}

Source:
Returns:
Type
number

getNorth() → {number}

Source:
Returns:
Type
number

getProjectionMode() → {string}

Source:
Returns:
Type
string

init_()

Source:

initGL_()

Source:

initGLBuffers_()

Source:

initGLShaders_()

Source:

initGLTexture_()

Source:

initMatrices_()

Source:

isStereoscopicModeEnabled() → {boolean}

Returns true if stereoscopic mode is enabled.
Source:
Returns:
Type
boolean

release()

Request that this object release all internal references.
Implements:
Source:

renderGL_(textureUpdateopt)

Parameters:
Name Type Attributes Default Description
textureUpdate boolean <optional>
true
Source:

reset(firstTimeopt)

Parameters:
Name Type Attributes Default Description
firstTime boolean <optional>
true
Source:

rotateViewGlobal(yawnon-null, pitchnon-null, rollnon-null)

Rotate the view matrix global
Parameters:
Name Type Description
yaw number Yaw.
pitch number Pitch.
roll number Roll.
Source:

setFieldOfView(fieldOfView)

Parameters:
Name Type Description
fieldOfView number
Source:

setMatrixUniforms_()

Source:

toggleStereoscopicMode()

Toggle stereoscopic mode
Source:

updateViewPort_()

Source:

zoom(amount)

Parameters:
Name Type Description
amount number
Source: