示例#1
0
        public void CopyPoints(PolygonShape2D sourcePoly)
        {
            _isClosed = sourcePoly._isClosed;
            if (sourcePoly.NumPoints != 0)
            {
                _cwPolyPoints = new List <Vector2>(sourcePoly._cwPolyPoints);
            }
            else
            {
                _cwPolyPoints.Clear();
            }

            _isThickBorderDirty = true;
            _isRectDirty        = true;
        }
示例#2
0
        public GizmoPolygon2DBorder(GizmoPlaneSlider2D planeSlider, GizmoHandle targetHandle, PolygonShape2D targetPolygon)
        {
            _planeSlider = planeSlider;

            _targetHandle  = targetHandle;
            _targetPolygon = targetPolygon;

            _borderPolygonIndex          = _targetHandle.Add2DShape(_borderPolygon);
            _borderPolygon.PtContainMode = Shape2DPtContainMode.OnBorder;

            _thickBorderPolygonIndex          = _targetHandle.Add2DShape(_thickBorderPolygon);
            _thickBorderPolygon.PtContainMode = Shape2DPtContainMode.OnBorder;
            _thickBorderPolygon.BorderRenderDesc.BorderType = Shape2DBorderType.Thick;
            _thickBorderPolygon.BorderRenderDesc.Direction  = Shape2DBorderDirection.Outward;

            _controllerData.Border                  = this;
            _controllerData.PlaneSlider             = _planeSlider;
            _controllerData.BorderPolygon           = _borderPolygon;
            _controllerData.BorderPolygonIndex      = _borderPolygonIndex;
            _controllerData.ThickBorderPolygon      = _thickBorderPolygon;
            _controllerData.ThickBorderPolygonIndex = _thickBorderPolygonIndex;
            _controllerData.Gizmo         = targetHandle.Gizmo;
            _controllerData.TargetHandle  = targetHandle;
            _controllerData.TargetPolygon = _targetPolygon;

            _controllers[(int)GizmoPolygon2DBorderType.Thin]  = new GizmoThinPolygon2DBorderController(_controllerData);
            _controllers[(int)GizmoPolygon2DBorderType.Thick] = new GizmoThickPolygon2DBorderController(_controllerData);

            _targetHandle.Gizmo.PreUpdateBegin += OnGizmoPreUpdateBegin;
        }