Beispiel #1
0
        public EnvironmentLightingPalette Lerp(WeatherPreset weather, bool presetA, float t)
        {
            EnvironmentLightingTimesOfDay cur_time = null;

            switch (weather)
            {
            case WeatherPreset.Default:
                cur_time = Clear;
                break;

            case WeatherPreset.Raining:
                cur_time = Raining;
                break;

            case WeatherPreset.Snowing:
                cur_time = Snowing;
                break;

            case WeatherPreset.Unknown2:
                cur_time = ForestParticles;
                break;

            default:
                return(null);
            }

            return(cur_time.Lerp(t));
        }
Beispiel #2
0
        public override void PostLoad()
        {
            if (Parent == null || Parent.Parent == null)
            {
                return;
            }

            List <EnvironmentLightingTimesOfDay> times = Parent.Parent.GetChildrenOfType <EnvironmentLightingTimesOfDay>();

            Clear           = m_ClearIndex < times.Count           ? times[m_ClearIndex]           : null;
            Raining         = m_RainingIndex < times.Count         ? times[m_RainingIndex]         : null;
            Snowing         = m_SnowingIndex < times.Count         ? times[m_SnowingIndex]         : null;
            ForestParticles = m_ForestParticlesIndex < times.Count ? times[m_ForestParticlesIndex] : null;
        }
Beispiel #3
0
        private List <EnvironmentLighting> GetLightingData()
        {
            List <EnvironmentLighting>  lights   = new List <EnvironmentLighting>();
            List <LightingTimePreset>   times    = new List <LightingTimePreset>();
            List <LightingPalette>      palettes = new List <LightingPalette>();
            List <LightingSkyboxColors> skyboxes = new List <LightingSkyboxColors>();

            if (!m_fourCCGroups.ContainsKey(FourCC.EnvR) ||
                !m_fourCCGroups.ContainsKey(FourCC.Colo) ||
                !m_fourCCGroups.ContainsKey(FourCC.Virt) ||
                !m_fourCCGroups.ContainsKey(FourCC.Pale))
            {
                return(lights);
            }

            foreach (var virt in m_fourCCGroups[FourCC.Virt].Children)
            {
                EnvironmentLightingSkyboxColors skybox    = (EnvironmentLightingSkyboxColors)virt;
                LightingSkyboxColors            skycolors = new LightingSkyboxColors(skybox);

                skyboxes.Add(skycolors);
            }

            foreach (var pale in m_fourCCGroups[FourCC.Pale].Children)
            {
                EnvironmentLightingColors colors  = (EnvironmentLightingColors)pale;
                LightingPalette           palette = new LightingPalette(colors);

                if (colors.SkyboxColorIndex < skyboxes.Count)
                {
                    palette.Skybox = skyboxes[colors.SkyboxColorIndex];
                }
                else
                {
                    palette.Skybox = new LightingSkyboxColors();
                }

                palettes.Add(palette);
            }

            foreach (var colo in m_fourCCGroups[FourCC.Colo].Children)
            {
                EnvironmentLightingTimesOfDay daytimes = (EnvironmentLightingTimesOfDay)colo;
                LightingTimePreset            preset   = new LightingTimePreset();

                preset.TimePresetA[0] = palettes[daytimes.DawnA];
                preset.TimePresetA[1] = palettes[daytimes.MorningA];
                preset.TimePresetA[2] = palettes[daytimes.NoonA];
                preset.TimePresetA[3] = palettes[daytimes.AfternoonA];
                preset.TimePresetA[4] = palettes[daytimes.DuskA];
                preset.TimePresetA[5] = palettes[daytimes.NightA];

                preset.TimePresetB[0] = palettes[0]; //daytimes.DawnB];
                preset.TimePresetB[1] = palettes[0]; //palettes[daytimes.MorningB];
                preset.TimePresetB[2] = palettes[0]; //palettes[daytimes.NoonB];
                preset.TimePresetB[3] = palettes[0]; //palettes[daytimes.AfternoonB];
                preset.TimePresetB[4] = palettes[0]; //palettes[daytimes.DuskB];
                preset.TimePresetB[5] = palettes[0]; //palettes[daytimes.NightB];

                times.Add(preset);
            }

            foreach (var envr in m_fourCCGroups[FourCC.EnvR].Children)
            {
                EnvironmentLightingConditions condition = (EnvironmentLightingConditions)envr;
                EnvironmentLighting           env       = new EnvironmentLighting();

                env.WeatherA[0] = times[condition.ClearA];
                env.WeatherA[1] = times[condition.RainingA < times.Count ? condition.RainingA : 0];
                env.WeatherA[2] = times[condition.SnowingA];
                env.WeatherA[3] = times[condition.UnknownA];

                env.WeatherB[0] = times[condition.ClearB];
                env.WeatherB[1] = times[condition.RainingB];
                env.WeatherB[2] = times[condition.SnowingB];
                env.WeatherB[3] = times[condition.UnknownB];

                lights.Add(env);
            }

            return(lights);
        }