class FlxRuntimeShader
package flixel.addons.display
extends FlxGraphicsShader › GraphicsShader › Shader
extended by AdjustColorShader, BlendModesShader, GaussianBlurShader, Grayscale, HSVShader, InverseDotsShader, MosaicEffect, PuddleShader, RuntimePostEffectShader, WiggleEffectRuntime, ScriptedFlxRuntimeShader
Available on all platforms
An wrapper for Flixel/OpenFL's shaders, which takes fragment and vertex source in the constructor instead of using macros, so it can be provided data at runtime (for example, when using mods).
HOW TO USE:
1. Create an instance of this class, passing the text of the .frag and .vert files.
Note that you can set either of these to null (making them both null would make the shader do nothing???).
2. Use flxSprite.shader = runtimeShader to apply the shader to the sprite.
3. Use runtimeShader.setFloat(), setBool() etc. to modify any uniforms.
4. Use setBitmapData() to add additional textures as sampler2D uniforms
See also:
Constructor
new(?fragmentSource:String, ?vertexSource:String, ?glslVersion:String)
Constructs a GLSL shader.
Parameters:
fragmentSource | The fragment shader source. |
|---|---|
vertexSource | The vertex shader source.
Note you also need to |
Methods
getBitmapData(name:String):Null<BitmapData>
Retrieve a bitmap data parameter of the shader.
Parameters:
name | The name of the parameter to retrieve. |
|---|
Returns:
The value of the parameter.
getBool(name:String):Null<Bool>
Retrieve a boolean parameter of the shader.
Parameters:
name | The name of the parameter to retrieve. |
|---|
Returns:
The value of the parameter.
getBoolArray(name:String):Null<Array<Bool>>
Retrieve a boolean array parameter of the shader.
Parameters:
name | The name of the parameter to retrieve. |
|---|
Returns:
The value of the parameter.
getFloat(name:String):Null<Float>
Retrieve a float parameter of the shader.
Parameters:
name | The name of the parameter to retrieve. |
|---|
Returns:
The value of the parameter.
getFloatArray(name:String):Null<Array<Float>>
Retrieve a float array parameter of the shader.
Parameters:
name | The name of the parameter to retrieve. |
|---|
Returns:
The value of the parameter.
getInt(name:String):Null<Int>
Retrieve an integer parameter of the shader.
Parameters:
name | The name of the parameter to retrieve. |
|---|
Returns:
The value of the parameter.
getIntArray(name:String):Null<Array<Int>>
Retrieve an integer array parameter of the shader.
Parameters:
name | The name of the parameter to retrieve. |
|---|
Returns:
The value of the parameter.
setBitmapData(name:String, value:BitmapData):Void
Modify a bitmap data parameter of the shader.
Parameters:
name | The name of the parameter to modify. |
|---|---|
value | The new value to use. |
setBool(name:String, value:Bool):Void
Modify a boolean parameter of the shader.
Parameters:
name | The name of the parameter to modify. |
|---|---|
value | The new value to use. |
setBoolArray(name:String, value:Array<Bool>):Void
Modify a boolean array parameter of the shader.
Parameters:
name | The name of the parameter to modify. |
|---|---|
value | The new value to use. |
setFloat(name:String, value:Float):Void
Modify a float parameter of the shader.
Parameters:
name | The name of the parameter to modify. |
|---|---|
value | The new value to use. |
setFloatArray(name:String, value:Array<Float>):Void
Modify a float array parameter of the shader.
Parameters:
name | The name of the parameter to modify. |
|---|---|
value | The new value to use. |
setInt(name:String, value:Int):Void
Modify an integer parameter of the shader.
Parameters:
name | The name of the parameter to modify. |
|---|---|
value | The new value to use. |
setIntArray(name:String, value:Array<Int>):Void
Modify an integer array parameter of the shader.
Parameters:
name | The name of the parameter to modify. |
|---|---|
value | The new value to use. |