Difference between revisions of "Mesh:setColors"

From GiderosMobile
(clarification?)
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Sets zero or more colors to a mesh with a single function call.
 
Sets zero or more colors to a mesh with a single function call.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
Mesh:setColors(colors)
 
Mesh:setColors(colors)
</source>
+
</syntaxhighlight>
  
 
=== Parameters ===
 
=== Parameters ===
Line 14: Line 14:
 
=== Example ===
 
=== Example ===
 
'''Different setColor function calls'''
 
'''Different setColor function calls'''
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
-- sets 3 colors with seperate function calls
 
-- sets 3 colors with seperate function calls
 
mesh:setColor(1, 0xff0000, 0.5)
 
mesh:setColor(1, 0xff0000, 0.5)
Line 29: Line 29:
 
mesh:setColors()
 
mesh:setColors()
 
mesh:setColors{}
 
mesh:setColors{}
</source>
+
</syntaxhighlight>
  
 
{{Mesh}}
 
{{Mesh}}

Latest revision as of 14:30, 13 July 2023

Available since: Gideros 2012.09
Class: Mesh

Description

Sets zero or more colors to a mesh with a single function call.

Mesh:setColors(colors)

Parameters

colors: (any) multiple values or a Lua array

Example

Different setColor function calls

-- sets 3 colors with seperate function calls
mesh:setColor(1, 0xff0000, 0.5)
mesh:setColor(2, 0x00ff00, 0.7)
mesh:setColor(3, 0x0000ff)

-- sets 3 colors with one function call
mesh:setColors(1, 0xff0000, 0.5, 2, 0x00ff00, 0.7, 3, 0x0000ff, 1.0)

-- same as above
mesh:setColors{1, 0xff0000, 0.5, 2, 0x00ff00, 0.7, 3, 0x0000ff, 1.0}

-- these two functions do nothing
mesh:setColors()
mesh:setColors{}