Exemple #1
0
        private static void reload(Main m)
        {
            // Load static resources
            if (Renderer.quad == null)
            {
                Renderer.quad = new FullscreenQuad();
                Renderer.quad.SetMain(m);
                Renderer.quad.LoadContent(false);
                Renderer.quad.Awake();
            }
            else
            {
                Renderer.quad.LoadContent(true);
            }

            // Load light models
            Renderer.pointLightModel = m.Content.Load <Microsoft.Xna.Framework.Graphics.Model>("InternalModels\\pointlight");
            Renderer.spotLightModel  = m.Content.Load <Microsoft.Xna.Framework.Graphics.Model>("InternalModels\\spotlight");

            Renderer.globalLightEffect = m.Content.Load <Effect>("Effects\\PostProcess\\GlobalLight").Clone();
            Renderer.pointLightEffect  = m.Content.Load <Effect>("Effects\\PostProcess\\PointLight").Clone();
            Renderer.spotLightEffect   = m.Content.Load <Effect>("Effects\\PostProcess\\SpotLight").Clone();
            Renderer.globalLightEffect.Parameters[paramCloudSampler].SetValue(m.Content.Load <Texture2D>("AlphaModels\\cloud_texture"));
        }
Exemple #2
0
        public override void LoadContent(bool reload)
        {
            // Load static resources
            if (reload)
                Renderer.quad.LoadContent(true);
            else
            {
                Renderer.quad = new FullscreenQuad();
                Renderer.quad.SetMain(this.main);
            }

            this.spriteBatch = new SpriteBatch(this.main.GraphicsDevice);

            if (Renderer.globalLightEffect == null || reload)
            {
                Renderer.globalLightEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\GlobalLight");
                this.loadEnvironmentMap(this.EnvironmentMap);
                Renderer.pointLightEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\PointLight");
                Renderer.spotLightEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\SpotLight");
            }

            if (Renderer.pointLightModel == null || reload)
            {
                // Load light models
                Renderer.pointLightModel = this.main.Content.Load<Microsoft.Xna.Framework.Graphics.Model>("Models\\sphere");
                Renderer.spotLightModel = this.main.Content.Load<Microsoft.Xna.Framework.Graphics.Model>("Models\\spotlight");
            }

            this.compositeEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\Composite").Clone();
            this.compositeEffect.CurrentTechnique = this.compositeEffect.Techniques["Composite"];
            this.blurEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\Blur").Clone();

            this.depthDownsampleEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\DepthDownsample").Clone();
            this.ssaoEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\SSAO").Clone();
            this.ssaoRandomTexture = this.main.Content.Load<Texture2D>("Images\\random");
            this.ssaoEffect.Parameters["Random" + Model.SamplerPostfix].SetValue(this.ssaoRandomTexture);

            this.toneMapEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\ToneMap").Clone();
            this.loadLightRampTexture(this.LightRampTexture);

            this.clearEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\Clear").Clone();

            if (this.allowMotionBlur)
                this.motionBlurEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\MotionBlur").Clone();

            if (this.allowBloom)
                this.bloomEffect = this.main.Content.Load<Effect>("Effects\\PostProcess\\Bloom").Clone();

            // Initialize our buffers
            this.ReallocateBuffers(this.screenSize);
        }