Esempio n. 1
0
 public static void Initialize(Effect DirectionalLight, RenderTarget2D ColorRT, RenderTarget2D NormalRT, RenderTarget2D DepthRT, Vector2 HalfPixel, FullscreenQuad Fsq)
 {
     directionalLight = DirectionalLight;
     colorRT = ColorRT;
     normalRT = NormalRT;
     depthRT = DepthRT;
     halfPixel = HalfPixel;
     fsq = Fsq;
 }
Esempio n. 2
0
 public static void Initialize(Effect pointLight, RenderTarget2D ColorRT, RenderTarget2D NormalRT, 
     RenderTarget2D DepthRT, Vector2 HalfPixel, FullscreenQuad Fsq,
     GraphicsDevice Device, Model SphereModel)
 {
     pointLightEffect = pointLight;
     colorRT = ColorRT;
     normalRT = NormalRT;
     depthRT = DepthRT;
     halfPixel = HalfPixel;
     fsq = Fsq;
     device = Device;
     sphereModel = SphereModel;
 }
Esempio n. 3
0
        public DefferedRenderer(GraphicsDevice device, ContentManager content, SpriteBatch spriteBatch, SpriteFont font, Game game)
        {
            #region Initialize Variables
            this.device = device;
            this.spriteBatch = spriteBatch;
            this.lights = new LightManager(content, device);
            this.font = font;
            fsq = new FullscreenQuad(device);

            halfPixel = new Vector2()
            {
                X = 0.5f / (float)device.PresentationParameters.BackBufferWidth,
                Y = 0.5f / (float)device.PresentationParameters.BackBufferHeight
            };

            int backbufferWidth = device.PresentationParameters.BackBufferWidth;
            int backbufferHeight = device.PresentationParameters.BackBufferHeight;
            lightIntensity = 0.9f;

            colorRT = new RenderTarget2D(device, backbufferWidth, backbufferHeight, false, SurfaceFormat.Color, DepthFormat.Depth24);
            normalRT = new RenderTarget2D(device, backbufferWidth, backbufferHeight, false, SurfaceFormat.Color, DepthFormat.None);
            depthRT = new RenderTarget2D(device, backbufferWidth, backbufferHeight, false, SurfaceFormat.Single, DepthFormat.None);
            lightRT = new RenderTarget2D(device, backbufferWidth, backbufferHeight, false, SurfaceFormat.Color, DepthFormat.None);

            explosionParticles = new ParticleSystem(game, content, "ExplosionSettings");
            explosionSmokeParticles = new ParticleSystem(game, content, "ExplosionSmokeSettings");
            SmokePlumeParticles = new ParticleSystem(game, content, "SmokePlumeSettings");
            menu = new Menu(spriteBatch, content, device.PresentationParameters);
            #endregion

            #region Load Content
            font = content.Load<SpriteFont>("Georgia");
            clearBuffer = content.Load<Effect>("Effects/Clear");
            GBuffer = content.Load<Effect>("Effects/GBuffer");
            directionalLight = content.Load<Effect>("Effects/DirectionalLight");
            finalComposition = content.Load<Effect>("Effects/Composition");
            pointLightEffect = content.Load<Effect>("Effects/PointLight");
            sphereModel = content.Load<Model>("Models/sphere");
            normals = content.Load<Texture2D>("null_normal");
            speculars = content.Load<Texture2D>("null_specular");
            spotLight = content.Load<Effect>("Effects/SpotLight");
            spotLightGeometry = content.Load<Model>("SpotLightGeometry");
            spotCookie = content.Load<Texture2D>("SpotCookie");
            water = new Water(device, content, GBuffer);
            explosionSmokeParticles.LoadContent(device);
            explosionParticles.LoadContent(device);
            SmokePlumeParticles.LoadContent(device);
            #endregion
        }