Psych Engine Logo
Psych Engine - Lua Script API

Shaders Functions

Functions to add Shaders to sprites and change their properties.


initLuaShader

initLuaShader(name:String, ?glslVersion:Int = 120):Bool

Preloads a Shader .vert/.frag inside "shaders/" folder, might be good for intensive shaders but it's generally not needed.
Returns "true" if the operation was successful.

Examples:


setSpriteShader

setSpriteShader(tag:String, shaderName:String):Bool

Sets a Sprite's Shader to a .frag/.vert file inside "shaders/" folder.
Returns "true" if the operation was successful.

Examples:


removeSpriteShader

removeSpriteShader(tag:String):Bool

Sets a Sprite's Shader to a .frag/.vert file inside "shaders/" folder.
Returns "true" if the operation was successful.

Examples:


getShaderBool

getShaderBool(tag:String, prop:String):Bool

Returns an "uniform bool" shader variable's value.

Examples:


getShaderBoolArray

getShaderBoolArray(tag:String, prop:String):Array<Bool>

Returns an "uniform bool" shader variable's array values.


getShaderInt

getShaderInt(tag:String, prop:String):Int

Returns an "uniform int" shader variable's value.


getShaderIntArray

getShaderIntArray(tag:String, prop:String):Array<Int>

Returns an "uniform int" shader variable's array values.


getShaderFloat

getShaderFloat(tag:String, prop:String):Float

Returns an "uniform float" shader variable's value.


getShaderFloatArray

getShaderFloatArray(tag:String, prop:String):Array<Float>

Returns an "uniform float", "uniform vec2", "uniform vec3" or "uniform vec4" shader variable's array values.


setShaderBool

setShaderBool(tag:String, prop:String, value:Bool):Bool

Sets an "uniform bool" shader variable's value.
Returns "true" if the operation was successful.

Examples:


setShaderBoolArray

setShaderBoolArray(tag:String, prop:String, value:Array<Bool>):Bool

Sets an "uniform bool" shader variable's array values.
Returns "true" if the operation was successful.

Examples:


setShaderInt

setShaderInt(tag:String, prop:String, value:Int):Bool

Sets an "uniform int" shader variable's value.
Returns "true" if the operation was successful.


setShaderIntArray

setShaderIntArray(tag:String, prop:String, value:Array<Int>):Bool

Sets an "uniform int" shader variable's array values.
Returns "true" if the operation was successful.


setShaderFloat

setShaderFloat(tag:String, prop:String, value:Float):Bool

Sets an "uniform float" shader variable's value.
Returns "true" if the operation was successful.


setShaderFloatArray

setShaderFloatArray(tag:String, prop:String, value:Array<Float>):Bool

Sets an "uniform float", "uniform vec2", "uniform vec3" or "uniform vec4" shader variable's array values.
Returns "true" if the operation was successful.


setShaderSampler2D

setShaderFloat(tag:String, prop:String, bitmapPath:Float):Bool

Imports a Bitmap to an "uniform sampler2D" shader variable.
Returns "true" if the operation was successful.

Examples: