Ejemplo n.º 1
0
 public ICamera GetCamera(LogicalCameras camera)
 {
     return(_cameraManagerImplementation.GetCamera(camera));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads the content used by the lensflare component.
        /// </summary>
        public void LoadContent(Game game)
        {
            this.game = game;

              fCameraManager = (ICameraManager)game.Services.GetService(typeof(ICameraManager));

            // Create a SpriteBatch for drawing the glow and flare sprites.
            spriteBatch = new SpriteBatch(game.GraphicsDevice);

            // Load the glow and flare textures.
            glowSprite = game.Content.Load<Texture2D>(@"textures\glow");

            foreach (Flare flare in flares)
            {
              flare.Texture = game.Content.Load<Texture2D>(@"textures\" + flare.TextureName);
            }

            // Effect and vertex declaration for drawing occlusion query polygons.
            basicEffect = new BasicEffect(game.GraphicsDevice);

            basicEffect.View = Matrix.Identity;
            basicEffect.VertexColorEnabled = true;

            fMaskCombine = game.Content.Load<Effect>(@"effects\maskcombine");

            vertexDeclaration = VertexPositionColor.VertexDeclaration; // new VertexDeclaration(game.GraphicsDevice, VertexPositionColor.VertexElements);

            // Create vertex data for the occlusion query polygons.
            queryVertices = new VertexPositionColor[4];

            queryVertices[0].Position = new Vector3(-querySize / 2, -querySize / 2, -1);
            queryVertices[1].Position = new Vector3( querySize / 2, -querySize / 2, -1);
            queryVertices[2].Position = new Vector3( querySize / 2,  querySize / 2, -1);
            queryVertices[3].Position = new Vector3(-querySize / 2,  querySize / 2, -1);

            // Create the occlusion query object.
            occlusionQuery = new OcclusionQuery(game.GraphicsDevice);

            fSunCamera = fCameraManager.GetCamera("SunCam");

            PresentationParameters pp = game.GraphicsDevice.PresentationParameters;

            fSunView = new RenderTarget2D(game.GraphicsDevice, MaskSize, MaskSize, false, pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents);
            fIntensityMap = new RenderTarget2D(game.GraphicsDevice, 1, 1, false, SurfaceFormat.Single, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents);

            fIntensityEffect = game.Content.Load<Effect>(@"effects\intensity");
            fIntensityMaskVertexDeclaration = VertexPositionTexture.VertexDeclaration; // new VertexDeclaration(game.GraphicsDevice, VertexPositionTexture.VertexElements);

            fOcclusionPoints = GenerateOcclusionPoints();
        }