Example #1
0
        private static void DrawRectangleFilling(VertexHelper vh, RectangleModel model, GeometryStyleAsset.GeometryStyleSet styleSet)
        {
            var        p0 = CoordinateTupleToVector3(model.P0);
            var        p1 = CoordinateTupleToVector3(model.P1);
            ColorAsset color;

            switch (model.Color)
            {
            case GeometryStyleAsset.GeometryColor.Black:
                color = model.IsBaked ? styleSet.DefaultStyle.FillColorBlack : styleSet.DrawingStyle.FillColorBlack;
                break;

            case GeometryStyleAsset.GeometryColor.Grey:
                color = model.IsBaked ? styleSet.DefaultStyle.FillColorGrey : styleSet.DrawingStyle.FillColorGrey;
                break;

            case GeometryStyleAsset.GeometryColor.White:
            default:
                color = model.IsBaked ? styleSet.DefaultStyle.FillColorWhite : styleSet.DrawingStyle.FillColorWhite;
                break;
            }

            var p0World = p0;
            var p1World = new Vector3(p1.x, 0f, p0.z);
            var p2World = p1;
            var p3World = new Vector3(p0.x, 0f, p1.z);

            UIMeshGenerationHelper.AddQuadrilateral(vh, (p0World, p1World, p2World, p3World), color.Value);
        }
Example #2
0
 protected override void OnPopulateMesh(VertexHelper vh)
 {
     vh.Clear();
     UIMeshGenerationHelper.AddLine(vh, _startWorld, _endWorld - _startWorld, _style.Width,
                                    _colors.GetForState(_state).Value,
                                    UIMeshGenerationHelper.CapsType.Round);
 }
Example #3
0
        private static void DrawPoint(VertexHelper vh, PointModel model, GeometryStyleAsset.GeometryStyleSet styleSet)
        {
            var p0    = CoordinateTupleToVector3(model.P0);
            var style = model.IsBaked ? styleSet.DefaultStyle : styleSet.DrawingStyle;

            UIMeshGenerationHelper.AddLine(vh, p0, Vector3.zero, style.OutlineWidth,
                                           style.OutlineColor.Value, UIMeshGenerationHelper.CapsType.Round);
        }
Example #4
0
 protected override void OnPopulateMesh(VertexHelper vh)
 {
     // quick fix: assume that rectangle is projected on the xz plane
     vh.Clear();
     if (_isVisible)
     {
         UIMeshGenerationHelper.AddScreenSpanningLine(vh, _originScreen, _directionScreen, _style.Width,
                                                      _style.Color.Value);
     }
 }
Example #5
0
        protected override void OnPopulateMesh(VertexHelper vh)
        {
            vh.Clear();
            var p = WorldScreenTransformationHelper.WorldToScreenPoint(_positionWorld);

            void DrawLine(Vector2 direction)
            {
                var o = p + direction * _innerRadius;
                var v = direction * _radius;

                UIMeshGenerationHelper.AddLine(vh, o, v, _width, _color, UIMeshGenerationHelper.CapsType.None);
            }

            DrawLine(Vector2.up + Vector2.right);
            DrawLine(Vector2.up + Vector2.left);
            DrawLine(Vector2.down + Vector2.right);
            DrawLine(Vector2.down + Vector2.left);
        }
Example #6
0
        private static void DrawRectangleOutline(VertexHelper vh, RectangleModel model,
                                                 GeometryStyleAsset.GeometryStyleSet styleSet)
        {
            var p0    = CoordinateTupleToVector3(model.P0);
            var p1    = CoordinateTupleToVector3(model.P1);
            var style = model.IsBaked ? styleSet.DefaultStyle : styleSet.DrawingStyle;

            var p0World = p0;
            var p1World = new Vector3(p1.x, 0f, p0.z);
            var p2World = p1;
            var p3World = new Vector3(p0.x, 0f, p1.z);

            UIMeshGenerationHelper.AddLine(vh, p0World, p1World - p0World, style.OutlineWidth, style.OutlineColor.Value,
                                           UIMeshGenerationHelper.CapsType.Round);
            UIMeshGenerationHelper.AddLine(vh, p1World, p2World - p1World, style.OutlineWidth, style.OutlineColor.Value,
                                           UIMeshGenerationHelper.CapsType.Round);
            UIMeshGenerationHelper.AddLine(vh, p2World, p3World - p2World, style.OutlineWidth, style.OutlineColor.Value,
                                           UIMeshGenerationHelper.CapsType.Round);
            UIMeshGenerationHelper.AddLine(vh, p3World, p0World - p3World, style.OutlineWidth, style.OutlineColor.Value,
                                           UIMeshGenerationHelper.CapsType.Round);
        }
        protected override void OnPopulateMesh(VertexHelper vh)
        {
            vh.Clear();
            switch (_type)
            {
            case Type.Circle:
                UIMeshGenerationHelper.AddCircle(vh, _positionWorld, _style.Width,
                                                 _colors.GetForState(_state).Value);
                break;

            case Type.Arrow:
                UIMeshGenerationHelper.AddArrow(vh, _positionWorld, _directionWorld, _style.Width,
                                                _colors.GetForState(_state).Value, _style.ArrowAngle);
                break;

            case Type.Mark:
                UIMeshGenerationHelper.AddMark(vh, _positionWorld, _directionWorld, 0.1f * _style.Width, _style.Width,
                                               _colors.GetForState(_state).Value, _style.MarkDimensions);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }