class FoxShader
package foxlite
Static variables
Static methods
staticcombine(shaderA:FoxShader, shaderB:FoxShader):FoxShader
Handy little function to combine different fragment and vertex programs from two different shaders into one without recompiling sources!
Note: since this shader uses programs from other shaders, destroy() won't delete the program on the GPU
and destroying shaderA or shaderB will cause issues when trying to use this shader
So make sure to use it carefully.
The result object contains the frag from shaderA and the vert from shaderB.
Constructor
Variables
finalattribIdx:{texCoord:Int, tangent:Int, position:Int, normal:Int, instanceData:{data2:Int, data1:Int, data0:Int, color:Int}, color:Int, boneWeight:Int, boneIndex:Int} = { position : -1, texCoord : -1, normal : -1, tangent : -1, color : -1, boneWeight : -1, boneIndex : -1, instanceData : { data0 : -1, data1 : -1, data2 : -1, color : -1 } }
__needsCompiling:Bool = false
When loading a shader, it won't be compiled right away, instead it will be compiled when needed for rendering. This should be set only once per shader.
This is required for async/threaded resource loading, as the programs fail to link when in a separate thread (I believe there's a fix to it but I don't know).
If any uniform is set while this flag is enabled, it will be saved uploaded to the GPU once the shader been compiled.
private__tmpMatrix:Float32Array = new Float32Array(16)
A temporary array to store matrix values, cached for speed
Methods
compile():Void
Compiles the shader. Used internally. Maybe one day it'll support async.
While the shader isn't compiled, no uniform should be set, else they will be lost.
recompile(?flags:Array<String>):Void
Recompiles this shader using the cached vert and frag sources.
Optionally you can provide a new shader flags array.
Note: If this shader is a combined shader (check combine() for details),
a new shader will be created and this will be marked as not combined.