Page 1 of 1

Change the sun settings using OSSL

Posted: Wed Dec 26, 2012 12:15 pm
by Oren Hurvitz
OSSL contains two functions that change the sun settings: osSetRegionSunSettings and osSetEstateSunSettings. Here's an example of how to use them:

Code: Select all

integer estateSunFixed;
float estateSunHour;

integer useEstateSun;
integer regionSunFixed;
float regionSunHour;

float DAWN = 0.0;
float NOON = 6.0;
float DUSK = 12.0;
float MIDNIGHT = 18.0;

default
{
    touch_start(integer total_number)
    {
        estateSunFixed = TRUE;
        estateSunHour = DAWN;
        osSetEstateSunSettings(estateSunFixed, estateSunHour);
        llSay(0 ,"osSetEstateSunSettings : sunFixed = " + estateSunFixed + ", sunHour = " + (string)estateSunHour);
        
        useEstateSun = FALSE;
        regionSunFixed = TRUE;
        regionSunHour = MIDNIGHT;
        osSetRegionSunSettings(useEstateSun, regionSunFixed, regionSunHour);
        llSay(0, "osSetRegionSunSettings : useEstateSun =  " + useEstateSun + ", sunFixed = " + regionSunFixed + ", sunHour = " + (string)regionSunHour);

        llSay(0, "Current sun hour: "+(string)osGetCurrentSunHour());
    }
}

Re: Change the sun settings using OSSL

Posted: Sat Jan 26, 2013 6:14 pm
by Adagio Greenwood
Is this something we would need to use if we use our region's environment settings?

Adagio

Re: Change the sun settings using OSSL

Posted: Sat Jan 26, 2013 7:12 pm
by Ilan Tochner
Hi Adagio,

No, it's only needed if you want to change those settings via a script. The viewer's region settings will work just as well.

Re: Change the sun settings using OSSL

Posted: Sat Jan 26, 2013 7:31 pm
by Adagio Greenwood
Thanks, Ilan, as always..............

Re: Change the sun settings using OSSL

Posted: Sat Jan 26, 2013 7:57 pm
by Ilan Tochner
You're welcome Adagio :-)