Category:LSL Color/pt
From Second Life Wiki
Second Life Wiki > LSL Color/pt
| LSL Portal | Functions | Events | Types | Operadores | Constants | Flow Control | Biblioteca de Script | Tutorials |
Contents |
Cores na LSL
Cores na LSLA LSL tem o seu próprio formato de representação de cores. É usado um vector para registar a cor. ao Contrário do formato RGB tradicional onde cada canal varia entre 0 -> 255, na LSL os canais de cor são 0 -> 1.
Format: <R, G, B>
| • float | x | – | Valor Vermelho(Red) | [0, 1] |
| • float | y | – | Valor Verde(Green) | [0, 1] |
| • float | z | – | Valor Azul(Blue) | [0, 1] |
Useful Snippets
Funções úteis para enviarar/receberer cores e and valores alpha para/de inteiros
integer 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) / 255.0, ((rgba >> 8) & 0xFF) / 255.0, (rgba & 0xFF) / 255.0 >; } float RGBAtoAlpha(integer rgba) { return ((rgba >> 24) & 0xFF) / 255.0; }
This category currently contains no pages or media.

