Ejemplo n.º 1
0
        public void Update(Vector3 start, Vector3 end, Color color)
        {
            vertexBuffer.Dispose();

            VertexPositionNormalColor o = new VertexPositionNormalColor();

            o.Position = start;
            o.Normal   = Vector3.Zero;
            o.Color    = color;

            VertexPositionNormalColor d = new VertexPositionNormalColor();

            d.Position = end;
            d.Normal   = Vector3.Zero;
            d.Color    = color;

            vertices = new VertexPositionNormalColor[] { o, d };

            vertexBuffer.SetData(vertices);
        }
Ejemplo n.º 2
0
        //VertexPositionColor[] vertices = new[] { new VertexPositionColor(startPoint, Color.Red), new VertexPositionColor(endPoint, Color.Red) };

        public Line(GraphicsDevice device, Effect effect, Vector3 start, Vector3 end, Color color)
        {
            Device       = device;
            ShaderEffect = effect;
            vertexBuffer = new VertexBuffer(Device, typeof(VertexPositionNormalColor), 2, BufferUsage.WriteOnly);

            VertexPositionNormalColor o = new VertexPositionNormalColor();

            o.Position = start;
            o.Normal   = Vector3.Zero;
            o.Color    = color;

            VertexPositionNormalColor d = new VertexPositionNormalColor();

            d.Position = end;
            d.Normal   = Vector3.Zero;
            d.Color    = color;

            vertices = new VertexPositionNormalColor[] { o, d };

            vertexBuffer.SetData(vertices);
        }