Ejemplo n.º 1
0
        void DrawFlares(Vector2 lightPosition)
        {
            // Lensflare sprites are positioned at intervals along a line that
            // runs from the 2D light position toward the center of the screen.
            Vector2 screenCenter = Vector2.Zero;
            Vector2 flareVector  = screenCenter - lightPosition;

            foreach (Flare flare in flares)
            {
                SpriteDrawer.SetVisible(flare.id, true);

                // Compute the position of this flare sprite.
                Vector2 flarePosition = lightPosition + flareVector * flare.Position;
                Color4  c             = new SlimDX.Color4(flare.Color);
                c *= new Color4(SkyDome.SunColor);
                c *= occlusionAlpha;

                SpriteDrawer.AddInstance(flare.id, flare.Texture, flarePosition, c, flare.Scale / 2, SpriteBlendMode.Additive);
            }
        }