Beispiel #1
0
        public void DrawCircleWithPoint(Clio.Utilities.Vector3 center, float heading, float radius, Color color, Color pointColor)
        {
            int slices       = 30;
            var radsPerSlice = (float)(Math.PI * 2 / slices);

            var newCenter = new Vector3(center.X, center.Y, center.Z);

            _vertexBuffer[0] = new ColoredVertex(newCenter, color);
            _vertexBuffer[1] = new ColoredVertex(newCenter + new Vector3(radius, 0, 0), color);

            for (int i = 0; i < slices; i++)
            {
                double h = ((Math.PI * 2) - heading) + (Math.PI / 2);
                if (h > (Math.PI * 2))
                {
                    h = h - (Math.PI * 2);
                }

                bool watchAt = (i * radsPerSlice) < h && h < ((i + 1) * radsPerSlice);

                var sine   = (float)Math.Sin((i + 1) * radsPerSlice);
                var cosine = (float)Math.Cos((i + 1) * radsPerSlice);

                _vertexBuffer[2 + i] =
                    new ColoredVertex(newCenter + new Vector3(cosine * radius, 0, sine * radius),
                                      watchAt ? pointColor.ToArgb() : color.ToArgb());
            }

            SetDeclaration();
            Device.DrawUserPrimitives(PrimitiveType.TriangleFan, slices, _vertexBuffer);
        }
Beispiel #2
0
        public void DrawAgroLine(Clio.Utilities.Vector3 center, float heading, float width, float height, Color color, Color pointColor)
        {
            var newCenter = new Vector3(center.X, center.Y, center.Z);

            float heightBack = width;

            float diag     = (float)Math.Sqrt(height * height + width * width) / 2;
            float diagBack = (float)Math.Sqrt(heightBack * heightBack + width * width) / 2;

            float subangle = (float)Math.Atan2(width / 2, height / 2);


            float h = (float)(((Math.PI * 2) - heading) + (Math.PI / 2));

            float r1 = h - subangle;
            float r2 = h + ((float)Math.PI / 4) + (float)Math.PI;
            float r3 = h - ((float)Math.PI / 4) + (float)Math.PI;
            float r4 = h + subangle;

            _vertexBuffer[0] = new ColoredVertex(newCenter, pointColor);
            _vertexBuffer[1] = new ColoredVertex(newCenter + new Vector3((float)Math.Cos(r1) * diag, 0, (float)Math.Sin(r1) * diag), pointColor);
            _vertexBuffer[2] = new ColoredVertex(newCenter + new Vector3((float)Math.Cos(r2) * diagBack, 0, (float)Math.Sin(r2) * diagBack), color);
            _vertexBuffer[3] = new ColoredVertex(newCenter + new Vector3((float)Math.Cos(r3) * diagBack, 0, (float)Math.Sin(r3) * diagBack), color);
            _vertexBuffer[4] = new ColoredVertex(newCenter + new Vector3((float)Math.Cos(r4) * diag, 0, (float)Math.Sin(r4) * diag), pointColor);
            _vertexBuffer[5] = _vertexBuffer[1];

            SetDeclaration();
            Device.DrawUserPrimitives(PrimitiveType.TriangleFan, 4, _vertexBuffer);
        }
        public void DrawSideAttackAgroLine(Clio.Utilities.Vector3 center, float heading, float width, float height, Color color)
        {
            DrawSideAttackAgroLine(center.Convert(), heading, width, height, color);
            //var newCenter = new Vector3(center.X, center.Y, center.Z);

            //float diag = (float)Math.Sqrt(height * height + width * width) / 2;
            //float subangle = (float)Math.Atan2(width / 2, height / 2);


            //float h = (float)(((Math.PI * 2) - heading));

            //float r1 = h - subangle;
            //float r2 = h + subangle + (float)Math.PI;
            //float r3 = h - subangle + (float)Math.PI;
            //float r4 = h + subangle;

            //_vertexBuffer[0] = new ColoredVertex(newCenter, color);
            //_vertexBuffer[1] = new ColoredVertex(newCenter + new Vector3((float)Math.Cos(r1) * diag, 0, (float)Math.Sin(r1) * diag), color);
            //_vertexBuffer[2] = new ColoredVertex(newCenter + new Vector3((float)Math.Cos(r2) * diag, 0, (float)Math.Sin(r2) * diag), color);
            //_vertexBuffer[3] = new ColoredVertex(newCenter + new Vector3((float)Math.Cos(r3) * diag, 0, (float)Math.Sin(r3) * diag), color);
            //_vertexBuffer[4] = new ColoredVertex(newCenter + new Vector3((float)Math.Cos(r4) * diag, 0, (float)Math.Sin(r4) * diag), color);
            //_vertexBuffer[5] = _vertexBuffer[1];

            //SetDeclaration();
            //Device.DrawUserPrimitives(PrimitiveType.TriangleFan, 4, _vertexBuffer);
        }
        public void DrawCircleOutline(Clio.Utilities.Vector3 center, float radius, Color color)
        {
            int slices = 30;
            var radsPerSlice = (float)(Math.PI * 2 / slices);

            var newCenter = new Vector3(center.X, center.Y, center.Z);

            for (int i = 0; i < slices; i++)
            {
                var sine = (float)Math.Sin((i + 1) * radsPerSlice);
                var cosine = (float)Math.Cos((i + 1) * radsPerSlice);

                _vertexBuffer[i] =
                    new ColoredVertex(newCenter + new Vector3(cosine * radius, 0, sine * radius),
                        color.ToArgb());
            }

            _vertexBuffer[slices] = _vertexBuffer[0];

            SetDeclaration();
            Device.DrawUserPrimitives(PrimitiveType.LineStrip, slices, _vertexBuffer);
        }
Beispiel #5
0
 public static Vector3 Convert(this Clio.Utilities.Vector3 v) => new Vector3(v.X, v.Y, v.Z);
Beispiel #6
0
 public void DrawCircleOutline(Clio.Utilities.Vector3 center, float radius, Color color)
 {
     DrawOutlinedBox(center.Convert(), new Vector3(radius), color);
 }
Beispiel #7
0
 public void DrawBoxOutline(Clio.Utilities.Vector3 center, Clio.Utilities.Vector3 extents, Color color)
 {
     DrawOutlinedBox(center.Convert(), extents.Convert(), color);
 }
Beispiel #8
0
 public void DrawLine(Clio.Utilities.Vector3 start, Clio.Utilities.Vector3 end, Color color)
 {
     DrawLine(start.Convert(), end.Convert(), color);
 }
 public void DrawCircle(Clio.Utilities.Vector3 center, float radius, Color color)
 {
     DrawCircle(center.Convert(), radius, color);
 }
 public void DrawAgroLine(Clio.Utilities.Vector3 center, float heading, float width, float height, Color color, Color pointColor)
 {
     DrawAgroLine(center.Convert(), heading, width, height, color, pointColor);
 }
 public void DrawCircleWithPoint(Clio.Utilities.Vector3 center, float heading, float radius, Color color, Color pointColor)
 {
     DrawCircleWithPoint(center.Convert(), heading, radius, color, pointColor);
 }