public void OnSetGodrayUniforms(ShaderProgramGodrays rays)
        {
            // custom uniform calls
            var calendar               = _mod.CApi.World.Calendar;
            var ambient                = _mod.CApi.Ambient;
            var uniforms               = _mod.CApi.Render.ShaderUniforms;
            var myUniforms             = _mod.Uniforms;
            var dropShadowIntensityObj = _dropShadowIntensityField?.GetValue(_mod.CApi.Ambient);

            if (dropShadowIntensityObj == null)
            {
                _mod.Mod.Logger.Fatal("DropShadowIntensity not found!");
                return;
            }

            var dropShadowIntensity = (float)dropShadowIntensityObj;

            var playerWaterDepth = _game.playerProperties.EyesInWaterDepth;

            rays.Uniform("moonLightStrength", calendar.MoonLightStrength);
            rays.Uniform("sunLightStrength", calendar.SunLightStrength);
            rays.Uniform("dayLightStrength", calendar.DayLightStrength);
            rays.Uniform("shadowIntensity", dropShadowIntensity);
            rays.Uniform("flatFogDensity", ambient.BlendedFlatFogDensity);
            rays.Uniform("playerWaterDepth", playerWaterDepth);
            rays.Uniform("fogColor", ambient.BlendedFogColor);
            rays.UniformMatrix("invProjectionMatrix", myUniforms.InvProjectionMatrix);
            rays.UniformMatrix("invModelViewMatrix", myUniforms.InvModelViewMatrix);
        }
Ejemplo n.º 2
0
        public void OnSetGodrayUniforms(ShaderProgramGodrays rays)
        {
            // custom uniform calls
            var calendar = mod.capi.World.Calendar;
            var dropShadowIntensityObj = typeof(AmbientManager)
                                         .GetField("DropShadowIntensity", BindingFlags.NonPublic | BindingFlags.Instance)?
                                         .GetValue(mod.capi.Ambient);

            if (dropShadowIntensityObj == null)
            {
                mod.Mod.Logger.Fatal("DropShadowIntensity not found!");
                return;
            }

            var dropShadowIntensity = (float)dropShadowIntensityObj;

            rays.Uniform("moonLightStrength", calendar.MoonLightStrength);
            rays.Uniform("sunLightStrength", calendar.SunLightStrength);
            rays.Uniform("dayLightStrength", calendar.DayLightStrength);
            rays.Uniform("shadowIntensity", dropShadowIntensity);
            rays.Uniform("flatFogDensity", mod.capi.Ambient.BlendedFlatFogDensity);
        }
Ejemplo n.º 3
0
 public static void GodrayCallsite(ShaderProgramGodrays rays)
 {
     VolumetricShadingMod.Instance.Events.EmitPreGodraysRender(rays);
 }
Ejemplo n.º 4
0
 public void EmitPreGodraysRender(ShaderProgramGodrays godrays)
 {
     PreGodraysRender?.Invoke(godrays);
 }
Ejemplo n.º 5
0
 public static void GodrayCallsite(ShaderProgramGodrays rays)
 {
     ShadersMod.Instance.VolumetricLighting.OnSetGodrayUniforms(rays);
 }