Compositor
class Compositor
A base Compositor object.
Constructor
new Compositor(renderer: WebGLRenderer, settings: object) → {}
Name | Type | Description |
---|---|---|
renderer | WebGLRenderer |
the current WebGL renderer session |
settings | object |
additional settings to initialize this compositors |
settings.attribute | Array<object> |
an array of attributes definition |
settings.attribute.name | string |
name of the attribute in the vertex shader |
settings.attribute.size | number |
number of components per vertex attribute. Must be 1, 2, 3, or 4. |
settings.attribute.type | GLenum |
data type of each component in the array |
settings.attribute.normalized | boolean |
whether integer data values should be normalized into a certain range when being cast to a float |
settings.attribute.offset | number |
offset in bytes of the first component in the vertex attribute array |
settings.shader | object |
an array of attributes definition |
settings.shader.vertex | string |
a string containing the GLSL source code to set |
settings.shader.fragment | string |
a string containing the GLSL source code to set |
Summary
Properties from Compositor
Array<Object> |
|
GLShader |
|
GLShader |
|
number |
|
number |
|
VertexArrayBuffer |
|
number |
|
Methods from Compositor
|
|
called by the WebGL renderer when a compositor become the current one |
|
|
|
|
|
|
Public Properties
attributes: Array<Object>
Array<Object>
an array of vertex attribute properties
currentShader: GLShader
GLShader
the shader currently used by this compositor
defaultShader: GLShader
GLShader
the default shader created by this compositor
mode: number = gl.TRIANGLES
number
primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
vertexByteSize: number = 0
number
the size of a single vertex in bytes (will automatically be calculated as attributes definitions are added)
vertexData: VertexArrayBuffer = undefined
VertexArrayBuffer
the vertex data buffer used by this compositor
vertexSize: number = 0
number
the size of a single vertex in floats (will automatically be calculated as attributes definitions are added)
Public Methods
addAttribute(name: string, size: number, type: GLenum, normalized: boolean, offset: number) → {}
add vertex attribute property definition to the compositor
Name | Type | Description |
---|---|---|
name | string |
name of the attribute in the vertex shader |
size | number |
number of components per vertex attribute. Must be 1, 2, 3, or 4. |
type | GLenum |
data type of each component in the array |
normalized | boolean |
whether integer data values should be normalized into a certain range when being cast to a float |
offset | number |
offset in bytes of the first component in the vertex attribute array |
bind() → {}
called by the WebGL renderer when a compositor become the current one
flush(mode: number) → {}
Flush batched vertex data to the GPU
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mode | number |
<optional> |
gl.TRIANGLES |
the GL drawing mode |
setProjection(matrix: Matrix3d) → {}
set/change the current projection matrix
Name | Type | Description |
---|---|---|
matrix | Matrix3d |
the new projection matrix |
useShader(shader: GLShader) → {}
Select the shader to use for compositing
Name | Type | Description |
---|---|---|
shader | GLShader |
a reference to a GLShader instance |