예제 #1
0
        public void FromLightShare(RegionLightShareData ls)
        {
            WaterData water = new WaterData();

            water.waterFogColor   = ls.waterColor / 256f;
            water.waterFogDensity = (float)Math.Pow(2.0f, ls.waterFogDensityExponent);
            //water.waterFogDensity = ls.waterFogDensityExponent;
            water.underWaterFogMod = ls.underwaterFogModifier;
            water.normScale        = ls.reflectionWaveletScale;
            water.fresnelScale     = ls.fresnelScale;
            water.fresnelOffset    = ls.fresnelOffset;
            water.scaleAbove       = ls.refractScaleAbove;
            water.scaleBelow       = ls.refractScaleBelow;
            water.blurMultiplier   = ls.blurMultiplier;
            water.wave1Dir         = ls.littleWaveDirection;
            water.wave2Dir         = ls.bigWaveDirection;
            water.normalMap        = ls.normalMapTexture;
            water.Name             = "LightshareWater";

            SkyData sky = new SkyData();

            convertFromAngles(sky, 2.0f * (float)Math.PI * ls.sunMoonPosition, 2.0f * (float)Math.PI * ls.eastAngle);
            sky.sunlight_color      = ls.sunMoonColor * 3.0f;
            sky.ambient             = new Vector3(ls.ambient.X * 3.0f, ls.ambient.Y * 3.0f, ls.ambient.Z * 3.0f);
            sky.blue_horizon        = new Vector3(ls.horizon.X * 2.0f, ls.horizon.Y * 2.0f, ls.horizon.Z * 2.0f);
            sky.blue_density        = new Vector3(ls.blueDensity.X * 2.0f, ls.blueDensity.Y * 2.0f, ls.blueDensity.Z * 2.0f);;
            sky.haze_horizon        = ls.hazeHorizon;
            sky.haze_density        = ls.hazeDensity;
            sky.cloud_shadow        = ls.cloudCoverage;
            sky.density_multiplier  = ls.densityMultiplier / 1000.0f;
            sky.distance_multiplier = ls.distanceMultiplier;
            sky.max_y              = ls.maxAltitude;
            sky.cloud_color        = new Vector3(ls.cloudColor.X, ls.cloudColor.Y, ls.cloudColor.Z);
            sky.cloud_pos_density1 = ls.cloudXYDensity;
            sky.cloud_pos_density2 = ls.cloudDetailXYDensity;
            sky.cloud_scale        = ls.cloudScale;
            sky.gamma              = ls.sceneGamma;
            sky.glow = new Vector3((2f - ls.sunGlowSize) * 20f, 0f, -ls.sunGlowFocus * 5f);
            sky.cloud_scroll_rate = new Vector2(ls.cloudScrollX, ls.cloudScrollY);
            if (ls.cloudScrollXLock)
            {
                sky.cloud_scroll_rate.X = 0;
            }
            if (ls.cloudScrollYLock)
            {
                sky.cloud_scroll_rate.Y = 0;
            }
            sky.star_brightness = ls.starBrightness * 250f;
            sky.Name            = "LightshareSky";

            Cycle      = new DayCycle();
            Cycle.Name = "Lightshare";
            Cycle.waterframes.Add(water.Name, water);
            DayCycle.TrackEntry track = new DayCycle.TrackEntry(-1, water.Name);
            Cycle.waterTrack.Add(track);

            Cycle.skyframes.Add(sky.Name, sky);
            track = new DayCycle.TrackEntry(-1, sky.Name);
            Cycle.skyTrack0.Add(track);
        }
예제 #2
0
        public bool CycleFromOSD(OSD osd)
        {
            OSDMap map = osd as OSDMap;

            if (map == null)
            {
                return(false);
            }
            if (!map.TryGetValue("type", out OSD tmp))
            {
                return(false);
            }
            string type = tmp.AsString();

            if (type != "daycycle")
            {
                return(false);
            }
            Cycle = new DayCycle();
            Cycle.FromOSD(map);

            InvalidateCaches();

            return(true);
        }
예제 #3
0
        public void FromOSD(OSD osd)
        {
            OSDMap map = osd as OSDMap;

            if (map == null)
            {
                return;
            }

            OSD otmp;

            if (map.TryGetValue("day_cycle", out otmp) && otmp is OSDMap)
            {
                Cycle = new DayCycle();
                Cycle.FromOSD(otmp as OSDMap);
            }
            if (Cycle == null)
            {
                Cycle = new DayCycle();
            }

            if (map.TryGetValue("day_length", out otmp))
            {
                DayLength = otmp;
            }
            if (map.TryGetValue("day_offset", out otmp))
            {
                DayOffset = otmp;
            }
            if (map.TryGetValue("flags", out otmp))
            {
                Flags = otmp;
            }
            if (map.TryGetValue("env_version", out otmp))
            {
                version = otmp;
            }
            else
            {
                ++version;
            }

            if (map.TryGetValue("track_altitudes", out otmp) && otmp is OSDArray)
            {
                OSDArray alt = otmp as OSDArray;

                for (int i = 0; i < alt.Count && i < 3; ++i)
                {
                    Altitudes[i] = alt[i];
                }

                SortAltitudes();
            }

            IsLegacy = false;
            InvalidateCaches();
        }
예제 #4
0
        public void FromWLOSD(OSD osd)
        {
            OSDArray array = osd as OSDArray;

            if (osd != null)
            {
                Cycle = new DayCycle();
                Cycle.FromWLOSD(array);
            }
        }
예제 #5
0
        public bool FromAssetOSD(string name, OSD osd)
        {
            OSDMap map = osd as OSDMap;

            if (map == null)
            {
                return(false);
            }
            if (!map.TryGetValue("type", out OSD tmp))
            {
                return(false);
            }
            string type = tmp.AsString();

            bool ok = false;

            if (type == "water")
            {
                if (Cycle == null)
                {
                    Cycle = new DayCycle();
                }
                ok = Cycle.replaceWaterFromOSD(name, map);
            }
            else
            {
                if (type == "daycycle")
                {
                    Cycle = new DayCycle();
                    Cycle.FromOSD(map);
                    ok = true;
                }
                else if (type == "sky")
                {
                    if (Cycle == null)
                    {
                        Cycle = new DayCycle();
                    }
                    ok = Cycle.replaceSkyFromOSD(name, map);
                }
            }
            if (ok && !string.IsNullOrWhiteSpace(name))
            {
                Cycle.Name = name;
            }

            InvalidateCaches();
            return(ok);
        }