new AxWebGLShader()
Creates a new graphics device shader
This constructor shouldn't be called explicity, but instead the graphics device should create its shader
- Source:
Methods
(static) AxMatrixToGLUniform(axMatrix, glUniform, offset)
Private
Translates data from a AxMatrix to a GLUniform
Parameters:
Name | Type | Description |
---|---|---|
axMatrix |
AxMatrix | The input matrix whose data is to be translated to the GL uniform |
glUniform |
Float32Array | The GL uniform, where the matrix' data is to be translated |
offset |
Integer | The offset in matrix elements, at which the translation to the GL uniform should start |
- Source:
(static) AxVector3ToGLUniform(axVector3, glUniform, offset)
Private
Translates data from a AxVector3 to a GLUniform
Parameters:
Name | Type | Description |
---|---|---|
axVector3 |
AxVector3 | The input vector whose data is to be translated to the GL uniform |
glUniform |
Float32Array | The GL uniform, where the vector's data is to be translated |
offset |
Integer | The offset in vector elements, at which the translation to the GL uniform should start |
- Source:
(static) AxVector4ToGLUniform(axVector4, glUniform, offset)
Private
Translates data from a AxVector4 to a GLUniform
Parameters:
Name | Type | Description |
---|---|---|
axVector4 |
AxVector4 | The input vector whose data is to be translated to the GL uniform |
glUniform |
Float32Array | The GL uniform, where the vector's data is to be translated |
offset |
Integer | The offset in vector elements, at which the translation to the GL uniform should start |
- Source:
AddOperation(shadingOp, colorOp)
Adds an operation to the shader
Parameters:
Name | Type | Description |
---|---|---|
shadingOp |
AxShadingOperation | Type of shader to add |
colorOp |
AxColorOperation | Type of color operation |
- Source:
ClearOperations()
Clears all operation from the shader
- Source:
CompileShader(vertexShaderCode, pixelShaderCode) → {Boolean}
Private
Compiles a vertex shader and a pixel shader
Parameters:
Name | Type | Description |
---|---|---|
vertexShaderCode |
String | Source code of the vertex shader |
pixelShaderCode |
String | Source code of the pixel shader |
- Source:
Returns:
True if compilation was successful. If unsuccessful, returns false and stores the error in compilationMessage
- Type
- Boolean
GetOperation(index, shadingOp, colorOp)
Gets an existing operation's parameters
Parameters:
Name | Type | Description |
---|---|---|
index |
Integer | Index of an existing operation to be set |
shadingOp |
AxShadingOperation | Returned type of shading operation. Returns as wrapped in an object |
colorOp |
AxColorOperation | Returned type of color operation. Returns as wrapped in an object |
- Source:
GetOperationCount() → {Integer}
Gets the number of operations the shader has
- Source:
Returns:
The number of operations the shader has
- Type
- Integer
GetParameterAddress(parameterName) → {Integer}
Gets the address of a paramter of the shader
Parameters:
Name | Type | Description |
---|---|---|
parameterName |
AxString | Name of the parameter to get address for |
- Source:
Returns:
Address of the parameter with the given name
- Type
- Integer
IndexOf(shadingOp) → {Integer}
Private
Gets the first index of occurence of the given shading operation
Parameters:
Name | Type | Description |
---|---|---|
shadingOp |
AxShadingOperation | The operation for which to search |
- Source:
Returns:
The index at which the given operation was found in the shading operations collection. If not found, returns -1
- Type
- Integer
Release()
Release any resources allocated by the device
- Source:
SetFakeParameter(address, index, value) → {Boolean}
Sets a fake parameter and returns whether succeeded
Fake parameters are such paramters that do not actually exist in the shader program and/or need some special treatment instead of just being set straight to the program
The reason of having fake parameters is usually for when a the specific graphics device can't directly match Axis' architecture. Also when there's a need to intercept when a parameter is passed
Parameters:
Name | Type | Description |
---|---|---|
address |
Integer | Address of the parameter whose value is to be set |
index |
Integer | For indexed parameters, the index to set. For regular paramters should be 0 |
value |
Object | Value to set to the parameter at the given address and index |
- Source:
Returns:
True if the parameter was successfully set.
- Type
- Boolean
SetOperation(index, shadingOp, colorOp)
Sets an existing operation's parameters
Parameters:
Name | Type | Description |
---|---|---|
index |
Integer | Index of an existing operation to be set |
shadingOp |
AxShadingOperation | Type of shader to add |
colorOp |
AxColorOperation | Type of color operation |
- Source:
SetParameter(address, index, value)
Sets a value to a parameter at the given address at a given index
Parameters:
Name | Type | Description |
---|---|---|
address |
Integer | Address of the parameter whose value is to be set |
index |
Integer | For indexed parameters, the index to set. For regular paramters should be 0 |
value |
Object | Value to set to the parameter at the given address and index |
- Source:
Update(compilationMessage) → {Boolean}
Updates the shader according to its shading operations
Parameters:
Name | Type | Description |
---|---|---|
compilationMessage |
AxString | Returned message from the update |
- Source:
Returns:
True if the update was successful. If the update was unsuccessful, returns true and an error should generally be returned in compliationMessage
- Type
- Boolean