Example #1
0
        public static LightingSkyboxColors Lerp(LightingSkyboxColors a, LightingSkyboxColors b, float t)
        {
            LightingSkyboxColors interpSkybox = new LightingSkyboxColors();

            interpSkybox.Unknown1 = WLinearColor.Lerp(a.Unknown1, b.Unknown1, t);
            interpSkybox.Unknown2 = WLinearColor.Lerp(a.Unknown2, b.Unknown2, t);
            interpSkybox.Unknown3 = WLinearColor.Lerp(a.Unknown3, b.Unknown3, t);
            interpSkybox.Unknown4 = WLinearColor.Lerp(a.Unknown4, b.Unknown4, t);

            interpSkybox.HorizonCloud = WLinearColor.Lerp(a.HorizonCloud, b.HorizonCloud, t);
            interpSkybox.CenterCloud  = WLinearColor.Lerp(a.CenterCloud, b.CenterCloud, t);
            interpSkybox.Sky          = WLinearColor.Lerp(a.Sky, b.Sky, t);
            interpSkybox.FalseSea     = WLinearColor.Lerp(a.FalseSea, b.FalseSea, t);
            interpSkybox.Horizon      = WLinearColor.Lerp(a.Horizon, b.Horizon, t);

            return(interpSkybox);
        }
        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 LightingPalette Lerp(float t, bool presetA = true)
        {
            LightingPalette[] palette = presetA ? TimePresetA : TimePresetB;

            // Generate a new LightingPalette which is the interpolated values of things.
            t = WMath.Clamp(t, 0, 1);
            float scaledT    = t * (palette.Length - 1);
            int   lowerIndex = (int)scaledT;
            int   upperIndex = (int)(scaledT + 1f);
            float newT       = scaledT - (int)scaledT;

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

            if (upperIndex == palette.Length)
            {
                upperIndex = lowerIndex;
            }

            LightingPalette interpPalette = new LightingPalette();

            interpPalette.Shadow        = WLinearColor.Lerp(palette[lowerIndex].Shadow, palette[upperIndex].Shadow, newT);
            interpPalette.ActorAmbient  = WLinearColor.Lerp(palette[lowerIndex].ActorAmbient, palette[upperIndex].ActorAmbient, newT);
            interpPalette.RoomLight     = WLinearColor.Lerp(palette[lowerIndex].RoomLight, palette[upperIndex].RoomLight, newT);
            interpPalette.RoomAmbient   = WLinearColor.Lerp(palette[lowerIndex].RoomAmbient, palette[upperIndex].RoomAmbient, newT);
            interpPalette.WaveColor     = WLinearColor.Lerp(palette[lowerIndex].WaveColor, palette[upperIndex].WaveColor, newT);
            interpPalette.OceanColor    = WLinearColor.Lerp(palette[lowerIndex].OceanColor, palette[upperIndex].OceanColor, newT);
            interpPalette.UnknownWhite1 = WLinearColor.Lerp(palette[lowerIndex].UnknownWhite1, palette[upperIndex].UnknownWhite1, newT);
            interpPalette.UnknownWhite2 = WLinearColor.Lerp(palette[lowerIndex].UnknownWhite2, palette[upperIndex].UnknownWhite2, newT);
            interpPalette.Doorway       = WLinearColor.Lerp(palette[lowerIndex].Doorway, palette[upperIndex].Doorway, newT);
            interpPalette.UnknownColor3 = WLinearColor.Lerp(palette[lowerIndex].UnknownColor3, palette[upperIndex].UnknownColor3, newT);
            interpPalette.Skybox        = LightingSkyboxColors.Lerp(palette[lowerIndex].Skybox, palette[upperIndex].Skybox, newT);
            interpPalette.Fog           = WLinearColor.Lerp(palette[lowerIndex].Fog, palette[upperIndex].Fog, newT);
            interpPalette.FogNearPlane  = WMath.Lerp(palette[lowerIndex].FogNearPlane, palette[upperIndex].FogNearPlane, newT);
            interpPalette.FogFarPlane   = WMath.Lerp(palette[lowerIndex].FogFarPlane, palette[upperIndex].FogFarPlane, newT);

            return(interpPalette);
        }
        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);
        }