예제 #1
0
        public virtual void AddRect(Rect rect, System.Windows.Media.Color color)
        {
            rect = new Rect(InverseLocalTransform.Transform(rect.Location), new Size(InverseLocalTransform.M11 * rect.Size.Width, InverseLocalTransform.M22 * rect.Size.Height));

            int index = Vertices.Count;

            SharpDX.Color c = Utils.Convert(color);
            Vertices.Add(new Mesh.Vertex()
            {
                Position = new Vector2((float)rect.Left, (float)rect.Top), Color = c
            });
            Vertices.Add(new Mesh.Vertex()
            {
                Position = new Vector2((float)rect.Right, (float)rect.Top), Color = c
            });
            Vertices.Add(new Mesh.Vertex()
            {
                Position = new Vector2((float)rect.Right, (float)rect.Bottom), Color = c
            });
            Vertices.Add(new Mesh.Vertex()
            {
                Position = new Vector2((float)rect.Left, (float)rect.Bottom), Color = c
            });
            foreach (int i in GetBoxIndicesList())
            {
                Indices.Add(index + i);
            }

            IsDirty = true;
        }
예제 #2
0
        public virtual void AddTri(System.Windows.Point a, System.Windows.Point b, System.Windows.Point c, System.Windows.Media.Color color)
        {
            a = InverseLocalTransform.Transform(a);
            b = InverseLocalTransform.Transform(b);
            c = InverseLocalTransform.Transform(c);

            int index = Vertices.Count;

            SharpDX.Color vertexColor = Utils.Convert(color);
            Vertices.Add(new Mesh.Vertex()
            {
                Position = new Vector2((float)a.X, (float)a.Y), Color = vertexColor
            });
            Vertices.Add(new Mesh.Vertex()
            {
                Position = new Vector2((float)b.X, (float)b.Y), Color = vertexColor
            });
            Vertices.Add(new Mesh.Vertex()
            {
                Position = new Vector2((float)c.X, (float)c.Y), Color = vertexColor
            });

            foreach (int i in GetTriIndicesList())
            {
                Indices.Add(index + i);
            }

            IsDirty = true;
        }
예제 #3
0
        public virtual void AddRect(System.Windows.Point[] rect, System.Windows.Media.Color color)
        {
            int index = Vertices.Count;

            SharpDX.Color c = Utils.Convert(color);
            for (int i = 0; i < 4; ++i)
            {
                System.Windows.Point p = InverseLocalTransform.Transform(rect[i]);
                Vertices.Add(new Mesh.Vertex()
                {
                    Position = new Vector2((float)p.X, (float)p.Y), Color = c
                });
            }

            foreach (int i in GetBoxIndicesList())
            {
                Indices.Add(index + i);
            }

            IsDirty = true;
        }
예제 #4
0
        public virtual void AddLine(System.Windows.Point start, System.Windows.Point finish, System.Windows.Media.Color color)
        {
            start  = InverseLocalTransform.Transform(start);
            finish = InverseLocalTransform.Transform(finish);

            Debug.Assert(Geometry == Mesh.GeometryType.Lines);

            int index = Vertices.Count;

            SharpDX.Color c = Utils.Convert(color);
            Vertices.Add(new Mesh.Vertex()
            {
                Position = new Vector2((float)start.X, (float)start.Y), Color = c
            });
            Vertices.Add(new Mesh.Vertex()
            {
                Position = new Vector2((float)finish.X, (float)finish.Y), Color = c
            });
            Indices.Add(index + 0);
            Indices.Add(index + 1);

            IsDirty = true;
        }