Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
m (add Category:Interface Customization)
No edit summary
Line 1: Line 1:
Usage: texture:SetVertexColor(r, g, b, a)
+
<center>'''SetVertexColor''' ''-Documentation by [[AeroBrain]]-''</center>
where r, g, b and a are values from 0 to 1. r is red, g is green, b is blue and a is alpha.
 
   
  +
Sets the color of an object.
   
  +
obj:SetVertexColor(red, green, blue);
Sets the color of the texture. For instance if the texture used is a white bar, using Texture:SetVertexColor(0, 1, 0, 1) will turn it into a green bar. Note that this does NOT set the [[Color element]] when there is a [[file=""]] attribute set for the texture.
 
   
  +
----
[[Category:Interface Customization]]
 
  +
;''Arguments''
  +
  +
; red : The red color value to set the object to. The range is 0 to 1.
  +
; green : The green color value to set the object to. The range is 0 to 1.
  +
; blue : The blue color value to set the object to. The range is 0 to 1.
  +
  +
----
  +
;''Returns''
  +
  +
:;nil
  +
  +
----
  +
;''Example''
  +
MainMenuBackground:SetVertexColor(1, 0, 0);
  +
  +
;''Result''
  +
: MainMenuBackground would be set to pure red.
  +
  +
----
  +
;''Description''
  +
  +
: Sets the color of an object.
  +
  +
----
  +
;''Caveats''
  +
  +
: It appears that the values specified are actually percentages to adjust the original color values (specified in the XML content) by.
  +
: Example:
  +
: You have a background layer with a texture (named 'myModBackground') set as a filled color of (decimal RGB triplet) '0.5,0,0.5'.
  +
: You execute the following in one of your functions:
  +
getglobal("myModBackground"):SetVertexColor(0.5,1,0.5);
  +
: The result would be that the color for 'myModBackground' is set to (0.25,0,0.25), not (0.5,1,0.5).
  +
  +
----
  +
;''Explanation''
  +
  +
: The reason the method says "vertex color" is most likely due to the implementation details of how this works. OpenGL and Direct3D both support the concept of "vertex colors" which are frequently used in lighting. Each vertex of a 3-D object can have a "vertex color" set on it. The polygon will then be drawn with the vertex color shaded based on the location of the pixel relative to the vertexes of the polygon.
  +
: Presumably this method sets all four vertexes of the quad used to make up interface elements to the given color, creating a filtering effect. The color is a direct filtering effect. Each color component of the object will be multiplied by the value given to determine the final color.
  +
: So, setting (1.0, 1.0, 0.0) on a white object will color it yellow. But doing the same thing on a blue object will make it black. Be careful when using this on textured items.
  +
  +
----
  +
{{template:WoW API}}

Revision as of 04:51, 14 May 2006

SetVertexColor -Documentation by AeroBrain-

Sets the color of an object.

obj:SetVertexColor(red, green, blue);

Arguments
red
The red color value to set the object to. The range is 0 to 1.
green
The green color value to set the object to. The range is 0 to 1.
blue
The blue color value to set the object to. The range is 0 to 1.

Returns
nil

Example
MainMenuBackground:SetVertexColor(1, 0, 0);
Result
MainMenuBackground would be set to pure red.

Description
Sets the color of an object.

Caveats
It appears that the values specified are actually percentages to adjust the original color values (specified in the XML content) by.
Example:
You have a background layer with a texture (named 'myModBackground') set as a filled color of (decimal RGB triplet) '0.5,0,0.5'.
You execute the following in one of your functions:
getglobal("myModBackground"):SetVertexColor(0.5,1,0.5);
The result would be that the color for 'myModBackground' is set to (0.25,0,0.25), not (0.5,1,0.5).

Explanation
The reason the method says "vertex color" is most likely due to the implementation details of how this works. OpenGL and Direct3D both support the concept of "vertex colors" which are frequently used in lighting. Each vertex of a 3-D object can have a "vertex color" set on it. The polygon will then be drawn with the vertex color shaded based on the location of the pixel relative to the vertexes of the polygon.
Presumably this method sets all four vertexes of the quad used to make up interface elements to the given color, creating a filtering effect. The color is a direct filtering effect. Each color component of the object will be multiplied by the value given to determine the final color.
So, setting (1.0, 1.0, 0.0) on a white object will color it yellow. But doing the same thing on a blue object will make it black. Be careful when using this on textured items.

Template:WoW API