public GizmoCircle3DBorder(GizmoPlaneSlider3D planeSlider, GizmoHandle targetHandle, CircleShape3D targetCircle)
        {
            _planeSlider = planeSlider;

            _targetHandle = targetHandle;
            _targetCircle = targetCircle;

            _borderCircleIndex        = _targetHandle.Add3DShape(_borderCircle);
            _borderCircle.RaycastMode = Shape3DRaycastMode.Wire;
            _borderTorusIndex         = _targetHandle.Add3DShape(_borderTorus);
            _borderTorus.WireRenderDesc.NumTubeSlices = 0;
            _borderCylTorusIndex = _targetHandle.Add3DShape(_borderCylTorus);

            _controllerData.Border              = this;
            _controllerData.PlaneSlider         = _planeSlider;
            _controllerData.Gizmo               = Gizmo;
            _controllerData.TargetHandle        = _targetHandle;
            _controllerData.TargetCircle        = targetCircle;
            _controllerData.BorderCircle        = _borderCircle;
            _controllerData.BorderTorus         = _borderTorus;
            _controllerData.BorderCylTorus      = _borderCylTorus;
            _controllerData.BorderCircleIndex   = _borderCircleIndex;
            _controllerData.BorderTorusIndex    = _borderTorusIndex;
            _controllerData.BorderCylTorusIndex = _borderCylTorusIndex;

            _controllers[(int)GizmoCircle3DBorderType.Thin]             = new GizmoThinCircle3DBorderController(_controllerData);
            _controllers[(int)GizmoCircle3DBorderType.Torus]            = new GizmoTorusCircle3DBorderController(_controllerData);
            _controllers[(int)GizmoCircle3DBorderType.CylindricalTorus] = new GizmoCylindricalTorusCircle3DBorderController(_controllerData);

            Gizmo.PreUpdateBegin += OnGizmoPreUpdateBegin;
        }
        public override void UpdateTransforms(float zoomFactor)
        {
            TorusShape3D  borderTorus    = _data.BorderTorus;
            CircleShape3D targetCircle   = _data.TargetCircle;
            float         torusThickness = _data.Border.GetRealTorusThickness(zoomFactor);

            // Note: Rotate around the X axis first because circles exist in the XY plane in model space.
            borderTorus.Rotation   = targetCircle.Rotation * Quaternion.Euler(-90.0f, 0.0f, 0.0f);
            borderTorus.Center     = targetCircle.Center;
            borderTorus.CoreRadius = GetTorusCoreRadius(zoomFactor);
            borderTorus.TubeRadius = torusThickness * 0.5f;
        }
Esempio n. 3
0
        public override void UpdateTransforms(float zoomFactor)
        {
            CylTorusShape3D borderTorus  = _data.BorderCylTorus;
            CircleShape3D   targetCircle = _data.TargetCircle;

            // Note: Rotate around the X axis first because circles exist in the XY plane in model space.
            borderTorus.Rotation   = targetCircle.Rotation * Quaternion.Euler(-90.0f, 0.0f, 0.0f);
            borderTorus.Center     = targetCircle.Center;
            borderTorus.CoreRadius = GetTorusCoreRadius(zoomFactor);
            borderTorus.HrzRadius  = _data.Border.GetRealCylTorusWidth(zoomFactor) * 0.5f;
            borderTorus.VertRadius = _data.Border.GetRealCylTorusHeight(zoomFactor) * 0.5f;
        }