OsSetProjectionParams

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Typo (yp-> to))
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{osslfunc
 
{{osslfunc
|threat_level=High
+
|threat_level=
||permissions=${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
+
||permissions=
 
|delay=0
 
|delay=0
|additional_info=This function was added in 0.7.2-post-fixes
+
|additional_info=This function was added in 0.7.2-post-fixes, linkset variant added 2019, April 18
|function_syntax=void osSetProjectionParams(integer projection, key texture, float fov, float focus, float amb)<br />
+
|function_syntax= osSetProjectionParams(integer projection, key texture, float fov, float focus, float ambiance)<br />
void osSetProjectionParams(integer linknumber, integer projection, key texture, float fov, float focus, float amb)<br />
+
osSetProjectionParams(integer linknumber, integer projection, key texture, float fov, float focus, float ambiance)<br />
void osSetProjectionParams(key prim, integer projection, key texture, float fov, float focus, float amb)
+
osSetProjectionParams(key prim, integer projection, key texture, float fov, float focus, float ambiance)
|ossl_example=This example will control the projection map in the host prim, a prim on the linkset or another prim identified by it's uuid
+
|description= Sets a prim projector parameters, argument projection is TRUE(1) or FALSE(0). The prim can be the host prim on first variant, a prim on the linkset or a prim with giving UUID.<br>
 +
In last case Threat level is high and controlled by Allow_osSetProjectionParams. The other cases have no threat level check. Note that you may need to set the prim light also.
 +
|ossl_example=These examples will control the projection map in the host prim, a prim on the linkset and another prim identified by it's uuid.
 +
<source lang="lsl">
 +
//
 +
// osSetProjectionParams Script Example
 +
// Author: djphil
 +
//
 +
 +
// These variables correspond to the settings found in the "Features" tab of the build editor
 +
float fov = 1.5;        // Range 0.0 to 3.0
 +
float focus = 15.0;    // Range -20.0 to 20.0
 +
float ambiance = 0.4;  // Range 0.0 to 1.0
  
 +
// Can be texture's name in object's inventory or the texture uuid
 +
key texture = "00000000-0000-2222-3333-100000001001";
 +
 +
integer power;
 +
 +
integer check_values()
 +
{
 +
    if (fov < 0.0 || fov > 3.0) return FALSE;
 +
    if (focus < -20.0 || focus > 20.0) return FALSE;
 +
    if (ambiance < 0.0 || ambiance > 1.0) return FALSE;
 +
    return TRUE;
 +
}
 +
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        if (check_values() == TRUE)
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "Touch to see osSetProjectionParams usage.");
 +
            llSay(PUBLIC_CHANNEL, "fov: " + (string)fov);
 +
            llSay(PUBLIC_CHANNEL, "focus: " + (string)focus);
 +
            llSay(PUBLIC_CHANNEL, "ambiance: " + (string)ambiance);
 +
            llSay(PUBLIC_CHANNEL, "texture: " + (string)texture);
 +
        }
 +
 +
        else
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "Invalid value(s) detected ...");
 +
        }
 +
    }
 +
 +
    touch_start(integer number)
 +
    {
 +
        power = !power;
 +
        osSetPrimitiveParams(llGetKey(),[PRIM_POINT_LIGHT, power, <1.0, 1.0, 1.0>, 1.0, 5.0, 0.5]);
 +
        osSetProjectionParams(power, texture, fov, focus, ambiance);
 +
    }
 +
}
 +
</source>
 +
'''With a link number:'''
 
<source lang="lsl">
 
<source lang="lsl">
integer pstate = FALSE;
+
//
 +
// osSetProjectionParams Script Example
 +
// Author: djphil
 +
//
  
// These variables correspond to the settings found in the
+
// These variables correspond to the settings found in the "Features" tab of the build editor
// "Features" tab of the build editor
+
float fov = 1.5;       // Range 0.0 to 3.0
float FOV = 1.5; // Values 0.00 - 3.00
+
float focus = 15.0;     // Range -20.0 to 20.0
float Focus = 15.0; // Values -20.00 - 20.00
+
float ambiance = 0.4;   // Range 0.0 to 1.0
float Ambiance = 0.4; // Values 0.00 - 1.00
+
key Texture = "b4c6b075-4940-4270-bb10-d293fd6f8091";
+
  
// UUID of other prim that we want to control
+
// Link number of other primitive that we want to control
key Remote = "9772974a-a0f6-43ec-b1a2-da558b0b0d59";
+
integer link = 2;
 +
 
 +
// Can be texture's name in object's inventory or the texture uuid
 +
key texture = "00000000-0000-2222-3333-100000001001";
 +
 
 +
integer power;
 +
 
 +
integer check_values()
 +
{
 +
    if (fov < 0.0 || fov > 3.0) return FALSE;
 +
    if (focus < -20.0 || focus > 20.0) return FALSE;
 +
    if (ambiance < 0.0 || ambiance > 1.0) return FALSE;
 +
    return TRUE;
 +
}
  
 
default
 
default
Line 26: Line 93:
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         llSay(0, "Script running");
+
         if (check_values() == TRUE)
        llSetText((string)llGetKey(),<0.3,0.5,0.75>,1.0);
+
        {
        llSetPrimitiveParams([]);
+
            llSay(PUBLIC_CHANNEL, "Touch to see osSetProjectionParams usage.");
       
+
            llSay(PUBLIC_CHANNEL, "fov: " + (string)fov);
        // Light must be enabled in "Features"
+
            llSay(PUBLIC_CHANNEL, "focus: " + (string)focus);
          
+
            llSay(PUBLIC_CHANNEL, "ambiance: " + (string)ambiance);
         // This one controls this prim...
+
            llSay(PUBLIC_CHANNEL, "link: " + (string)link);
         osSetProjectionParams(pstate, Texture, FOV, Focus, Ambiance);
+
            llSay(PUBLIC_CHANNEL, "texture: " + (string)texture);
        // This one controls the remote prim...
+
         }
        osSetProjectionParams(Remote, pstate, Texture, FOV, Focus, Ambiance);
+
 
          
+
         else
 +
         {
 +
            llSay(PUBLIC_CHANNEL, "Invalid value(s) detected ...");
 +
         }
 
     }
 
     }
   
+
 
     touch_start(integer _det)  
+
     touch_start(integer number)
 +
    {
 +
        power = !power;
 +
        llSetLinkPrimitiveParamsFast(link, [PRIM_POINT_LIGHT, power, <1.0, 1.0, 1.0>, 1.0, 5.0, 0.5]);
 +
        osSetProjectionParams(link, power, texture, fov, focus, ambiance);
 +
    }
 +
}
 +
</source>
 +
'''With a primitive uuid:'''
 +
<source lang="lsl">
 +
//
 +
// osSetProjectionParams Script Example
 +
// Author: djphil
 +
//
 +
 +
// These variables correspond to the settings found in the "Features" tab of the build editor
 +
float fov = 1.5;        // Range 0.0 to 3.0
 +
float focus = 15.0;    // Range -20.0 to 20.0
 +
float ambiance = 0.4;  // Range 0.0 to 1.0
 +
 
 +
// uuid of other primitive that we want to control
 +
key target = "8c68368f-3a10-4473-abb3-f4e91a42013e";
 +
 
 +
// Can be texture's name in object's inventory or the texture uuid
 +
key texture = "00000000-0000-2222-3333-100000001001";
 +
 
 +
integer power;
 +
 
 +
integer check_values()
 +
{
 +
    if (fov < 0.0 || fov > 3.0) return FALSE;
 +
    if (focus < -20.0 || focus > 20.0) return FALSE;
 +
    if (ambiance < 0.0 || ambiance > 1.0) return FALSE;
 +
    return TRUE;
 +
}
 +
 
 +
default
 +
{
 +
    state_entry()
 
     {
 
     {
       
+
         if (check_values() == TRUE)
         if (pstate == TRUE)  
+
 
         {
 
         {
             pstate = FALSE;
+
             llSay(PUBLIC_CHANNEL, "Touch to see osSetProjectionParams usage.");
 +
            llSay(PUBLIC_CHANNEL, "fov: " + (string)fov);
 +
            llSay(PUBLIC_CHANNEL, "focus: " + (string)focus);
 +
            llSay(PUBLIC_CHANNEL, "ambiance: " + (string)ambiance);
 +
            llSay(PUBLIC_CHANNEL, "target: " + (string)target);
 +
            llSay(PUBLIC_CHANNEL, "texture: " + (string)texture);
 
         }
 
         }
 +
 
         else
 
         else
 
         {
 
         {
             pstate = TRUE;
+
             llSay(PUBLIC_CHANNEL, "Invalid value(s) detected ...");
 
         }
 
         }
       
+
    }
         // Control this prim...
+
 
         osSetProjectionParams(pstate, Texture, FOV, Focus, Ambiance);
+
    touch_start(integer number)
        // Control the remote prim...
+
    {
         osSetProjectionParams(Remote, pstate, Texture, FOV, Focus, Ambiance);
+
         power = !power;
 +
         osSetPrimitiveParams(target,[PRIM_POINT_LIGHT, power, <1.0, 1.0, 1.0>, 1.0, 5.0, 0.5]);
 +
         osSetProjectionParams(target, power, texture, fov, focus, ambiance);
 
     }
 
     }
 
}
 
}
 
</source>
 
</source>
|description=2 Variations possible.
+
|additional_info=
*bool = TRUE / FALSE.
+
*double = float.
+
|
+
 
}}
 
}}

Latest revision as of 05:48, 21 March 2021

osSetProjectionParams(integer projection, key texture, float fov, float focus, float ambiance)

osSetProjectionParams(integer linknumber, integer projection, key texture, float fov, float focus, float ambiance)
osSetProjectionParams(key prim, integer projection, key texture, float fov, float focus, float ambiance)

Sets a prim projector parameters, argument projection is TRUE(1) or FALSE(0). The prim can be the host prim on first variant, a prim on the linkset or a prim with giving UUID.

In last case Threat level is high and controlled by Allow_osSetProjectionParams. The other cases have no threat level check. Note that you may need to set the prim light also.

Threat Level No threat level specified
Permissions No permissions specified
Extra Delay 0 seconds
Example(s)
These examples will control the projection map in the host prim, a prim on the linkset and another prim identified by it's uuid.
//
// osSetProjectionParams Script Example
// Author: djphil
//
 
// These variables correspond to the settings found in the "Features" tab of the build editor
float fov = 1.5;        // Range 0.0 to 3.0
float focus = 15.0;     // Range -20.0 to 20.0
float ambiance = 0.4;   // Range 0.0 to 1.0
 
// Can be texture's name in object's inventory or the texture uuid
key texture = "00000000-0000-2222-3333-100000001001";
 
integer power;
 
integer check_values()
{
    if (fov < 0.0 || fov > 3.0) return FALSE;
    if (focus < -20.0 || focus > 20.0) return FALSE;
    if (ambiance < 0.0 || ambiance > 1.0) return FALSE;
    return TRUE;
}
 
default
{
    state_entry()
    {
        if (check_values() == TRUE)
        {
            llSay(PUBLIC_CHANNEL, "Touch to see osSetProjectionParams usage.");
            llSay(PUBLIC_CHANNEL, "fov: " + (string)fov);
            llSay(PUBLIC_CHANNEL, "focus: " + (string)focus);
            llSay(PUBLIC_CHANNEL, "ambiance: " + (string)ambiance);
            llSay(PUBLIC_CHANNEL, "texture: " + (string)texture);
        }
 
        else
        {
            llSay(PUBLIC_CHANNEL, "Invalid value(s) detected ...");
        }
    }
 
    touch_start(integer number) 
    {
        power = !power;
        osSetPrimitiveParams(llGetKey(),[PRIM_POINT_LIGHT, power, <1.0, 1.0, 1.0>, 1.0, 5.0, 0.5]);
        osSetProjectionParams(power, texture, fov, focus, ambiance);
    }
}

With a link number:

//
// osSetProjectionParams Script Example
// Author: djphil
//
 
// These variables correspond to the settings found in the "Features" tab of the build editor
float fov = 1.5;        // Range 0.0 to 3.0
float focus = 15.0;     // Range -20.0 to 20.0
float ambiance = 0.4;   // Range 0.0 to 1.0
 
// Link number of other primitive that we want to control
integer link = 2;
 
// Can be texture's name in object's inventory or the texture uuid
key texture = "00000000-0000-2222-3333-100000001001";
 
integer power;
 
integer check_values()
{
    if (fov < 0.0 || fov > 3.0) return FALSE;
    if (focus < -20.0 || focus > 20.0) return FALSE;
    if (ambiance < 0.0 || ambiance > 1.0) return FALSE;
    return TRUE;
}
 
default
{
    state_entry()
    {
        if (check_values() == TRUE)
        {
            llSay(PUBLIC_CHANNEL, "Touch to see osSetProjectionParams usage.");
            llSay(PUBLIC_CHANNEL, "fov: " + (string)fov);
            llSay(PUBLIC_CHANNEL, "focus: " + (string)focus);
            llSay(PUBLIC_CHANNEL, "ambiance: " + (string)ambiance);
            llSay(PUBLIC_CHANNEL, "link: " + (string)link);
            llSay(PUBLIC_CHANNEL, "texture: " + (string)texture);
        }
 
        else
        {
            llSay(PUBLIC_CHANNEL, "Invalid value(s) detected ...");
        }
    }
 
    touch_start(integer number) 
    {
        power = !power;
        llSetLinkPrimitiveParamsFast(link, [PRIM_POINT_LIGHT, power, <1.0, 1.0, 1.0>, 1.0, 5.0, 0.5]);
        osSetProjectionParams(link, power, texture, fov, focus, ambiance);
    }
}

With a primitive uuid:

//
// osSetProjectionParams Script Example
// Author: djphil
//
 
// These variables correspond to the settings found in the "Features" tab of the build editor
float fov = 1.5;        // Range 0.0 to 3.0
float focus = 15.0;     // Range -20.0 to 20.0
float ambiance = 0.4;   // Range 0.0 to 1.0
 
// uuid of other primitive that we want to control
key target = "8c68368f-3a10-4473-abb3-f4e91a42013e";
 
// Can be texture's name in object's inventory or the texture uuid
key texture = "00000000-0000-2222-3333-100000001001";
 
integer power;
 
integer check_values()
{
    if (fov < 0.0 || fov > 3.0) return FALSE;
    if (focus < -20.0 || focus > 20.0) return FALSE;
    if (ambiance < 0.0 || ambiance > 1.0) return FALSE;
    return TRUE;
}
 
default
{
    state_entry()
    {
        if (check_values() == TRUE)
        {
            llSay(PUBLIC_CHANNEL, "Touch to see osSetProjectionParams usage.");
            llSay(PUBLIC_CHANNEL, "fov: " + (string)fov);
            llSay(PUBLIC_CHANNEL, "focus: " + (string)focus);
            llSay(PUBLIC_CHANNEL, "ambiance: " + (string)ambiance);
            llSay(PUBLIC_CHANNEL, "target: " + (string)target);
            llSay(PUBLIC_CHANNEL, "texture: " + (string)texture);
        }
 
        else
        {
            llSay(PUBLIC_CHANNEL, "Invalid value(s) detected ...");
        }
    }
 
    touch_start(integer number) 
    {
        power = !power;
        osSetPrimitiveParams(target,[PRIM_POINT_LIGHT, power, <1.0, 1.0, 1.0>, 1.0, 5.0, 0.5]);
        osSetProjectionParams(target, power, texture, fov, focus, ambiance);
    }
}


Personal tools
General
About This Wiki