Difference between revisions of "Sprite:setShaderConstant"

From GiderosMobile
(3 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
<translate>To change the value of a uniform from lua</translate>
 
<translate>To change the value of a uniform from lua</translate>
 
<source lang="lua">
 
<source lang="lua">
  Sprite:setShaderConstant(uniform name,data type,mult,data)
+
  Sprite:setShaderConstant(uniformName,dataType,mult,data,programType,programVariant)
 
</source>
 
</source>
 +
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''uniform name''': (string) <translate>The uniform name to change</translate> <br/>
 
'''uniform name''': (string) <translate>The uniform name to change</translate> <br/>
Line 13: Line 14:
 
'''mult''': (number) <translate>number of elements of the given type to set</translate> <br/>
 
'''mult''': (number) <translate>number of elements of the given type to set</translate> <br/>
 
'''data''': (varies) <translate>And the actual data to set, either as a table or as multiple arguments</translate> <br/>
 
'''data''': (varies) <translate>And the actual data to set, either as a table or as multiple arguments</translate> <br/>
 +
'''program type''': (int) The type of program this constant applies to '''optional''' <br/>
 +
'''program variant''': (int) The variant of program this constant applies to '''optional''' <br/>
 +
{{Sprite}}

Revision as of 06:21, 31 December 2020


Available since: Gideros 2017.4
Class: Sprite

Description

To change the value of a uniform from lua

 Sprite:setShaderConstant(uniformName,dataType,mult,data,programType,programVariant)

Parameters

uniform name: (string) The uniform name to change
data type: (int) The type if data to set (one of the Shader.Cxxx constants)
mult: (number) number of elements of the given type to set
data: (varies) And the actual data to set, either as a table or as multiple arguments
program type: (int) The type of program this constant applies to optional
program variant: (int) The variant of program this constant applies to optional