Ejemplo n.º 1
0
        public void Draw(IndexedSurface <PrimitiveVertexData> surface)
        {
            var argb = Color.OrangeRed;

            surface.AddQuad(
                new PrimitiveVertexData(this.SW.NumericValue.WithZ(), argb),
                new PrimitiveVertexData(this.SE.NumericValue.WithZ(), argb),
                new PrimitiveVertexData(this.NE.NumericValue.WithZ(), argb),
                new PrimitiveVertexData(this.NW.NumericValue.WithZ(), argb)
                );

            argb = Color.Yellow;
            foreach (var link in this.links)
            {
                var p0 = link.P0.NumericValue.WithZ();
                var p1 = link.P1.NumericValue.WithZ();
                var p2 = link.To.Center.NumericValue.WithZ();

                var d = (p0 - p1).Normalized() * 0.1f;
                var c = (p0 + p1) / 2;

                p0 = c - d;
                p1 = c + d;

                surface.AddTriangle(
                    new PrimitiveVertexData(p0, argb),
                    new PrimitiveVertexData(p1, argb),
                    new PrimitiveVertexData(p2, argb)
                    );
            }
        }
Ejemplo n.º 2
0
        public void Draw(Vector3 center, float radius, Color color)
        {
            var x0 = center.X - radius;
            var x1 = center.X + radius;
            var y0 = center.Y - radius;
            var y1 = center.Y + radius;

            var rSquared = radius * radius;

            surface.AddQuad(
                new PointLightVertex(new Vector3(x0, y0, 0), center, rSquared, color),
                new PointLightVertex(new Vector3(x1, y0, 0), center, rSquared, color),
                new PointLightVertex(new Vector3(x1, y1, 0), center, rSquared, color),
                new PointLightVertex(new Vector3(x0, y1, 0), center, rSquared, color)
                );
        }