Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- namespace SMLimitless.Graphics
- {
- internal sealed class QuadRenderer
- {
- // http://gamedev.stackexchange.com/questions/87150/rendering-a-fullscreen-quad-is-leaving-a-one-pixel-line-on-the-left-and-top
- private VertexPositionTexture[] triangles;
- private short[] indexData = new short[] { 0, 1, 2, 2, 3, 0 };
- private GraphicsDevice gfx;
- public QuadRenderer()
- {
- gfx = GameServices.Graphics;
- // texture coordinates semantic not used or needed
- triangles = new VertexPositionTexture[]
- {
- new VertexPositionTexture(new Vector3(1, -1, 0),
- Vector2.Zero),
- new VertexPositionTexture(new Vector3(-1, -1, 0),
- Vector2.Zero),
- new VertexPositionTexture(new Vector3(-1, 1, 0),
- Vector2.Zero),
- new VertexPositionTexture(new Vector3(1, 1, 0),
- Vector2.Zero)
- };
- }
- public void Render(Effect effect)
- {
- foreach (EffectPass p in effect.CurrentTechnique.Passes)
- p.Apply();
- Render();
- }
- private void Render()
- {
- gfx.DrawUserIndexedPrimitives(PrimitiveType.TriangleList,
- triangles, 0, 4,
- indexData, 0, 2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement