Difference between revisions of "PRIM POINT LIGHT"
Jump to navigation
Jump to search
All Issues ~ Search JIRA for related Bugs
m (lsl code tagging) |
m (<lsl> tag to <source>) |
||
(14 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{#if: | <onlyinclude>{{#if: | ||
{{ | {{#vardefine:light_const|{{LSL Const|PRIM_POINT_LIGHT|integer|23|c=Used to {{GetSet|{{{1|}}}|get|set|/}} the prim's point light configuration}}}} | ||
{{#vardefine:p_radius_desc|ranges from 0.1 to 20.0}} | |||
{{#vardefine:p_falloff_desc|ranges from 0.01 to 2.0}} | |||
{{#vardefine:p_intensity_desc|ranges from 0.0 to 1.0}} | |||
}}</onlyinclude>{{#if: | |||
{{LSL_Function/boolean|boolean}} | |||
{{LSL_Function/color|color}} | |||
}}{{LSL Constant | }}{{LSL Constant | ||
|inject-2={{LSL PrimitiveParam Categorize|Prim}} | |||
|name=PRIM_POINT_LIGHT | |name=PRIM_POINT_LIGHT | ||
|type=integer | |type=integer | ||
|value=23 | |value=23 | ||
|desc=PRIM_POINT_LIGHT is used to configure the light | |desc=PRIM_POINT_LIGHT is used to configure the point light configuration of the prim | ||
|pa={{LSL Constant/List|i_front=[  | |pa={{LSL Constant/List|i_front=[ {{#var:light_const}}, |i_end= ] | ||
|text=When used with [[llSetPrimitiveParams]] & [[llSetLinkPrimitiveParams]] | |text=When used with [[llSetPrimitiveParams]] & [[llSetLinkPrimitiveParams]] & [[llSetLinkPrimitiveParamsFast]] | ||
|i1_type=integer|i1_name=boolean | |toc=llSetPrimitiveParams | ||
|i1_type=integer|i1_subtype=boolean|i1_name=boolean | |||
|i2_type=vector|i2_name=color | |i2_type=vector|i2_name=color | ||
|i3_type=float|i3_name=intensity | |i3_type=float|i3_name=intensity | ||
|i4_type=float|i4_name=radius | |i4_type=float|i4_name=radius | ||
|i5_type=float|i5_name=falloff}} | |i5_type=float|i5_name=falloff}} | ||
|pb={{LSL Constant/List|i_front=[[llGetPrimitiveParams]]([ | |pb={{LSL Constant/List|i_front=[[llGetPrimitiveParams]]([ {{#var:light_const}}|i_end= ]);| | ||
|r_front=Returns the list [ |r_end= ] | |r_front=Returns the list [ |r_end= ] | ||
|text | |text | ||
|r1_type=integer|r1_name=boolean | |toc=llGetPrimitiveParams | ||
|r1_type=integer|r1_subtype=boolean|r1_name=boolean | |||
|r2_type=vector|r2_name=color | |r2_type=vector|r2_name=color | ||
|r3_type=float|r3_name=intensity | |r3_type=float|r3_name=intensity | ||
Line 22: | Line 31: | ||
|r5_type=float|r5_name=falloff | |r5_type=float|r5_name=falloff | ||
}} | }} | ||
|caveats= | |||
* Viewers that do not have advanced lighting enabled can only render 6 lights at a time and projectors will be rendered as omnidirectional light sources. (OpenGL limitations allow for 8 light sources, SL appears to reserve one each for the Sun and Moon.) | |||
** Viewers that '''do''' have advanced lighting enabled can render as many lights as their graphics card allows; it is not hard-limited by the viewer. | |||
* Lights with a high intensity have a wash-out effect when overlapping. Keep this in mind when using multiple lights. '''''Never''' create an abundance of lights to get around the 6 light maximum in basic lighting'', as viewers with advanced lighting will be washed out and may suffer from client lag. | |||
* There are no LSL functions that allow you to set projector values (texture, FOV, focus, and ambiance). | |||
|examples= | |examples= | ||
< | <source lang="lsl2"> | ||
integer isLightTurnedOn; | |||
integer | |||
default | default | ||
{ | { | ||
touch_start(integer total_number) | touch_start(integer total_number) | ||
{ | { | ||
// toggle isLightTurnedOn between TRUE and FALSE | |||
isLightTurnedOn = !isLightTurnedOn; | |||
if (isLightTurnedOn) | |||
{ | |||
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE | llSetPrimitiveParams([ | ||
PRIM_FULLBRIGHT, ALL_SIDES, FALSE, | |||
PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 1.0, 10.0, 0.6]); | |||
} | |||
} | |||
else | else | ||
{ | { | ||
vector COLOR_ORANGE = <1.000, 0.522, 0.106>; | |||
llSetPrimitiveParams([ | |||
PRIM_FULLBRIGHT, ALL_SIDES, TRUE, | |||
PRIM_POINT_LIGHT, TRUE, COLOR_ORANGE, 1.0, 10.0, 0.6]); | |||
} | } | ||
} | } | ||
} | } | ||
</ | </source> | ||
{{ | A compact version of the above:- | ||
<source lang="lsl2"> | |||
integer switch; | |||
default | |||
{ | |||
touch_start(integer total_number) | |||
{ | |||
llSetPrimitiveParams( | |||
[ PRIM_FULLBRIGHT, ALL_SIDES, switch = !switch, | |||
PRIM_POINT_LIGHT, switch, <1, 0.5, 0.1> * switch, 1, 10, 0.6 ] ); | |||
} | |||
} | |||
</source> | |||
|constants | |||
|functions= | |functions= | ||
{{LSL DefineRow||[[llSetPrimitiveParams]]|}} | {{LSL DefineRow||[[llSetPrimitiveParams]]|}} | ||
{{LSL DefineRow||[[llSetLinkPrimitiveParams]]|}} | {{LSL DefineRow||[[llSetLinkPrimitiveParams]]|}} | ||
{{LSL DefineRow||[[llSetLinkPrimitiveParamsFast]]|}} | |||
{{LSL DefineRow||[[llGetPrimitiveParams]]|}} | {{LSL DefineRow||[[llGetPrimitiveParams]]|}} | ||
{{LSL DefineRow||[[llGetLinkPrimitiveParams]]|}} | |||
{{LSL DefineRow||[[ | |events | ||
|location | |location | ||
|cat1=Light | |cat1=Light |
Revision as of 16:51, 23 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Description
Constant: integer PRIM_POINT_LIGHT = 23;The integer constant PRIM_POINT_LIGHT has the value 23
PRIM_POINT_LIGHT is used to configure the point light configuration of the prim
llSetPrimitiveParams
[ PRIM_POINT_LIGHT, integer boolean, vector color, float intensity, float radius, float falloff ]• integer | boolean | – | TRUE enables, FALSE disables | |
• vector | color | – | color in RGB <R, G, B> (<0.0, 0.0, 0.0> = black, <1.0, 1.0, 1.0> = white) | |
• float | intensity | – | ranges from 0.0 to 1.0 | |
• float | radius | – | ranges from 0.1 to 20.0 | |
• float | falloff | – | ranges from 0.01 to 2.0 |
When used with llSetPrimitiveParams & llSetLinkPrimitiveParams & llSetLinkPrimitiveParamsFast
llGetPrimitiveParams
llGetPrimitiveParams([ PRIM_POINT_LIGHT ]);Returns the list [ integer boolean, vector color, float intensity, float radius, float falloff ]
• integer | boolean | – | TRUE enables, FALSE disables | |
• vector | color | – | color in RGB <R, G, B> (<0.0, 0.0, 0.0> = black, <1.0, 1.0, 1.0> = white) | |
• float | intensity | – | ranges from 0.0 to 1.0 | |
• float | radius | – | ranges from 0.1 to 20.0 | |
• float | falloff | – | ranges from 0.01 to 2.0 |
Caveats
- Viewers that do not have advanced lighting enabled can only render 6 lights at a time and projectors will be rendered as omnidirectional light sources. (OpenGL limitations allow for 8 light sources, SL appears to reserve one each for the Sun and Moon.)
- Viewers that do have advanced lighting enabled can render as many lights as their graphics card allows; it is not hard-limited by the viewer.
- Lights with a high intensity have a wash-out effect when overlapping. Keep this in mind when using multiple lights. Never create an abundance of lights to get around the 6 light maximum in basic lighting, as viewers with advanced lighting will be washed out and may suffer from client lag.
- There are no LSL functions that allow you to set projector values (texture, FOV, focus, and ambiance).
Related Articles
Functions
• | llSetPrimitiveParams | |||
• | llSetLinkPrimitiveParams | |||
• | llSetLinkPrimitiveParamsFast | |||
• | llGetPrimitiveParams | |||
• | llGetLinkPrimitiveParams |
Articles
• | Color in LSL |
Examples
integer isLightTurnedOn;
default
{
touch_start(integer total_number)
{
// toggle isLightTurnedOn between TRUE and FALSE
isLightTurnedOn = !isLightTurnedOn;
if (isLightTurnedOn)
{
llSetPrimitiveParams([
PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 1.0, 10.0, 0.6]);
}
else
{
vector COLOR_ORANGE = <1.000, 0.522, 0.106>;
llSetPrimitiveParams([
PRIM_FULLBRIGHT, ALL_SIDES, TRUE,
PRIM_POINT_LIGHT, TRUE, COLOR_ORANGE, 1.0, 10.0, 0.6]);
}
}
}
A compact version of the above:-
integer switch;
default
{
touch_start(integer total_number)
{
llSetPrimitiveParams(
[ PRIM_FULLBRIGHT, ALL_SIDES, switch = !switch,
PRIM_POINT_LIGHT, switch, <1, 0.5, 0.1> * switch, 1, 10, 0.6 ] );
}
}