Beispiel #1
0
        /// <summary>
        /// Loads all shaders from the backing engine given.
        /// </summary>
        /// <param name="Shaders">The given backing shader engine.</param>
        /// <param name="AllowLL">Whether to allow and load the LL lighting helper.</param>
        /// <param name="forNorm">Whether to enable forward-mode normal effects.</param>
        /// <param name="forLight">Whether to enable forward-mode lighting.</param>
        /// <param name="forShad">Whether to enable forward-mode shadow effects.</param>
        public void LoadAll(ShaderEngine Shaders, bool AllowLL, bool forNorm, bool forLight, bool forShad)
        {
            string def = Shaders.MCM_GOOD_GRAPHICS ? "#MCM_GOOD_GRAPHICS" : "#";

            Deferred.ShadowPass_Basic            = Shaders.GetShader("shadow" + def);
            Deferred.ShadowPass_NoBones          = Shaders.GetShader("shadow" + def + ",MCM_NO_BONES");
            Deferred.GBufferSolid                = Shaders.GetShader("fbo" + def);
            Deferred.GBuffer_AllTransparencies   = Shaders.GetShader("fbo" + def + ",MCM_TRANSP_ALLOWED");
            Deferred.GBuffer_Refraction          = Shaders.GetShader("fbo" + def + ",MCM_REFRACT");
            Deferred.ShadowAdderPass             = Shaders.GetShader("lightadder" + def + ",MCM_SHADOWS");
            Deferred.LightAdderPass              = Shaders.GetShader("lightadder" + def);
            Deferred.ShadowAdderPass_SSAO        = Shaders.GetShader("lightadder" + def + ",MCM_SHADOWS,MCM_SSAO");
            Deferred.LightAdderPass_SSAO         = Shaders.GetShader("lightadder" + def + ",MCM_SSAO");
            Deferred.Transparents                = Shaders.GetShader("transponly" + def);
            Deferred.Transparents_Lights         = Shaders.GetShader("transponly" + def + ",MCM_LIT");
            Deferred.Transparents_Lights_Shadows = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_SHADOWS");
            Deferred.Godrays = Shaders.GetShader("godray" + def);
            Deferred.TransparentAdderPass        = Shaders.GetShader("transpadder" + def);
            Deferred.FinalPass_Basic             = Shaders.GetShader("finalgodray" + def);
            Deferred.FinalPass_Toonify           = Shaders.GetShader("finalgodray" + def + ",MCM_TOONIFY");
            Deferred.FinalPass_Lights            = Shaders.GetShader("finalgodray" + def + ",MCM_LIGHTS");
            Deferred.FinalPass_Lights_Toonify    = Shaders.GetShader("finalgodray" + def + ",MCM_LIGHTS,MCM_TOONIFY");
            Deferred.FinalPass_Lights_MotionBlur = Shaders.GetShader("finalgodray" + def + ",MCM_LIGHTS,MCM_MOTBLUR");
            string forw_extra = (forNorm ? ",MCM_NORMALS" : "")
                                + (forLight ? ",MCM_LIGHTS" : "")
                                + (forShad ? ",MCM_SHADOWS" : "");

            Forward.BasicSolid               = Shaders.GetShader("forward" + def + forw_extra);
            Forward.BasicSolid_NoBones       = Shaders.GetShader("forward" + def + ",MCM_NO_BONES" + forw_extra);
            Forward.BasicTransparent         = Shaders.GetShader("forward" + def + ",MCM_TRANSP" + forw_extra);
            Forward.BasicTransparent_NoBones = Shaders.GetShader("forward" + def + ",MCM_TRANSP,MCM_NO_BONES" + forw_extra);
            if (AllowLL)
            {
                Deferred.Transparents_LL                = Shaders.GetShader("transponly" + def + ",MCM_LL");
                Deferred.Transparents_Lights_LL         = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_LL");
                Deferred.Transparents_Lights_Shadows_LL = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_SHADOWS,MCM_LL");
                Deferred.LLClearerPass = Shaders.GetShader("clearer" + def);
                Deferred.LLFinalPass   = Shaders.GetShader("fpass" + def);
            }
            Deferred.HDRPass                               = Shaders.GetShader("hdrpass" + def);
            Forward.PostProcess                            = Shaders.GetShader("postfast" + def);
            Forward.Grass                                  = Shaders.GetShader("forward" + def + ",MCM_GEOM_ACTIVE,MCM_GEOM_THREED_TEXTURE" + forw_extra + "?grass");
            Deferred.GBuffer_Grass                         = Shaders.GetShader("fbo" + def + ",MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_GEOM_THREED_TEXTURE?grass");
            Deferred.ShadowPass_Grass                      = Shaders.GetShader("shadow" + def + ",MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_SHADOWS,MCM_IS_A_SHADOW,MCM_GEOM_THREED_TEXTURE?grass");
            Deferred.ShadowPass_Particles                  = Shaders.GetShader("shadow" + def + ",MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_SHADOWS,MCM_NO_ALPHA_CAP,MCM_FADE_DEPTH,MCM_IS_A_SHADOW?particles");
            Forward.Particles                              = Shaders.GetShader("forward" + def + ",MCM_GEOM_ACTIVE,MCM_TRANSP,MCM_BRIGHT,MCM_NO_ALPHA_CAP,MCM_FADE_DEPTH" + forw_extra + "?particles");
            Deferred.GBuffer_Decals                        = Shaders.GetShader("fbo" + def + ",MCM_INVERSE_FADE,MCM_NO_ALPHA_CAP,MCM_GEOM_ACTIVE,MCM_PRETTY?decal");
            Forward.Decals                                 = Shaders.GetShader("forward" + def + ",MCM_INVERSE_FADE,MCM_NO_ALPHA_CAP,MCM_GEOM_ACTIVE" + forw_extra + "?decal");
            Forward.AllTransparencies_NoFog                = Shaders.GetShader("forward" + def + ",MCM_NO_ALPHA_CAP,MCM_BRIGHT,MCM_NO_BONES" + forw_extra);
            Forward.AllTransparencies_Objects              = Shaders.GetShader("forward" + def + ",MCM_NO_BONES" + forw_extra);
            Forward.AllTransparencies_Sky                  = Shaders.GetShader("forward" + def + ",MCM_NO_ALPHA_CAP,MCM_BRIGHT,MCM_NO_BONES,MCM_SKY_FOG" + forw_extra);
            Deferred.Transparents_Particles                = Shaders.GetShader("transponly" + def + ",MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
            Deferred.Transparents_Particles_Lights         = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
            Deferred.Transparents_Particles_Lights_Shadows = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_SHADOWS,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
            if (AllowLL)
            {
                Deferred.Transparents_Particles_LL                = Shaders.GetShader("transponly" + def + ",MCM_LL,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
                Deferred.Transparents_Particles_Lights_LL         = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_LL,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
                Deferred.Transparents_Particles_Lights_Shadows_LL = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_SHADOWS,MCM_LL,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
            }
        }
        /// <summary>
        /// Loads all shaders from the backing engine given.
        /// </summary>
        /// <param name="Shaders">The given backing shader engine.</param>
        /// <param name="AllowLL">Whether to allow and load the LL lighting helper.</param>
        /// <param name="forNorm">Whether to enable forward-mode normal effects.</param>
        /// <param name="forLight">Whether to enable forward-mode lighting.</param>
        /// <param name="forShad">Whether to enable forward-mode shadow effects.</param>
        public void LoadAll(ShaderEngine Shaders, bool AllowLL, bool forNorm, bool forLight, bool forShad)
        {
            string def = Shaders.MCM_GOOD_GRAPHICS ? "#MCM_GOOD_GRAPHICS" : "#";

            s_shadow                     = Shaders.GetShader("shadow" + def);
            s_shadow_nobones             = Shaders.GetShader("shadow" + def + ",MCM_NO_BONES");
            s_fbo                        = Shaders.GetShader("fbo" + def);
            s_fbot                       = Shaders.GetShader("fbo" + def + ",MCM_TRANSP_ALLOWED");
            s_fbo_refract                = Shaders.GetShader("fbo" + def + ",MCM_REFRACT");
            s_shadowadder                = Shaders.GetShader("lightadder" + def + ",MCM_SHADOWS");
            s_lightadder                 = Shaders.GetShader("lightadder" + def);
            s_shadowadder_ssao           = Shaders.GetShader("lightadder" + def + ",MCM_SHADOWS,MCM_SSAO");
            s_lightadder_ssao            = Shaders.GetShader("lightadder" + def + ",MCM_SSAO");
            s_transponly                 = Shaders.GetShader("transponly" + def);
            s_transponlylit              = Shaders.GetShader("transponly" + def + ",MCM_LIT");
            s_transponlylitsh            = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_SHADOWS");
            s_godray                     = Shaders.GetShader("godray" + def);
            s_transpadder                = Shaders.GetShader("transpadder" + def);
            s_finalgodray                = Shaders.GetShader("finalgodray" + def);
            s_finalgodray_toonify        = Shaders.GetShader("finalgodray" + def + ",MCM_TOONIFY");
            s_finalgodray_lights         = Shaders.GetShader("finalgodray" + def + ",MCM_LIGHTS");
            s_finalgodray_lights_toonify = Shaders.GetShader("finalgodray" + def + ",MCM_LIGHTS,MCM_TOONIFY");
            s_finalgodray_lights_motblur = Shaders.GetShader("finalgodray" + def + ",MCM_LIGHTS,MCM_MOTBLUR");
            string forw_extra = (forNorm ? ",MCM_NORMALS" : "")
                                + (forLight ? ",MCM_LIGHTS" : "")
                                + (forShad ? ",MCM_SHADOWS" : "");

            s_forw               = Shaders.GetShader("forward" + def + forw_extra);
            s_forw_nobones       = Shaders.GetShader("forward" + def + ",MCM_NO_BONES" + forw_extra);
            s_forw_trans         = Shaders.GetShader("forward" + def + ",MCM_TRANSP" + forw_extra);
            s_forw_trans_nobones = Shaders.GetShader("forward" + def + ",MCM_TRANSP,MCM_NO_BONES" + forw_extra);
            if (AllowLL)
            {
                s_transponly_ll      = Shaders.GetShader("transponly" + def + ",MCM_LL");
                s_transponlylit_ll   = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_LL");
                s_transponlylitsh_ll = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_SHADOWS,MCM_LL");
                s_ll_clearer         = Shaders.GetShader("clearer" + def);
                s_ll_fpass           = Shaders.GetShader("fpass" + def);
            }
            s_hdrpass                   = Shaders.GetShader("hdrpass" + def);
            s_post_fast                 = Shaders.GetShader("postfast" + def);
            s_forw_grass                = Shaders.GetShader("forward" + def + ",MCM_GEOM_ACTIVE,MCM_GEOM_THREED_TEXTURE" + forw_extra + "?grass");
            s_fbo_grass                 = Shaders.GetShader("fbo" + def + ",MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_GEOM_THREED_TEXTURE?grass");
            s_shadow_grass              = Shaders.GetShader("shadow" + def + ",MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_SHADOWS,MCM_IS_A_SHADOW,MCM_GEOM_THREED_TEXTURE?grass");
            s_shadow_parts              = Shaders.GetShader("shadow" + def + ",MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_SHADOWS,MCM_NO_ALPHA_CAP,MCM_FADE_DEPTH,MCM_IS_A_SHADOW?particles");
            s_forw_particles            = Shaders.GetShader("forward" + def + ",MCM_GEOM_ACTIVE,MCM_TRANSP,MCM_BRIGHT,MCM_NO_ALPHA_CAP,MCM_FADE_DEPTH" + forw_extra + "?particles");
            s_fbodecal                  = Shaders.GetShader("fbo" + def + ",MCM_INVERSE_FADE,MCM_NO_ALPHA_CAP,MCM_GEOM_ACTIVE,MCM_PRETTY?decal");
            s_forwdecal                 = Shaders.GetShader("forward" + def + ",MCM_INVERSE_FADE,MCM_NO_ALPHA_CAP,MCM_GEOM_ACTIVE" + forw_extra + "?decal");
            s_forwt_nofog               = Shaders.GetShader("forward" + def + ",MCM_NO_ALPHA_CAP,MCM_BRIGHT,MCM_NO_BONES" + forw_extra);
            s_forwt_obj                 = Shaders.GetShader("forward" + def + ",MCM_NO_BONES" + forw_extra);
            s_forwt                     = Shaders.GetShader("forward" + def + ",MCM_NO_ALPHA_CAP,MCM_BRIGHT,MCM_NO_BONES,MCM_SKY_FOG" + forw_extra);
            s_transponly_particles      = Shaders.GetShader("transponly" + def + ",MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
            s_transponlylit_particles   = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
            s_transponlylitsh_particles = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_SHADOWS,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
            if (AllowLL)
            {
                s_transponly_ll_particles      = Shaders.GetShader("transponly" + def + ",MCM_LL,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
                s_transponlylit_ll_particles   = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_LL,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
                s_transponlylitsh_ll_particles = Shaders.GetShader("transponly" + def + ",MCM_LIT,MCM_SHADOWS,MCM_LL,MCM_ANY,MCM_GEOM_ACTIVE,MCM_PRETTY,MCM_FADE_DEPTH?particles");
            }
        }