secondlife / secondlife/viewer
llSetPrimitiveParams([PRIM_REFLECTION_PROBE,probe_enabled, probe_agent_ambiance, probe_clip_distance,bitmask]) with bitmask for mirror works the first time it is set to 5 for box mirror, but not the second time.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 299
- Forks
- 146
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 88
Description
Environment
Second Life Release 7.1.5.8472515256 (64bit)
PMFP 2024-04-08.8607623983
Description
llSetPrimitiveParams([PRIM_REFLECTION_PROBE,probe_enabled, probe_agent_ambiance, probe_clip_distance,bitmask]) with bitmask for mirror works the first time it is set to 5 for box mirror, but not the second time (set bitmask to 0 and then to 5 again.)
Reproduction steps
using: llSetPrimitiveParams([PRIM_REFLECTION_PROBE,probe_enabled, probe_agent_ambiance, probe_clip_distance,bitmask]);
in a script.
with a bitmask of 4 or 5 will turn the object into a mirror immediately.
if the bitmask is set to 0 the reflection probe and mirror settings are removed. (command is 'off')
If the bitmask is then set back to 4 or 5 the mirror settings in the ui appear correct, but to see the mirror, the user needs to log out and log back in.
How to reproduce
Create Object with a shiny surface
Create slightly smaller object that intersects the first object on one side.
Add the following script to the second object:
`//UPDATE GRAPHIC SETTINGS BEFORE USING REFLECTION PROBES
// Ensure your Reflections setting is set to “Static+Dynamic” or “Realtime” in Advanced Graphics Preferences.
// (Preferences->Graphics->Advanced Settings->Reflections)
integer probe_enabled = TRUE;
float probe_no_agent_ambiance = 0.0;
float probe_agent_ambiance = 1.0;
float probe_clip_distance = 0.0;
integer probe_flags = 0;
// possible flags: PRIM_REFLECTION_PROBE_BOX (1), PRIM_REFLECTION_PROBE_DYNAMIC (2), PRIM_REFLECTION_PROBE_MIRROR (4), ALL
// PRIM_REFLECTION_PROBE_BOX - Determines if the reflection probe is a box or a sphere. (sphere by default) - 0 = sphere 1 = Box
// PRIM_REFLECTION_PROBE_DYNAMIC - Determines if avatars are included by the probe for imaging. - (probe does not image avatars by default) 2=yes - 3=no
// PRIM_REFLECTION_PROBE_MIRROR - https://github.com/secondlife/server/issues/664 - Creates mirrored surface on the object (?) 4 = sphere mirror 5= box mirror
integer link = 1;
string probeMaskToString(integer mask)
{
list flags;
if(mask & PRIM_REFLECTION_PROBE_BOX) flags += "_PROBE_BOX";
if(mask & PRIM_REFLECTION_PROBE_DYNAMIC) flags += "_PROBE_DYNAMIC";
if(mask & PRIM_REFLECTION_PROBE_MIRROR) flags += "_PROBE_MIRROR";
return (string)mask + " (" + llDumpList2String(flags, " | ") + ")";
}
default
{
state_entry()
{
//listen for setting
llListen(0, "", NULL_KEY, "");
// llSetPrimitiveParams([PRIM_REFLECTION_PROBE,probe_enabled, probe_agent_ambiance, probe_clip_distance,PRIM_REFLECTION_PROBE_DYNAMIC]);
llSay(0,(string) llGetPrimitiveParams([PRIM_REFLECTION_PROBE]));
//llSetStatus(STATUS_PHANTOM, TRUE);
//llSetAlpha(0.0,ALL_SIDES);//
}
listen(integer channel, string name, key id, string msg)
{
//integer link = getLinkNumber();
// ignore object chat
//if(llGetAgentSize(id) == ZERO_VECTOR)
//{
// llSay(0, "unexpected");
// return;
//}
// trim whitespace
msg = llStringTrim(msg, STRING_TRIM);
llSay(0, "message received: " + msg);
if(msg == "sphere")
{
vector cut = <0.0, 1.0, 0.0>; // 0.0 to 1.0
float hollow = 0.0; // 0.0 to 0.95
vector twist = <0.0, 0.0, 0.0>; // -1.0 to 1.0
vector dimple = <0.0, 1.0, 0.0>; // 0.0 to 1.0
llSetPrimitiveParams( [PRIM_TYPE, PRIM_TYPE_SPHERE, PRIM_HOLE_DEFAULT,
cut, hollow, twist, dimple ] );
return;
}
if(msg == "off")
{
llSetPrimitiveParams([PRIM_REFLECTION_PROBE,FALSE, probe_agent_ambiance, probe_clip_distance,0]);
llSetPrimitiveParams([PRIM_TYPE,
PRIM_TYPE_BOX,
PRIM_HOLE_DEFAULT, // hole_shape
<0.00, 1.0, 0.0>, // cut
0.0, // hollow
<0.0, 0.0, 0.0>, // twist
<1.0, 1.0, 0.0>, // top_size
<0.0, 0.0, 0.0> // top_Shear
]);
llSetAlpha(1.0,ALL_SIDES);
llSetStatus(STATUS_PHANTOM, FALSE);
llSay(0,"Probe is turned off and no longer transparent");
llSay(0,"To turn on, enter bitmask");
return;
}
if(msg == "query")
{
list my_list = llParseString2List((string)llGetPrimitiveParams([PRIM_REFLECTION_PROBE]),["."],["."]);
integer flagbigmask = (integer)llList2String(my_list,2);
llSay(0,(string)llGetPrimitiveParams([PRIM_REFLECTION_PROBE]));
llSay(0,(string)flagbigmask);
llSay(0, "Reflection probe flags on link #" + (string)link + " appears to be "
+ probeMaskToString(flagbigmask));
llSay(0,"If PRIM_REFLECTION_PROBE_BOX is not set then it's a SPHERE");
llSay(0,"If PRIM_REFLECTION_PROBE_DYNAMIC and PRIM_REFLECTION_PROBE_MIRROR are not set then it's STATIC");
return;
}
integer bitmask = (integer)msg;
if(bitmask > 5 || bitmask < 0)
{
llSay(0,"bitmask out of range");
return;
}
if(bitmask == 0 || bitmask ==2 || bitmask == 4)
{
vector cut = <0.0, 1.0, 0.0>; // 0.0 to 1.0
float hollow = 0.0; // 0.0 to 0.95
vector twist = <0.0, 0.0, 0.0>; // -1.0 to 1.0
vector dimple = <0.0, 1.0, 0.0>; // 0.0 to 1.0
llSetPrimitiveParams( [PRIM_TYPE, PRIM_TYPE_SPHERE, PRIM_HOLE_DEFAULT,
cut, hollow, twist, dimple ] );
}
if(bitmask == 1 || bitmask ==3 || bitmask == 5)
{
llSetPrimitiveParams([PRIM_TYPE,
PRIM_TYPE_BOX,
PRIM_HOLE_DEFAULT, // hole_shape
<0.00, 1.0, 0.0>, // cut
0.0, // hollow
<0.0, 0.0, 0.0>, // twist
<1.0, 1.0, 0.0>, // top_size
<0.0, 0.0, 0.0> // top_Shear
]);
}
llSetPrimitiveParams([PRIM_REFLECTION_PROBE,probe_enabled, probe_agent_ambiance, probe_clip_distance,bitmask]);
llSetAlpha(0.0,ALL_SIDES);
llSetStatus(STATUS_PHANTOM, TRUE);
llSleep(0.1);
llSay(0,(string) llGetPrimitiveParams([PRIM_REFLECTION_PROBE]));
}
}
`
type 5 in the chat window - object becomes a mirror.
type 0 in the chat window - object reverts to plywood textured object
type 5 in the chat window - Expect the object to display as a mirror again.
Actual: Object doesn't appear as a mirror until user logs in and logs out again.
Probably the same issue as: https://github.com/secondlife/viewer-private/issues/128
There maybe some inconsistency there.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the viewer-side handling of PRIM_REFLECTION_PROBE when llSetPrimitiveParams changes the bitmask from 5 to 0 and back to 5. Reproduce the sequence with the supplied script and verify whether the mirror becomes visible without logging out and in; compare the behavior with viewer-private issue 128.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100