Constructor
new Shader(name, shaderDefinition)
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
Shader name (mostly for debug/tool use) |
shaderDefinition |
ShaderDefinition |
Shader data |
Classes
Members
attributeIndexMapping :Object.<string, number>
Maps attribute variable's name to attribute location (from getAttribLocation).
attributeMapping :Object.<string, object>
Attributes detected in the shader source code.
Maps attribute variable's name to {format: string}
name :string
The shader name
renderer :WebGLRenderingContext
The renderer where the program and shaders were allocated.
renderQueue :number
Determines the order in which an object is drawn. There are four pre-defined render queues:
- RenderQueue.BACKGROUND = Rendered before any other objects. Commonly used for skyboxes and the likes
(0-999)
- RenderQueue.OPAQUE = Used for most objects, typically opaque geometry. Rendered front to back
(1000-1999)
- RenderQueue.TRANSPARENT = For all alpha-blended objects. Rendered back to front (2000-2999)
- RenderQueue.OVERLAY = For overlay effects like lens-flares etc (3000+)
By default materials use the render queue of the shader. See RenderQueue for more info
textureSlots :Array
Texture slots detected in the shader source code.
Will be an array of {format: string, name: string}
uniformBufferDataBlocks
List of uniform blocks.
uniformCallMapping :Object.<string, ShaderCall>
Maps uniform variable name to ShaderCall object.
uniformMapping :Object.<string, object>
Uniforms detected in the shader source code.
Maps variable name to {format: string}
.
Methods
(static) investigateShader(source, target)
Extract shader variable definitions from shader source code.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
source |
string |
The source code. |
||||||||||||
target |
Object |
Properties
|
InitializeFromObject(name, shaderDefinition)
Initializes the shader using shader definition and shader name
Moved to its own init function in case of loading from file and deferring the initialization
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
Shader name (mostly for debug/tool use) or contains the name of shader file if a file is given |
shaderDefinition |
ShaderDefinition |
Shader data
|