protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); RasterizerState rs = new RasterizerState(); rs.CullMode = CullMode.None; GraphicsDevice.RasterizerState = rs; // camera camera = new Camera(this, new Vector3(0, 0, 5)); Components.Add(camera); verts = new[] { new VertexPositionColor(new Vector3(0, 1, 0), Color.Blue), new VertexPositionColor(new Vector3(1, -1, 0), Color.Red), new VertexPositionColor(new Vector3(-1, -1, 0), Color.Green) }; vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), verts.Length, BufferUsage.None); vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionTexture), verts.Length, BufferUsage.None); vertexBuffer.SetData(verts); // effect effect = new BasicEffect(GraphicsDevice); }
protected override void LoadContent() { camera = new Camera(this, new Vector3(0, 0, 5)); Components.Add(camera); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); var tlf = new Vector3(-1.0f, 1.0f, -1.0f); var blf = new Vector3(-1.0f, -1.0f, -1.0f); var trf = new Vector3( 1.0f, 1.0f, -1.0f); var brf = new Vector3( 1.0f, -1.0f, -1.0f); var tlb = new Vector3(-1.0f, 1.0f, 1.0f); var trb = new Vector3( 1.0f, 1.0f, 1.0f); var blb = new Vector3(-1.0f, -1.0f, 1.0f); var brb = new Vector3( 1.0f, -1.0f, 1.0f); verts = new [] { // front new VertexPositionColor(tlf, Color.Red), new VertexPositionColor(blf, Color.Red), new VertexPositionColor(trf, Color.Red), new VertexPositionColor(blf, Color.Red), new VertexPositionColor(brf, Color.Red), new VertexPositionColor(trf, Color.Red), // back new VertexPositionColor(tlb, Color.Blue), new VertexPositionColor(trb, Color.Blue), new VertexPositionColor(blb, Color.Blue), new VertexPositionColor(blb, Color.Blue), new VertexPositionColor(trb, Color.Blue), new VertexPositionColor(brb, Color.Blue), // top new VertexPositionColor(tlf, Color.Green), new VertexPositionColor(trb, Color.Green), new VertexPositionColor(tlb, Color.Green), new VertexPositionColor(tlf, Color.Green), new VertexPositionColor(trf, Color.Green), new VertexPositionColor(trb, Color.Green), // bottom new VertexPositionColor(blf, Color.Yellow), new VertexPositionColor(blb, Color.Yellow), new VertexPositionColor(brb, Color.Yellow), new VertexPositionColor(blf, Color.Yellow), new VertexPositionColor(brb, Color.Yellow), new VertexPositionColor(brf, Color.Yellow), // left new VertexPositionColor(tlf, Color.Purple), new VertexPositionColor(blb, Color.Purple), new VertexPositionColor(blf, Color.Purple), new VertexPositionColor(tlb, Color.Purple), new VertexPositionColor(blb, Color.Purple), new VertexPositionColor(tlf, Color.Purple), // right new VertexPositionColor(trf, Color.Magenta), new VertexPositionColor(brf, Color.Magenta), new VertexPositionColor(brb, Color.Magenta), new VertexPositionColor(trb, Color.Magenta), new VertexPositionColor(trf, Color.Magenta), new VertexPositionColor(brb, Color.Magenta), }; vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), verts.Length, BufferUsage.None); vertexBuffer.SetData(verts); effect = new BasicEffect(GraphicsDevice); }