예제 #1
0
파일: Rectangle.cs 프로젝트: deblob/GaLi
        internal override VertexCollection GetVertices(PointF origin)
        {
            if (_cachedVerts != null)
            {
                return(_cachedVerts);
            }

            VertexCollection result = new VertexCollection()
            {
                Mode = BeginMode.Quads
            };

            result.AddRange(new List <PointF> {
                origin.Add(Position),
                origin.Add(new PointF(Position.X, Position.Y + Height)),
                origin.Add(new PointF(Position.X + Width, Position.Y + Height)),
                origin.Add(new PointF(Position.X + Width, Position.Y))
            });

            result = base.RotateVerts(result);

            _cachedVerts = result;
            if (result == null)
            {
                ;
            }
            return(result);
        }
예제 #2
0
파일: Polygon.cs 프로젝트: deblob/GaLi
        internal override VertexCollection GetVertices(PointF origin)
        {
            if (_cachedVerts != null)
            {
                return(_cachedVerts);
            }

            VertexCollection result = new VertexCollection()
            {
                Mode = BeginMode.Polygon
            };

            result.AddRange(_points.Select(p => p = new PointF(p.X + X, p.Y + Y)));
            result = base.RotateVerts(result);

            _cachedVerts = result;
            return(result);
        }
예제 #3
0
        public static void VerifyAttachmentProperties(Attachment attachment)
        {
            if (attachment is IVertexIncludingAttachment mesh)
            {
                VertexCollection collection = new VertexCollection(mesh.VertexCount);
                VertexNode[]     nodes;

                if (mesh.Vertices.Length > mesh.VertexCount * 2)
                {
                    nodes = CreateWeightedNodes(mesh.Vertices, mesh.VertexCount);
                }
                else
                {
                    nodes = CreateSimpleNodes(mesh.Vertices, mesh.VertexCount);
                }

                collection.AddRange(nodes);

                mesh.VertexCollection = collection;
            }
        }