public Vector3 PointToVector3(ref CQT.Model.Point p) { //Console.WriteLine(p.x / graphics.PreferredBackBufferWidth + " " + p.y / graphics.PreferredBackBufferHeight); // FIXME SALE & REF //p.x += cameraOffset.X; //p.y += cameraOffset.Y; Point pp = new Point(p.x + cameraOffset.X, p.y + cameraOffset.Y); //Point pp = p; return new Vector3( //(p.x - graphics.PreferredBackBufferWidth / 2) / graphics.PreferredBackBufferWidth, (pp.x * 2 - gman.PreferredBackBufferWidth) / gman.PreferredBackBufferWidth, -(pp.y * 2 - gman.PreferredBackBufferHeight) / gman.PreferredBackBufferHeight, 0 ); //Vector3 ret = new Vector3(p.x / graphics.PreferredBackBufferWidth, p.y / graphics.PreferredBackBufferHeight, 0); //Console.WriteLine(ret); //return ret; }
//float x = 0; public void Render(GraphicsDevice device, CQT.Model.Point p1, CQT.Model.Point p2, CQT.Model.Point p3, Color color) { BasicEffect _effect = new BasicEffect(device); _effect.Texture = ColorToTexture(device, color, 1, 1); _effect.TextureEnabled = true; //_effect.VertexColorEnabled = true; VertexPositionTexture[] _vertices = new VertexPositionTexture[3]; _vertices[0].Position = PointToVector3(ref p1); _vertices[1].Position = PointToVector3(ref p2); _vertices[2].Position = PointToVector3(ref p3); foreach (var pass in _effect.CurrentTechnique.Passes) { pass.Apply(); device.DrawUserIndexedPrimitives<VertexPositionTexture> ( PrimitiveType.TriangleStrip, // same result with TriangleList _vertices, 0, _vertices.Length, new int[] { 0, 1, 2 }, 0, 1 ); } }