Example #1
0
        public override void PostLoad()
        {
            if (Parent == null || Parent.Parent == null)
            {
                return;
            }

            List <EnvironmentLightingSkyboxPalette> skybox_palettes = Parent.Parent.GetChildrenOfType <EnvironmentLightingSkyboxPalette>();

            SkyboxPalette = m_SkyboxPaletteIndex < skybox_palettes.Count ? skybox_palettes[m_SkyboxPaletteIndex] : null;
        }
        public static EnvironmentLightingSkyboxPalette Lerp(EnvironmentLightingSkyboxPalette palette_a, EnvironmentLightingSkyboxPalette palette_b, float t)
        {
            if (palette_a == null || palette_b == null)
            {
                return(new EnvironmentLightingSkyboxPalette());
            }

            EnvironmentLightingSkyboxPalette interpSkybox = new EnvironmentLightingSkyboxPalette();

            interpSkybox.Unknown1 = WLinearColor.Lerp(palette_a.Unknown1, palette_b.Unknown1, t);
            interpSkybox.Unknown2 = WLinearColor.Lerp(palette_a.Unknown2, palette_b.Unknown2, t);
            interpSkybox.Unknown3 = WLinearColor.Lerp(palette_a.Unknown3, palette_b.Unknown3, t);
            interpSkybox.Unknown4 = WLinearColor.Lerp(palette_a.Unknown4, palette_b.Unknown4, t);

            interpSkybox.HorizonCloudColor = WLinearColor.Lerp(palette_a.HorizonCloudColor, palette_b.HorizonCloudColor, t);
            interpSkybox.CenterCloudColor  = WLinearColor.Lerp(palette_a.CenterCloudColor, palette_b.CenterCloudColor, t);
            interpSkybox.SkyColor          = WLinearColor.Lerp(palette_a.SkyColor, palette_b.SkyColor, t);
            interpSkybox.FalseSeaColor     = WLinearColor.Lerp(palette_a.FalseSeaColor, palette_b.FalseSeaColor, t);
            interpSkybox.HorizonColor      = WLinearColor.Lerp(palette_a.HorizonColor, palette_b.HorizonColor, t);

            return(interpSkybox);
        }
Example #3
0
 public void SetColors(EnvironmentLightingSkyboxPalette col)
 {
     m_colors = col;
 }
Example #4
0
 public WSkyboxNode(WWorld world) : base(world)
 {
     IsVisible = false;
     m_colors  = new EnvironmentLightingSkyboxPalette();
 }
        public EnvironmentLightingPalette Lerp(float t, bool presetA = true)
        {
            // Generate a new LightingPalette which is the interpolated values of things.
            t = WMath.Clamp(t, 0, 1);
            float scaledT    = t * (6 - 1);
            int   lowerIndex = (int)scaledT;
            int   upperIndex = (int)(scaledT + 1f);
            float newT       = scaledT - (int)scaledT;

            EnvironmentLightingPalette palette_a = null;
            EnvironmentLightingPalette palette_b = null;

            if (upperIndex == 6)
            {
                upperIndex = lowerIndex;
            }

            switch ((TimeOfDay)lowerIndex)
            {
            case TimeOfDay.Dawn:
                palette_a = Dawn;
                break;

            case TimeOfDay.Morning:
                palette_a = Morning;
                break;

            case TimeOfDay.Noon:
                palette_a = Noon;
                break;

            case TimeOfDay.Afternoon:
                palette_a = Afternoon;
                break;

            case TimeOfDay.Dusk:
                palette_a = Dusk;
                break;

            case TimeOfDay.Night:
                palette_a = Night;
                break;
            }

            switch ((TimeOfDay)upperIndex)
            {
            case TimeOfDay.Dawn:
                palette_b = Dawn;
                break;

            case TimeOfDay.Morning:
                palette_b = Morning;
                break;

            case TimeOfDay.Noon:
                palette_b = Noon;
                break;

            case TimeOfDay.Afternoon:
                palette_b = Afternoon;
                break;

            case TimeOfDay.Dusk:
                palette_b = Dusk;
                break;

            case TimeOfDay.Night:
                palette_b = Night;
                break;
            }

            //Console.WriteLine("t: {0} scaledT: {1} lIndex: {2} uIndex: {3} newT: {4}", t, scaledT, lowerIndex, upperIndex, newT);

            EnvironmentLightingPalette interpPalette = new EnvironmentLightingPalette();

            interpPalette.ShadowColor       = WLinearColor.Lerp(palette_a.ShadowColor, palette_b.ShadowColor, newT);
            interpPalette.ActorAmbientColor = WLinearColor.Lerp(palette_a.ActorAmbientColor, palette_b.ActorAmbientColor, newT);
            interpPalette.RoomLightColor    = WLinearColor.Lerp(palette_a.RoomLightColor, palette_b.RoomLightColor, newT);
            interpPalette.RoomAmbientColor  = WLinearColor.Lerp(palette_a.RoomAmbientColor, palette_b.RoomAmbientColor, newT);
            interpPalette.WaveColor         = WLinearColor.Lerp(palette_a.WaveColor, palette_b.WaveColor, newT);
            interpPalette.OceanColor        = WLinearColor.Lerp(palette_a.OceanColor, palette_b.OceanColor, newT);
            interpPalette.UnknownWhite1     = WLinearColor.Lerp(palette_a.UnknownWhite1, palette_b.UnknownWhite1, newT);
            interpPalette.UnknownWhite2     = WLinearColor.Lerp(palette_a.UnknownWhite2, palette_b.UnknownWhite2, newT);
            interpPalette.DoorBackfill      = WLinearColor.Lerp(palette_a.DoorBackfill, palette_b.DoorBackfill, newT);
            interpPalette.Unknown3          = WLinearColor.Lerp(palette_a.Unknown3, palette_b.Unknown3, newT);
            interpPalette.SkyboxPalette     = EnvironmentLightingSkyboxPalette.Lerp(palette_a.SkyboxPalette, palette_b.SkyboxPalette, newT);
            interpPalette.FogColor          = WLinearColor.Lerp(palette_a.FogColor, palette_b.FogColor, newT);
            interpPalette.FogNearPlane      = WMath.Lerp(palette_a.FogNearPlane, palette_b.FogNearPlane, newT);
            interpPalette.FogFarPlane       = WMath.Lerp(palette_a.FogFarPlane, palette_b.FogFarPlane, newT);

            return(interpPalette);
        }