Slight error in the example function. If used as-is it won't do what you expect.
({{uitech}}, formatting...) |
(Slight error in the example function. If used as-is it won't do what you expect.) |
||
| Line 147: | Line 147: | ||
Applying transformations is then rather simple. To apply a rotation to the texture, we can use the rotation matrix below (assuming angle a): | Applying transformations is then rather simple. To apply a rotation to the texture, we can use the rotation matrix below (assuming angle a): | ||
{| | {| | ||
|(||cos(a)||sin(a)|| | |(||cos(a)||sin(a)||1||) | ||
|- | |- | ||
|(||-sin(a)||cos(a)|| | |(||-sin(a)||cos(a)||1||) | ||
|} | |} | ||
Applying a rotation of 90 degrees can then be done by using: | Applying a rotation of 90 degrees can then be done by using: | ||
local cos, sin = math.cos, math.sin; | local cos, sin = math.cos, math.sin; | ||
local angle = math.rad(90); | local angle = math.rad(90); | ||
setCoords(texture, cos(angle), sin(angle), | setCoords(texture, cos(angle), sin(angle), 1, -sin(angle), cos(angle), 1); | ||