Untitled
By: a guest | Feb 9th, 2010 | Syntax:
C# | Size: 1.65 KB | Hits: 27 | Expires: Never
if (_contentHandler.Effects.ContainsKey("GravityShader"))
{
_spriteBatch.Begin(SpriteBlendMode.Additive, SpriteSortMode.Immediate, SaveStateMode.None);
Matrix matrix = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);
_contentHandler.Effects["GravityShader"].Parameters["WorldViewProjection"].SetValue(matrix);
_contentHandler.Effects["GravityShader"].Begin();
_contentHandler.Effects["GravityShader"].CurrentTechnique.Passes[0].Begin();
for (int i = 0; i < _particleManager.Particles.Count; i++)
{
if (_particleManager.Particles[i].Texture != null)
_spriteBatch.Draw(
_particleManager.Particles[i].Texture,
_particleManager.Particles[i].Position,
_particleManager.Particles[i].SourceRectangle,
_particleManager.Particles[i].Color,
_particleManager.Particles[i].Rotation,
_particleManager.Particles[i].Origin,
_particleManager.Particles[i].Scale,
SpriteEffects.None,
_particleManager.Particles[i].LayerDepth
);
}
_spriteBatch.End();
_contentHandler.Effects["GravityShader"].CurrentTechnique.Passes[0].End();
_contentHandler.Effects["GravityShader"].End();
}