コード例 #1
0
        void ConvertLSLToWindlight (ref WindlightDayCycle cycle, int preset, LSL_List list)
        {
            var skyDatas = cycle.Cycle.DataSettings.Values.ToList ();
            var skyData = skyDatas [preset];

            for (int i = 0; i < list.Data.Length; i += 2) {
                int key = list.GetLSLIntegerItem (i);
                switch (key) {
                case ScriptBaseClass.WL_AMBIENT: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.ambient = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_COLOR: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_color = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_POS_DENSITY1: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_pos_density1 = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_POS_DENSITY2: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_pos_density2 = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCALE: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_scale = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCROLL_X: {
                        LSL_Integer integer = list.GetLSLIntegerItem (i + 1);
                        skyData.cloud_scroll_rate.X = integer;
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCROLL_Y: {
                        LSL_Integer integer = list.GetLSLIntegerItem (i + 1);
                        skyData.cloud_scroll_rate.Y = integer;
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: {
                        LSL_Integer integer = list.GetLSLIntegerItem (i + 1);
                        skyData.enable_cloud_scroll.X = integer;
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: {
                        LSL_Integer integer = list.GetLSLIntegerItem (i + 1);
                        skyData.enable_cloud_scroll.Y = integer;
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SHADOW: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_shadow = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_BLUE_DENSITY: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.blue_density = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_BLUR_HORIZON: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.blue_horizon = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_DENSITY_MULTIPLIER: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.density_multiplier = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_DISTANCE_MULTIPLIER: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.distance_multiplier = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_GAMMA: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.gamma = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_GLOW: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.glow = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_HAZE_DENSITY: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.haze_density = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_HAZE_HORIZON: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.haze_horizon = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_LIGHT_NORMALS: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.lightnorm = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_MAX_ALTITUDE: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.max_y = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_STAR_BRIGHTNESS: {
                        LSL_Float f = list.GetLSLFloatItem (i + 1);
                        skyData.star_brightness = (float)f.value;
                        break;
                    }
                case ScriptBaseClass.WL_SKY_SUNLIGHT_COLOR: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.sunlight_color = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_WATER_BIG_WAVE_DIRECTION: {
                        var rot = list.GetVector3Item (i + 1);
                        cycle.Water.wave1Dir = new Vector2 ((float)rot.x.value, (float)rot.y.value);
                        break;
                    }
                case ScriptBaseClass.WL_WATER_BLUR_MULTIPLIER: {
                        var f = list.GetLSLFloatItem (i + 1);
                        cycle.Water.blurMultiplier = (float)f.value;
                        break;
                    }
                case ScriptBaseClass.WL_WATER_FOG_COLOR: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        cycle.Water.waterFogColor = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_WATER_FOG_DENSITY: {
                        var f = list.GetLSLFloatItem (i + 1);
                        cycle.Water.waterFogDensity = (float)f.value;
                        break;
                    }
                case ScriptBaseClass.WL_WATER_FRESNEL_OFFSET: {
                        var f = list.GetLSLFloatItem (i + 1);
                        cycle.Water.fresnelOffset = (float)f.value;
                        break;
                    }
                case ScriptBaseClass.WL_WATER_FRESNEL_SCALE: {
                        var f = list.GetLSLFloatItem (i + 1);
                        cycle.Water.fresnelScale = (float)f.value;
                        break;
                    }
                case ScriptBaseClass.WL_WATER_LITTLE_WAVE_DIRECTION: {
                        var rot = list.GetVector3Item (i + 1);
                        cycle.Water.wave2Dir = new Vector2 ((float)rot.x.value, (float)rot.y.value);
                        break;
                    }
                case ScriptBaseClass.WL_WATER_NORMAL_MAP: {
                        var f = list.GetLSLStringItem (i + 1);
                        cycle.Water.normalMap = UUID.Parse (f.m_string);
                        break;
                    }
                case ScriptBaseClass.WL_WATER_NORMAL_SCALE: {
                        LSL_Vector rot = list.GetVector3Item (i + 1);
                        cycle.Water.normScale = rot.ToVector3 ();
                        break;
                    }
                case ScriptBaseClass.WL_WATER_SCALE_ABOVE: {
                        var f = list.GetLSLFloatItem (i + 1);
                        cycle.Water.scaleAbove = (float)f.value;
                        break;
                    }
                case ScriptBaseClass.WL_WATER_SCALE_BELOW: {
                        var f = list.GetLSLFloatItem (i + 1);
                        cycle.Water.scaleBelow = (float)f.value;
                        break;
                    }
                case ScriptBaseClass.WL_WATER_UNDERWATER_FOG_MODIFIER: {
                        var f = list.GetLSLFloatItem (i + 1);
                        cycle.Water.underWaterFogMod = (float)f.value;
                        break;
                    }
                }
            }
        }
コード例 #2
0
 public void SetDayCycle(WindlightDayCycle cycle)
 {
     m_scene.RegionInfo.EnvironmentSettings = cycle.ToOSD();
 }
コード例 #3
0
        void ConvertWindlightDayCycle (WindlightDayCycle cycle, int preset, int rule, ref LSL_List list)
        {
            var skyDatas = cycle.Cycle.DataSettings.Values.ToList ();
            var skyData = skyDatas [preset];

            switch (rule) {
            case ScriptBaseClass.WL_AMBIENT:
                list.Add (new LSL_Rotation (skyData.ambient.X, skyData.ambient.Y,
                                            skyData.ambient.Z, skyData.ambient.W));
                break;
            case ScriptBaseClass.WL_SKY_BLUE_DENSITY:
                list.Add (new LSL_Rotation (skyData.blue_density.X, skyData.blue_density.Y,
                                            skyData.blue_density.Z, skyData.blue_density.W));
                break;
            case ScriptBaseClass.WL_SKY_BLUR_HORIZON:
                list.Add (new LSL_Rotation (skyData.blue_horizon.X, skyData.blue_horizon.Y,
                                            skyData.blue_horizon.Z, skyData.blue_horizon.W));
                break;
            case ScriptBaseClass.WL_CLOUD_COLOR:
                list.Add (new LSL_Rotation (skyData.cloud_color.X, skyData.cloud_color.Y,
                                            skyData.cloud_color.Z, skyData.cloud_color.W));
                break;
            case ScriptBaseClass.WL_CLOUD_POS_DENSITY1:
                list.Add (new LSL_Rotation (skyData.cloud_pos_density1.X, skyData.cloud_pos_density1.Y,
                                            skyData.cloud_pos_density1.Z, skyData.cloud_pos_density1.W));
                break;
            case ScriptBaseClass.WL_CLOUD_POS_DENSITY2:
                list.Add (new LSL_Rotation (skyData.cloud_pos_density2.X, skyData.cloud_pos_density2.Y,
                                            skyData.cloud_pos_density2.Z, skyData.cloud_pos_density2.W));
                break;
            case ScriptBaseClass.WL_CLOUD_SCALE:
                list.Add (new LSL_Rotation (skyData.cloud_scale.X, skyData.cloud_scale.Y,
                                            skyData.cloud_scale.Z, skyData.cloud_scale.W));
                break;
            case ScriptBaseClass.WL_CLOUD_SCROLL_X:
                list.Add (new LSL_Float (skyData.cloud_scroll_rate.X));
                break;
            case ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
                list.Add (new LSL_Integer (skyData.enable_cloud_scroll.X));
                break;
            case ScriptBaseClass.WL_CLOUD_SCROLL_Y:
                list.Add (new LSL_Float (skyData.cloud_scroll_rate.Y));
                break;
            case ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
                list.Add (new LSL_Integer (skyData.enable_cloud_scroll.Y));
                break;
            case ScriptBaseClass.WL_CLOUD_SHADOW:
                list.Add (new LSL_Rotation (skyData.cloud_shadow.X, skyData.cloud_shadow.Y,
                                            skyData.cloud_shadow.Z, skyData.cloud_shadow.W));
                break;
            case ScriptBaseClass.WL_SKY_DENSITY_MULTIPLIER:
                list.Add (new LSL_Rotation (skyData.density_multiplier.X, skyData.density_multiplier.Y,
                                            skyData.density_multiplier.Z, skyData.density_multiplier.W));
                break;
            case ScriptBaseClass.WL_SKY_DISTANCE_MULTIPLIER:
                list.Add (new LSL_Rotation (skyData.distance_multiplier.X, skyData.distance_multiplier.Y,
                                            skyData.distance_multiplier.Z, skyData.distance_multiplier.W));
                break;
            case ScriptBaseClass.WL_SKY_GAMMA:
                list.Add (new LSL_Rotation (skyData.gamma.X, skyData.gamma.Y, skyData.gamma.Z, skyData.gamma.W));
                break;
            case ScriptBaseClass.WL_SKY_GLOW:
                list.Add (new LSL_Rotation (skyData.glow.X, skyData.glow.Y, skyData.glow.Z, skyData.glow.W));
                break;
            case ScriptBaseClass.WL_SKY_HAZE_DENSITY:
                list.Add (new LSL_Rotation (skyData.haze_density.X, skyData.haze_density.Y,
                                            skyData.haze_density.Z, skyData.haze_density.W));
                break;
            case ScriptBaseClass.WL_SKY_HAZE_HORIZON:
                list.Add (new LSL_Rotation (skyData.haze_horizon.X, skyData.haze_horizon.Y,
                                            skyData.haze_horizon.Z, skyData.haze_horizon.W));
                break;
            case ScriptBaseClass.WL_SKY_LIGHT_NORMALS:
                list.Add (new LSL_Rotation (skyData.lightnorm.X, skyData.lightnorm.Y,
                                            skyData.lightnorm.Z, skyData.lightnorm.W));
                break;
            case ScriptBaseClass.WL_SKY_MAX_ALTITUDE:
                list.Add (new LSL_Rotation (skyData.max_y.X, skyData.max_y.Y, skyData.max_y.Z, skyData.max_y.W));
                break;
            case ScriptBaseClass.WL_SKY_STAR_BRIGHTNESS:
                list.Add (new LSL_Float (skyData.star_brightness));
                break;
            case ScriptBaseClass.WL_SKY_SUNLIGHT_COLOR:
                list.Add (new LSL_Rotation (skyData.sunlight_color.X, skyData.sunlight_color.Y,
                                            skyData.sunlight_color.Z, skyData.sunlight_color.W));
                break;
            case ScriptBaseClass.WL_WATER_BLUR_MULTIPLIER:
                list.Add (new LSL_Float (cycle.Water.blurMultiplier));
                break;
            case ScriptBaseClass.WL_WATER_FRESNEL_OFFSET:
                list.Add (new LSL_Float (cycle.Water.fresnelOffset));
                break;
            case ScriptBaseClass.WL_WATER_FRESNEL_SCALE:
                list.Add (new LSL_Float (cycle.Water.fresnelScale));
                break;
            case ScriptBaseClass.WL_WATER_NORMAL_MAP:
                list.Add (new LSL_String (cycle.Water.normalMap));
                break;
            case ScriptBaseClass.WL_WATER_NORMAL_SCALE:
                list.Add (new LSL_Vector (cycle.Water.normScale.X, cycle.Water.normScale.Y, cycle.Water.normScale.Z));
                break;
            case ScriptBaseClass.WL_WATER_SCALE_ABOVE:
                list.Add (new LSL_Float (cycle.Water.scaleAbove));
                break;
            case ScriptBaseClass.WL_WATER_SCALE_BELOW:
                list.Add (new LSL_Float (cycle.Water.scaleBelow));
                break;
            case ScriptBaseClass.WL_WATER_UNDERWATER_FOG_MODIFIER:
                list.Add (new LSL_Float (cycle.Water.underWaterFogMod));
                break;
            case ScriptBaseClass.WL_WATER_FOG_COLOR:
                list.Add (new LSL_Rotation (cycle.Water.waterFogColor.X, cycle.Water.waterFogColor.Y,
                                            cycle.Water.waterFogColor.Z, cycle.Water.waterFogColor.W));
                break;
            case ScriptBaseClass.WL_WATER_FOG_DENSITY:
                list.Add (new LSL_Float (cycle.Water.waterFogDensity));
                break;
            case ScriptBaseClass.WL_WATER_BIG_WAVE_DIRECTION:
                list.Add (new LSL_Vector (cycle.Water.wave1Dir.X, cycle.Water.wave1Dir.Y, 0.0f));
                break;
            case ScriptBaseClass.WL_WATER_LITTLE_WAVE_DIRECTION:
                list.Add (new LSL_Vector (cycle.Water.wave2Dir.X, cycle.Water.wave2Dir.Y, 0.0f));
                break;
            }
        }
コード例 #4
0
 public WindlightDayCycle GetCurrentDayCycle()
 {
     if (m_scene.RegionInfo.EnvironmentSettings != null)
     {
         WindlightDayCycle cycle = new WindlightDayCycle();
         cycle.FromOSD(m_scene.RegionInfo.EnvironmentSettings);
         return cycle;
     }
     return null;
 }