Implements a model view projection matrices. Pipelines can implement this for doing 2D and 3D rendering.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 7)
Members
-
<nullable> modelMatrix :Float32Array
-
Model matrix
Type:
- Float32Array
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 43)
-
modelMatrixDirty :boolean
-
Dirty flag for checking if model matrix needs to be updated on GPU.
Type:
- boolean
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 16)
-
<nullable> projectionMatrix :Float32Array
-
Projection matrix
Type:
- Float32Array
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 61)
-
projectionMatrixDirty :boolean
-
Dirty flag for checking if projection matrix needs to be updated on GPU.
Type:
- boolean
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 34)
-
<nullable> viewMatrix :Float32Array
-
View matrix
Type:
- Float32Array
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 52)
-
viewMatrixDirty :boolean
-
Dirty flag for checking if view matrix needs to be updated on GPU.
Type:
- boolean
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 25)
Methods
-
modelIdentity()
-
Loads an identity matrix to the model matrix
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 137)
-
modelRotateX(radians)
-
Rotates the model matrix in the X axis.
Parameters:
Name Type Description radians
number The amount to rotate by.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 229)
Returns:
This Model View Projection.
-
modelRotateY(radians)
-
Rotates the model matrix in the Y axis.
Parameters:
Name Type Description radians
number The amount to rotate by.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 267)
Returns:
This Model View Projection.
-
modelRotateZ(radians)
-
Rotates the model matrix in the Z axis.
Parameters:
Name Type Description radians
number The amount to rotate by.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 305)
Returns:
This Model View Projection.
-
modelScale(x, y, z)
-
Scale model matrix
Parameters:
Name Type Description x
number The x component.
y
number The y component.
z
number The z component.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 169)
Returns:
This Model View Projection.
-
modelTranslate(x, y, z)
-
Translate model matrix
Parameters:
Name Type Description x
number The x component.
y
number The y component.
z
number The z component.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 203)
Returns:
This Model View Projection.
-
mvpInit()
-
Initializes MVP matrices with an identity matrix
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 70)
-
mvpUpdate()
-
If dirty flags are set then the matrices are uploaded to the GPU.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 106)
-
projIdentity()
-
Loads identity matrix into the projection matrix.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 624)
Returns:
This Model View Projection.
-
projOrtho(left, right, bottom, top, near, far)
-
Sets up an orthographic projection matrix
Parameters:
Name Type Description left
number The left value.
right
number The right value.
bottom
number The bottom value.
top
number The top value.
near
number The near value.
far
number The far value.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 658)
Returns:
This Model View Projection.
-
projPersp(fovY, aspectRatio, near, far)
-
Sets up a perspective projection matrix
Parameters:
Name Type Description fovY
number The fov value.
aspectRatio
number The aspectRatio value.
near
number The near value.
far
number The far value.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 702)
Returns:
This Model View Projection.
-
viewIdentity()
-
Loads identity matrix into the view matrix
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 343)
Returns:
This Model View Projection.
-
viewLoad(matrix)
-
Copies a 4x4 matrix into the view matrix
Parameters:
Name Type Description matrix
Float32Array The Matrix2D.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 588)
Returns:
This Model View Projection.
-
viewLoad2D(matrix2D)
-
Loads a 2D view matrix (3x2 matrix) into a 4x4 view matrix
Parameters:
Name Type Description matrix2D
Float32Array The Matrix2D.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 551)
Returns:
This Model View Projection.
-
viewRotateX(radians)
-
Rotates view matrix in the X axis.
Parameters:
Name Type Description radians
number The amount to rotate by.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 437)
Returns:
This Model View Projection.
-
viewRotateY(radians)
-
Rotates view matrix in the Y axis.
Parameters:
Name Type Description radians
number The amount to rotate by.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 475)
Returns:
This Model View Projection.
-
viewRotateZ(radians)
-
Rotates view matrix in the Z axis.
Parameters:
Name Type Description radians
number The amount to rotate by.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 513)
Returns:
This Model View Projection.
-
viewScale(x, y, z)
-
Scales view matrix
Parameters:
Name Type Description x
number The x component.
y
number The y component.
z
number The z component.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 377)
Returns:
This Model View Projection.
-
viewTranslate(x, y, z)
-
Translates view matrix
Parameters:
Name Type Description x
number The x component.
y
number The y component.
z
number The z component.
- Since: 3.0.0
- Source: src/renderer/webgl/pipelines/components/ModelViewProjection.js (Line 411)
Returns:
This Model View Projection.