Difference between revisions of "Category:LSL Color"
Jump to navigation
Jump to search
m |
(oh god this needs to be reworked o_o) |
||
Line 1: | Line 1: | ||
{{ | {{LSL Header|ml=*}} | ||
{{#if: | |||
}}{{#vardefine:header_text|LSL 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.<br/> | |||
{{#vardefine:header_title|Color in LSL}} | |||
{{#vardefine:header_text|LSL 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.<br/> | |||
===Format: {{LSL VR|'''R'''|'''G'''|'''B'''}}=== | ===Format: {{LSL VR|'''R'''|'''G'''|'''B'''}}=== | ||
{{{!}} | {{{!}} | ||
Line 8: | Line 10: | ||
{{LSL DefineRow|float|z|Blue value|[0, 1]}} | {{LSL DefineRow|float|z|Blue value|[0, 1]}} | ||
{{!}}} | {{!}}} | ||
}} | |||
{{#vardefine:helpers| | |||
===Useful functions for storing/retrieving color and alpha values to/from integers=== | ===Useful functions for storing/retrieving color and alpha values to/from integers=== | ||
<lsl>integer ColorAlphatoRGBA(vector color, float alpha) { | <lsl>integer ColorAlphatoRGBA(vector color, float alpha) { | ||
Line 25: | Line 28: | ||
return ((rgba >> 24) & 0xFF) / 255.0; | return ((rgba >> 24) & 0xFF) / 255.0; | ||
}</lsl> | }</lsl> | ||
}}{{#vardefine:examples| | }} | ||
{{#vardefine:examples| | |||
<lsl>vector white = <1.0, 1.0, 1.0>; | <lsl>vector white = <1.0, 1.0, 1.0>; | ||
vector grey = <0.5, 0.5, 0.5>; | vector grey = <0.5, 0.5, 0.5>; | ||
Line 35: | Line 40: | ||
vector cyan = <0.0, 1.0, 1.0>; | vector cyan = <0.0, 1.0, 1.0>; | ||
vector magenta = <1.0, 0.0, 1.0>;</lsl> | vector magenta = <1.0, 0.0, 1.0>;</lsl> | ||
}} | |||
}}{{LSL Generic}}{{LSLC|Face|Color}} | }}{{LSL Generic}}{{LSLC|Face|Color}} | ||
{{LSLC|}} | {{LSLC|}}{{LSLC|FixMe}} |
Revision as of 14:57, 24 October 2008
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Color in LSL
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>
• float | x | – | Red value | [0, 1] |
• float | y | – | Green value | [0, 1] |
• float | z | – | Blue value | [0, 1] |
Examples
<lsl>vector white = <1.0, 1.0, 1.0>; vector grey = <0.5, 0.5, 0.5>; vector black = <0.0, 0.0, 0.0>; vector red = <1.0, 0.0, 0.0>; vector green = <0.0, 1.0, 0.0>; vector blue = <0.0, 0.0, 1.0>; vector yellow = <1.0, 1.0, 0.0>; vector cyan = <0.0, 1.0, 1.0>; vector magenta = <1.0, 0.0, 1.0>;</lsl>
Useful Snippets
Useful functions for storing/retrieving color and alpha values to/from integers
<lsl>integer ColorAlphatoRGBA(vector color, float alpha) { return (((integer)(alpha * 255.0) & 0xFF) << 24)
Pages in category "LSL Color"
The following 27 pages are in this category, out of 27 total.