Compositor

class Compositor

A base Compositor object.

Constructor


new Compositor(renderer: WebGLRenderer, settings: object) → {}
Parameters:
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

Public Properties


attributes compositor.js:62
attributes: Array<Object>

Array<Object>

an array of vertex attribute properties

See: WebGLCompositor.addAttribute
currentShader compositor.js:49
currentShader: GLShader

GLShader

the shader currently used by this compositor

defaultShader compositor.js:43
defaultShader: GLShader

GLShader

the default shader created by this compositor

mode compositor.js:55
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 compositor.js:69
vertexByteSize: number = 0

number

the size of a single vertex in bytes (will automatically be calculated as attributes definitions are added)

See: WebGLCompositor.addAttribute
vertexData compositor.js:85
vertexData: VertexArrayBuffer = undefined

VertexArrayBuffer

the vertex data buffer used by this compositor

vertexSize compositor.js:77
vertexSize: number = 0

number

the size of a single vertex in floats (will automatically be calculated as attributes definitions are added)

See: WebGLCompositor.addAttribute

Public Methods


addAttribute compositor.js:147
addAttribute(name: string, size: number, type: GLenum, normalized: boolean, offset: number) → {}

add vertex attribute property definition to the compositor

Parameters:
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 compositor.js:121
bind() → {}

called by the WebGL renderer when a compositor become the current one

flush compositor.js:200
flush(mode: number) → {}

Flush batched vertex data to the GPU

Parameters:
Name Type Attributes Default Description
mode number

<optional>

gl.TRIANGLES

the GL drawing mode

setProjection compositor.js:192
setProjection(matrix: Matrix3d) → {}

set/change the current projection matrix

Parameters:
Name Type Description
matrix Matrix3d

the new projection matrix

useShader compositor.js:130
useShader(shader: GLShader) → {}

Select the shader to use for compositing

Parameters:
Name Type Description
shader GLShader

a reference to a GLShader instance

See: GLShader

Powered by webdoc!