Category:LSL Color
From Second Life Wiki
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Tutorials |
Color in LSLLSL has its own special format for color. LSL uses a vector to store color. Unlike traditional RGB where each channel is 0 -> 255, LSL's color channels are 0 -> 1. Format: <R, G, B>
| |||||||||||||||
Useful SnippetsUseful functions for storing/retrieving color and alpha values to/from integersinteger ColorAlphatoRGBA(vector color, float alpha) { return (((integer)(alpha * 255.0) & 0xFF) << 24) | (((integer)(color.x * 255.0) & 0xFF) << 16) | (((integer)(color.y * 255.0) & 0xFF) << 8) | ((integer)(color.z * 255.0) & 0xFF); } vector RGBAtoColor(integer rgba) { return < (rgba >> 16) & 0xFF, (rgba >> 8) & 0xFF, (rgba & 0xFF) > / 255.0; } float RGBAtoAlpha(integer rgba) { return ((rgba >> 24) & 0xFF) / 255.0; } |
Pages in category "LSL Color"
The following 19 pages are in this category, out of 19 total.
CG |
PS |
S cont.acp |

