Advertisement
Guest User

Render Code

a guest
Apr 11th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. public static void DrawStuff()
  2. {
  3.     VertexPositionColor[] primitiveList = { new VertexPositionColor(
  4.                 new Vector3(1,1,0), Color.Black), new VertexPositionColor(
  5.                 new Vector3(0,1,-1), Color.Black) };
  6.  
  7.     short[] lineListIndices = { 0, 1 };
  8.  
  9.  
  10.     BasicEffect basicEffect = new BasicEffect(Controller.Graphics.GraphicsDevice);
  11.     basicEffect.Alpha = 1.0f;
  12.     basicEffect.LightingEnabled = false;
  13.  
  14.     basicEffect.World = Matrix.Identity;
  15.     basicEffect.View = Controller.Cam.view;
  16.     basicEffect.Projection = Controller.Cam.projection;
  17.  
  18.     foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
  19.     {
  20.         pass.Apply();
  21.  
  22.         Controller.CurrentGame.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor>(
  23.             PrimitiveType.LineList,
  24.             primitiveList,
  25.             0,  // vertex buffer offset to add to each element of the index buffer
  26.             2,  // number of vertices in pointList
  27.             lineListIndices,  // the index buffer
  28.             0,  // first index element to read
  29.             1   // number of primitives to draw
  30.         );
  31.     }
  32.            
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement