public static void RenderAngle(this Vector3 position, OverlayData data, Vector3 startDir, Vector3 endDir, float innerRadius, float outterRadius)
        {
            var startNormal = startDir.Turn90(true);
            var endNormal   = endDir.Turn90(false);
            var invert      = Vector3.Dot(startNormal, endDir) < 0f;

            if (invert)
            {
                startNormal = -startNormal;
                endNormal   = -endNormal;
            }

            var shift  = (outterRadius + innerRadius) / 2;
            var bezier = new Bezier3()
            {
                a = position + startDir * shift,
                d = position + endDir * shift,
            };

            var   angle = Mathf.Acos(Mathf.Clamp(startDir.x * endDir.x + startDir.z * endDir.z, -1f, 1f));
            float d     = Mathf.Tan(angle * 0.5f) * shift * 0.5522848f;

            bezier.b = bezier.a + startNormal * d;
            bezier.c = bezier.d + endNormal * d;

            data.Width = outterRadius - innerRadius;
            data.Cut   = true;
            bezier.RenderBezier(data);
        }
Exemple #2
0
        protected void RenderMiddle(OverlayData overlayData, Data data1, Data data2)
        {
            overlayData.Cut = true;

            var overlayWidth1 = GetWidth(data1.DeltaAngleCos);
            var overlayWidth2 = GetWidth(data2.DeltaAngleCos);

            var width1 = data1.halfWidth * 2 - BorderOverlayWidth;
            var width2 = data2.halfWidth * 2 - BorderOverlayWidth;

            var angle            = Vector3.Angle(data1.Direction, data2.Direction);
            var maxPossibleWidth = Math.Min(angle / 11.25f + 16f, Mathf.Max(BorderOverlayWidth, Mathf.Min(overlayWidth1, overlayWidth2)));

            if (Mathf.Abs(width1 - width2) < 0.001 && maxPossibleWidth >= Mathf.Max(width1, width2))
            {
                overlayData.Width = Mathf.Min(width1, width2);
                RenderMiddle(overlayData, data1, data2, 0f, 0f);
            }
            else
            {
                var overlayWidth = Mathf.Min(width1, width2, maxPossibleWidth);
                overlayData.Width = overlayWidth;

                var effectiveWidth = overlayWidth - Mathf.Max(overlayWidth * ((180 - angle) / 720f), 1f);
                var count          = Math.Max(Mathf.CeilToInt(width1 / effectiveWidth), Mathf.CeilToInt(width2 / effectiveWidth));

                var step1 = GetStep(width1, overlayWidth, count);
                var step2 = GetStep(width2, overlayWidth, count);

                for (var l = 0; l < count; l += 1)
                {
                    RenderMiddle(overlayData, data1, data2, l * step1, l * step2);
                }
            }
Exemple #3
0
        protected void RenderCorner(OverlayData overlayData, Data data)
        {
            var cornerDelta = data.GetCornerDelta(Mathf.Min(BorderOverlayWidth / 2, data.halfWidth));
            var line        = new StraightTrajectory(data.leftPos + cornerDelta, data.rightPos - cornerDelta);

            line.Render(overlayData);
        }
Exemple #4
0
 public void RenderBorders(OverlayData overlayData)
 {
     foreach (var border in BorderLines)
     {
         border.Render(overlayData);
     }
 }
        public static void RenderCircle(this Vector3 position, OverlayData data, float from, float to)
        {
            data.Width = Mathf.Max(from, to, 0f);
            to         = Mathf.Max(Mathf.Min(from, to), 0f);

            do
            {
                position.RenderCircle(data);
                data.Width = Mathf.Max(data.Width.Value - 0.43f, to);
            }while (data.Width > to);
        }
        public static void RenderCircle(this Vector3 position, OverlayData data)
        {
            var color = data.Color ?? DefaultColor;
            var width = data.Width ?? DefaultWidth;

            var renderLimit = data.RenderLimit ?? DefaultLimit;
            var minLimit    = renderLimit ? position.y - 0.01f : DefaultMinLimit;
            var maxLimit    = renderLimit ? position.y + 0.01f : DefaultMaxLimit;

            var alphaBlend = data.AlphaBlend ?? DefaultBlend;

            RenderManager.OverlayEffect.DrawCircle(data.CameraInfo, color, position, width, minLimit, maxLimit, renderLimit, alphaBlend);
        }
Exemple #7
0
        public OverlayData Copy()
        {
            var copy = new OverlayData(CameraInfo)
            {
                Color      = Color,
                Width      = Width,
                AlphaBlend = AlphaBlend,
                CutStart   = CutStart,
                CutEnd     = CutEnd,
                SplitPoint = SplitPoint,
            };

            return(copy);
        }
Exemple #8
0
        protected void RenderBorder(OverlayData overlayData, Data data1, Data data2)
        {
            var cornerDelta1 = data1.GetCornerDelta(BorderOverlayWidth / 2);
            var cornerDelta2 = data2.GetCornerDelta(BorderOverlayWidth / 2);

            var position1 = data1.leftPos + cornerDelta1;
            var position2 = data2.rightPos - cornerDelta2;

            var direction1 = data1.GetDir(1 - cornerDelta1.magnitude / data1.CornerLength);
            var direction2 = data2.GetDir(cornerDelta2.magnitude / data2.CornerLength);

            var bezier = GetBezier(position1, direction1, position2, direction2);

            bezier.RenderBezier(overlayData);
        }
        public static void RenderBezier(this Bezier3 bezier, OverlayData data)
        {
            var color = data.Color ?? DefaultColor;
            var width = data.Width ?? DefaultWidth;

            var cutValue = (data.Width ?? DefaultWidth) / 2;
            var startCut = data.CutStart == true ? cutValue : 0f;
            var endCut   = data.CutEnd == true ? cutValue : 0f;

            var renderLimit = data.RenderLimit ?? DefaultLimit;
            var minLimit    = renderLimit ? (bezier.a.y + bezier.d.y) / 2f - 0.01f : DefaultMinLimit;
            var maxLimit    = renderLimit ? (bezier.a.y + bezier.d.y) / 2f + 0.01f : DefaultMaxLimit;

            var alphaBlend = data.AlphaBlend ?? DefaultBlend;

            RenderManager.OverlayEffect.DrawBezier(data.CameraInfo, color, bezier, width, startCut, endCut, minLimit, maxLimit, renderLimit, alphaBlend);
        }
Exemple #10
0
        public virtual void Render(OverlayData overlayData)
        {
#if DEBUG
            if (RenderOverlayBorders)
            {
                RenderBorders(new OverlayData(overlayData.CameraInfo)
                {
                    Color = Colors.Green
                });
            }
            if (RenderOverlayCentre)
            {
                RenderCenter(new OverlayData(overlayData.CameraInfo)
                {
                    Color = Colors.Red
                });
            }
#endif
        }
Exemple #11
0
 public void RenderCenter(OverlayData overlayData) => Center.RenderCircle(overlayData);
 public static void RenderQuad(this Quad3 quad, OverlayData data) => RenderManager.OverlayEffect.DrawQuad(data.CameraInfo, data.Color ?? Colors.White, quad, -1f, 1280f, false, data.AlphaBlend ?? DefaultBlend);
Exemple #13
0
 public void Render(OverlayData data) => Trajectory.Render(data);
Exemple #14
0
 public void Render(OverlayData data) => Trajectory.GetBezier().RenderBezier(data);