rendered paste body public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
const int numberOfLines = 80;
VertexPositionColor[] data = new VertexPositionColor[numberOfLines * 2];
BasicEffect basicEffect;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
graphics.IsFullScreen = true;
graphics.PreferredBackBufferWidth = 480;
graphics.PreferredBackBufferHeight = 800;
TargetElapsedTime = TimeSpan.FromTicks(333333);
}
protected override void Initialize()
{
basicEffect = new BasicEffect(graphics.GraphicsDevice);
const float separation = .125f;
const float startY = -10;
for (int i = 0; i < numberOfLines * 2; i+=2)
{
data[i] = new VertexPositionColor(
new Vector3(-5f, startY + i * separation, 0), Color.White);
data[i+1] = new VertexPositionColor(
new Vector3(5f, startY + i * separation, 0), Color.White);
}
base.Initialize();
}
protected override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
SetDeviceViewAndProjection(basicEffect);
foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
{
pass.Apply();
graphics.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList,
data, 0, numberOfLines);
}
base.Draw(gameTime);
}
public void SetDeviceViewAndProjection(BasicEffect effect)
{
effect.View = GetLookAtMatrix();
effect.Projection = GetProjectionMatrix();
}
public Matrix GetProjectionMatrix()
{
return Matrix.CreatePerspectiveFieldOfView(
480 / 800.0f,
MathHelper.PiOver4,
1,
100);
}
public Matrix GetLookAtMatrix()
{
Vector3 cameraTarget = Vector3.Forward;
Vector3 tempUpVector = Vector3.Up ;
Vector3 position = new Vector3(0, 0, 40);
Matrix returnMatrix;
Matrix.CreateLookAt(
ref position,
ref cameraTarget,
ref tempUpVector,
out returnMatrix);
return returnMatrix;
}
}