Module ncine.shaderstate
The table containing shader state related functions
Functions
Tables
shaderstateObj | The light user data of a shaderstate object |
Functions
- ncine.shaderstate.new (node, shader)
-
Constructs a shaderstate object and assigns to it a node and a shader.
Don’t forget to call delete when you are done with it!
Parameters:
- node ncine.drawable_node.drawablenodeObj
- shader ncine.shader.shaderObj
Returns:
-
shaderstateObj
A new shader object
- ncine.shaderstate.delete (shaderstate)
-
Destroys a shaderstate object and releases its memory
Parameters:
- shaderstate shaderstateObj The shaderstate object to be destroyed
- ncine.shaderstate.get_node (shaderstate)
-
Returns the drawable node affected by the shader state
Parameters:
- shaderstate shaderstateObj
Returns:
-
ncine.drawable_node.drawablenodeObj or nil
- ncine.shaderstate.set_node (shaderstate, node)
-
Sets the drawable node affected by the shader state
Parameters:
- shaderstate shaderstateObj
- node ncine.drawable_node.drawablenodeObj or nil
Returns:
-
boolean
True if the node has been changed
- ncine.shaderstate.get_shader (shaderstate)
-
Return the associated custom shader
Parameters:
- shaderstate shaderstateObj
Returns:
-
ncine.shader.shaderObj or nil
- ncine.shaderstate.set_shader (shaderstate, shader)
-
Sets the associated custom shader
Parameters:
- shaderstate shaderstateObj
- shader ncine.shader.shaderObj or nil
Returns:
-
boolean
True if the shader has been changed
- ncine.shaderstate.reset_shader (shaderstate)
-
Triggers a shader update without setting a new shader
Parameters:
- shaderstate shaderstateObj
- ncine.shaderstate.set_texture (shaderstate, unit, texture)
-
Assigns a texture to the specified texture unit
Parameters:
- shaderstate shaderstateObj
- unit integer
- texture ncine.texture.textureObj or nil
Returns:
-
boolean
True if the texture has been assigned
- ncine.shaderstate.set_uniform_int_vector (shaderstate, block_name, name, vector)
-
Sets an integer uniform with an array of values
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- vector integer[] An array of 1 to 4 integer elements
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_int_value1 (shaderstate, block_name, name, value0)
-
Sets an integer uniform with one value
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- value0 integer
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_int_value2 (shaderstate, block_name, name, value0, value1)
-
Sets an integer uniform with two values
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- value0 integer
- value1 integer
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_int_value3 (shaderstate, block_name, name, value0, value1, value2)
-
Sets an integer uniform with three values
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- value0 integer
- value1 integer
- value2 integer
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_int_value4 (shaderstate, block_name, name, value0, value1, value2, value3)
-
Sets an integer uniform with four values
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- value0 integer
- value1 integer
- value2 integer
- value3 integer
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_int_vector2 (shaderstate, block_name, name, vector)
-
Sets an integer uniform with a
ncine.vec2
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- vector ncine.vec2
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_int_vector3 (shaderstate, block_name, name, vector)
-
Sets an integer uniform with a
ncine.vec3
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- vector ncine.vec3
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_int_vector4 (shaderstate, block_name, name, vector)
-
Sets an integer uniform with a
ncine.vec4
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- vector ncine.vec4
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_float_vector (shaderstate, block_name, name, vector)
-
Sets a float uniform with an array of values
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- vector number[] An array of 1 to 4 float elements
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_float_value1 (shaderstate, block_name, name, value0)
-
Sets a float uniform with one value
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- value0 number
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_float_value2 (shaderstate, block_name, name, value0, value1)
-
Sets a float uniform with two values
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- value0 number
- value1 number
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_float_value3 (shaderstate, block_name, name, value0, value1, value2)
-
Sets a float uniform with three values
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- value0 number
- value1 number
- value2 number
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_float_value4 (shaderstate, block_name, name, value0, value1, value2, value3)
-
Sets a float uniform with four values
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- value0 number
- value1 number
- value2 number
- value3 number
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_float_vector2 (shaderstate, block_name, name, vector)
-
Sets a float uniform with a
ncine.vec2
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- vector ncine.vec2
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_float_vector3 (shaderstate, block_name, name, vector)
-
Sets a float uniform with a
ncine.vec3
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- vector ncine.vec3
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_float_vector4 (shaderstate, block_name, name, vector)
-
Sets a float uniform with a
ncine.vec4
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- vector ncine.vec4
Returns:
-
boolean
True if the uniform has been found and updated
- ncine.shaderstate.set_uniform_float_color (shaderstate, block_name, name, color)
-
Sets a float uniform with a
ncine.color
Parameters:
- shaderstate shaderstateObj
- block_name string It can be an empty string
- name string Uniform name
- color ncine.color
Returns:
-
boolean
True if the uniform has been found and updated