Difference between revisions of "Sprite:setShaderConstant"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2017.4<br/>
'''<translate>Available since</translate>:''' Gideros 2017.4<br/>
+
'''Class:''' [[Sprite]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
+
 
=== <translate>Description</translate> ===
+
=== Description ===
<translate>To change the value of a uniform from lua</translate>
+
Changes the value of a uniform from lua.
 
<source lang="lua">
 
<source lang="lua">
Sprite:setShaderConstant(uniformName,dataType,mult,data,programType,programVariant)
+
Sprite:setShaderConstant(uniformName,dataType,mult,data,programType,programVariant)
 
</source>
 
</source>
  
=== <translate>Parameters</translate> ===
+
=== Parameters ===
'''uniform name''': (string) <translate>The uniform name to change</translate> <br/>
+
'''uniform name''': (string) the uniform name to change<br/>
'''data type''': (int) <translate>The type if data to set (one of the Shader.Cxxx constants)</translate> <br/>
+
'''data type''': (int) the type of data to set (one of the Shader.Cxxx constants)<br/>
'''mult''': (number) <translate>number of elements of the given type to set</translate> <br/>
+
'''mult''': (number) number of elements of the given type to set<br/>
'''data''': (varies) <translate>And the actual data to set, either as a table or as multiple arguments</translate> <br/>
+
'''data''': (varies) and the actual data to set, either as a table or as multiple arguments<br/>
'''program type''': (int) The type of program this constant applies to '''optional''' <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/>
+
'''program variant''': (int) the variant of program this constant applies to '''optional'''<br/>
 +
 
 
{{Sprite}}
 
{{Sprite}}

Revision as of 20:56, 7 February 2023

Available since: Gideros 2017.4
Class: Sprite

Description

Changes 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 of 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