Difference between revisions of "Mesh:setColor"
From GiderosMobile
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | + | '''Available since:''' Gideros 2012.09<br/> | |
− | ''' | + | '''Class:''' [[Mesh]]<br/> |
− | ''' | + | |
− | === | + | === Description === |
− | + | Sets a color in the color array. Indices start from 1. If the color array is not large enough, it is automatically expanded. | |
− | Sets a color | ||
− | |||
<source lang="lua"> | <source lang="lua"> | ||
− | + | Mesh:setColor(i,color,alpha) | |
</source> | </source> | ||
− | |||
− | === | + | === Parameters === |
− | '''i''': (number) | + | '''i''': (number) index<br/> |
− | '''color''': (number) | + | '''color''': (number) color in hexedecial value<br/> |
− | '''alpha''': (number, default=1.0) | + | '''alpha''': (number, default=1.0) alpha value<br/> |
− | <br /> | ||
− | === | + | === Example === |
− | + | <source lang="lua"> | |
− | <source lang="lua">-- set the first 3 colors as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0) | + | -- set the first 3 colors as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0) |
mesh:setColor(1, 0xff0000, 0.5) -- red with 0.5 alpha | mesh:setColor(1, 0xff0000, 0.5) -- red with 0.5 alpha | ||
mesh:setColor(2, 0x00ff00, 0.7) -- green with 0.7 alpha | mesh:setColor(2, 0x00ff00, 0.7) -- green with 0.7 alpha | ||
− | mesh:setColor(3, 0x0000ff) -- blue with 1.0 alpha</source> | + | mesh:setColor(3, 0x0000ff) -- blue with 1.0 alpha |
+ | </source> | ||
{{Mesh}} | {{Mesh}} |
Revision as of 04:41, 18 September 2022
Available since: Gideros 2012.09
Class: Mesh
Description
Sets a color in the color array. Indices start from 1. If the color array is not large enough, it is automatically expanded.
Mesh:setColor(i,color,alpha)
Parameters
i: (number) index
color: (number) color in hexedecial value
alpha: (number, default=1.0) alpha value
Example
-- set the first 3 colors as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0)
mesh:setColor(1, 0xff0000, 0.5) -- red with 0.5 alpha
mesh:setColor(2, 0x00ff00, 0.7) -- green with 0.7 alpha
mesh:setColor(3, 0x0000ff) -- blue with 1.0 alpha
- Mesh
- Mesh.new
- Mesh:clearColorArray
- Mesh:clearIndexArray
- Mesh:clearTexture
- Mesh:clearTextureCoordinateArray
- Mesh:clearVertexArray
- Mesh:getColor
- Mesh:getColorArraySize
- Mesh:getIndex
- Mesh:getIndexArraySize
- Mesh:getTextureCoordinate
- Mesh:getTextureCoordinateArraySize
- Mesh:getVertex
- Mesh:getVertexArraySize
- Mesh:resizeColorArray
- Mesh:resizeIndexArray
- Mesh:resizeTextureCoordinateArray
- Mesh:resizeVertexArray
- Mesh:setAutoSort
- Mesh:setColor
- Mesh:setColorArray
- Mesh:setColors
- Mesh:setCullMode
- Mesh:setGenericArray
- Mesh:setIndex
- Mesh:setIndexArray
- Mesh:setIndices
- Mesh:setInstanceCount
- Mesh:setPrimitiveType
- Mesh:setTexture
- Mesh:setTextureCoordinate
- Mesh:setTextureCoordinateArray
- Mesh:setTextureCoordinates
- Mesh:setVertex
- Mesh:setVertexArray
- Mesh:setVertices