public RotationGizmoLookAndFeel3D()
        {
            for (int sliderIndex = 0; sliderIndex < _axesLookAndFeel.Length; ++sliderIndex)
            {
                _axesLookAndFeel[sliderIndex]           = new GizmoPlaneSlider3DLookAndFeel();
                _axesLookAndFeel[sliderIndex].PlaneType = GizmoPlane3DType.Circle;
            }

            SetAxisVisible(0, true);
            SetAxisVisible(1, true);
            SetAxisVisible(2, true);

            _midCapLookAndFeel.CapType          = GizmoCap3DType.Sphere;
            _camLookSliderLookAndFeel.PlaneType = GizmoPlane2DType.Polygon;

            Color midCapColor = new Color(0.3f, 0.3f, 0.3f, 0.12f);

            SetMidCapColor(midCapColor);
            SetHoveredMidCapColor(midCapColor);
            SetMidCapBorderVisible(true);
            SetMidCapBorderColor(Color.white);
            SetRadius(6.5f);

            SetAxisBorderColor(0, RTSystemValues.XAxisColor);
            SetAxisBorderColor(1, RTSystemValues.YAxisColor);
            SetAxisBorderColor(2, RTSystemValues.ZAxisColor);
            SetHoveredColor(RTSystemValues.HoveredAxisColor);
            SetCamLookSliderPolyBorderThickness(4.0f);
            SetCamLookSliderBorderColor(Color.white);
            SetCamLookSliderHoveredBorderColor(RTSystemValues.HoveredAxisColor);
            SetNumAxisTorusWireAxialSlices(2);
        }
        public void SetAxisColor(int axisIndex, Color color)
        {
            GetSglSliderLookAndFeel(axisIndex, AxisSign.Positive).Color = color;
            GetSglSliderLookAndFeel(axisIndex, AxisSign.Positive).CapLookAndFeel.Color = color;
            GetSglSliderLookAndFeel(axisIndex, AxisSign.Negative).Color = color;
            GetSglSliderLookAndFeel(axisIndex, AxisSign.Negative).CapLookAndFeel.Color = color;

            GizmoPlaneSlider3DLookAndFeel dblLookAndFeel = null;

            if (axisIndex == 0)
            {
                dblLookAndFeel = GetDblSliderLookAndFeel(PlaneId.YZ);
                _scaleGuideLookAndFeel.XAxisColor = color;
            }
            else
            if (axisIndex == 1)
            {
                dblLookAndFeel = GetDblSliderLookAndFeel(PlaneId.ZX);
                _scaleGuideLookAndFeel.YAxisColor = color;
            }
            else
            if (axisIndex == 2)
            {
                dblLookAndFeel = GetDblSliderLookAndFeel(PlaneId.XY);
                _scaleGuideLookAndFeel.ZAxisColor = color;
            }

            dblLookAndFeel.Color       = ColorEx.KeepAllButAlpha(color, dblLookAndFeel.Color.a);
            dblLookAndFeel.BorderColor = color;
        }
        public ScaleGizmoLookAndFeel3D()
        {
            for (int axisIndex = 0; axisIndex < _sglSlidersLookAndFeel.Length; ++axisIndex)
            {
                _sglSlidersLookAndFeel[axisIndex] = new GizmoLineSlider3DLookAndFeel();
            }

            for (int axisIndex = 0; axisIndex < _dblSlidersLookAndFeel.Length; ++axisIndex)
            {
                _dblSlidersLookAndFeel[axisIndex]           = new GizmoPlaneSlider3DLookAndFeel();
                _dblSlidersLookAndFeel[axisIndex].PlaneType = GizmoPlane3DType.RATriangle;
            }

            SetSliderCapType(GizmoCap3DType.Box);
            SetSliderLength(5.5f);

            SetAxisColor(0, RTSystemValues.XAxisColor);
            SetAxisColor(1, RTSystemValues.YAxisColor);
            SetAxisColor(2, RTSystemValues.ZAxisColor);
            SetHoveredColor(RTSystemValues.HoveredAxisColor);

            SetSliderVisible(0, AxisSign.Positive, true);
            SetSliderCapVisible(0, AxisSign.Positive, true);
            SetSliderVisible(1, AxisSign.Positive, true);
            SetSliderCapVisible(1, AxisSign.Positive, true);
            SetSliderVisible(2, AxisSign.Positive, true);
            SetSliderCapVisible(2, AxisSign.Positive, true);

            SetMidCapColor(RTSystemValues.CenterAxisColor);
            SetMidCapType(GizmoCap3DType.Box);
            SetMidCapBoxWidth(0.9f);
            SetMidCapBoxHeight(0.9f);
            SetMidCapBoxDepth(0.9f);
            SetMidCapSphereRadius(0.65f);

            SetDblSliderFillAlpha(RTSystemValues.AxisAlpha);
            SetDblSliderSize(1.9f);
            SetDblSliderVisible(PlaneId.XY, true);
            SetDblSliderVisible(PlaneId.YZ, true);
            SetDblSliderVisible(PlaneId.ZX, true);
        }
Пример #4
0
        public override void UpdateTransforms(float zoomFactor)
        {
            GizmoPlaneSlider3DLookAndFeel lookAndFeel = _data.PlaneSlider.LookAndFeel;
            Vector3 quadRight  = _data.TargetQuad.Right;
            Vector3 quadUp     = _data.TargetQuad.Up;
            Vector3 quadNormal = _data.TargetQuad.Normal;
            float   quadWidth  = _data.TargetQuad.Width;
            float   quadHeight = _data.TargetQuad.Height;

            System.Collections.Generic.List <Vector3> corners = _data.TargetQuad.GetCornerPoints();
            Vector3 topLeft     = corners[(int)QuadCorner.TopLeft];
            Vector3 topRight    = corners[(int)QuadCorner.TopRight];
            Vector3 bottomRight = corners[(int)QuadCorner.BottomRight];
            Vector3 bottomLeft  = corners[(int)QuadCorner.BottomLeft];

            float boxHeight = _data.Border.GetRealBoxHeight(zoomFactor);
            float boxDepth  = _data.Border.GetRealBoxDepth(zoomFactor);

            BoxShape3D topLeftBox = _data.TopLeftBox;

            topLeftBox.AlignHeight(quadNormal);
            topLeftBox.AlignWidth(quadRight);
            topLeftBox.Width  = boxDepth;
            topLeftBox.Height = boxHeight;
            topLeftBox.Depth  = boxDepth;
            topLeftBox.SetFaceCenter(BoxFace.Left, topLeft - quadUp * topLeftBox.GetSizeAlongDirection(quadUp) * 0.5f);

            BoxShape3D topRightBox = _data.TopRightBox;

            topRightBox.AlignHeight(quadNormal);
            topRightBox.AlignWidth(quadRight);
            topRightBox.Width  = boxDepth;
            topRightBox.Height = boxHeight;
            topRightBox.Depth  = boxDepth;
            topRightBox.SetFaceCenter(BoxFace.Right, topRight - quadUp * topRightBox.GetSizeAlongDirection(quadUp) * 0.5f);

            BoxShape3D bottomRightBox = _data.BottomRightBox;

            bottomRightBox.AlignHeight(quadNormal);
            bottomRightBox.AlignWidth(quadRight);
            bottomRightBox.Width  = boxDepth;
            bottomRightBox.Height = boxHeight;
            bottomRightBox.Depth  = boxDepth;
            bottomRightBox.SetFaceCenter(BoxFace.Right, bottomRight + quadUp * bottomRightBox.GetSizeAlongDirection(quadUp) * 0.5f);

            BoxShape3D bottomLeftBox = _data.BottomLeftBox;

            bottomLeftBox.AlignHeight(quadNormal);
            bottomLeftBox.AlignWidth(quadRight);
            bottomLeftBox.Width  = boxDepth;
            bottomLeftBox.Height = boxHeight;
            bottomLeftBox.Depth  = boxDepth;
            bottomLeftBox.SetFaceCenter(BoxFace.Left, bottomLeft + quadUp * bottomLeftBox.GetSizeAlongDirection(quadUp) * 0.5f);

            BoxShape3D topBox = _data.TopBox;

            topBox.AlignHeight(quadNormal);
            topBox.AlignWidth(quadRight);
            topBox.Width  = quadWidth - 2.0f * topLeftBox.GetSizeAlongDirection(quadRight);
            topBox.Height = boxHeight;
            topBox.Depth  = boxDepth;
            topBox.SetFaceCenter(BoxFace.Left, topLeftBox.GetFaceCenter(BoxFace.Right));

            BoxShape3D rightBox = _data.RightBox;

            rightBox.AlignHeight(quadNormal);
            rightBox.AlignWidth(quadUp);
            rightBox.Width  = quadHeight - 2.0f * topRightBox.GetSizeAlongDirection(quadUp);
            rightBox.Height = boxHeight;
            rightBox.Depth  = boxDepth;
            rightBox.SetFaceCenter(BoxFace.Right, topRightBox.GetFaceCenter(BoxFace.Back));

            BoxShape3D bottomBox = _data.BottomBox;

            bottomBox.AlignHeight(quadNormal);
            bottomBox.AlignWidth(quadRight);
            bottomBox.Width  = quadWidth - 2.0f * bottomRightBox.GetSizeAlongDirection(quadRight);
            bottomBox.Height = boxHeight;
            bottomBox.Depth  = boxDepth;
            bottomBox.SetFaceCenter(BoxFace.Left, bottomLeftBox.GetFaceCenter(BoxFace.Right));

            BoxShape3D leftBox = _data.LeftBox;

            leftBox.AlignHeight(quadNormal);
            leftBox.AlignWidth(quadUp);
            leftBox.Width  = quadHeight - 2.0f * topLeftBox.GetSizeAlongDirection(quadUp);
            leftBox.Height = boxHeight;
            leftBox.Depth  = boxDepth;
            leftBox.SetFaceCenter(BoxFace.Right, topLeftBox.GetFaceCenter(BoxFace.Back));
        }
Пример #5
0
        public void Render(Camera camera)
        {
            if (!IsVisible)
            {
                return;
            }

            GizmoPlaneSlider3DLookAndFeel lookAndFeel = _planeSlider.LookAndFeel;
            Color color = lookAndFeel.BorderColor;

            if (Gizmo.HoverHandleId == _targetHandle.Id)
            {
                color = lookAndFeel.HoveredBorderColor;
            }

            if (lookAndFeel.QuadBorderType == GizmoQuad3DBorderType.Thin)
            {
                GizmoLineMaterial lineMaterial = GizmoLineMaterial.Get;
                lineMaterial.ResetValuesToSensibleDefaults();
                lineMaterial.SetColor(color);
                lineMaterial.SetPass(0);

                _targetHandle.Render3DWire(_borderQuadIndex);
            }
            else
            {
                GizmoSolidMaterial solidMaterial = GizmoSolidMaterial.Get;
                solidMaterial.ResetValuesToSensibleDefaults();
                solidMaterial.SetColor(color);
                solidMaterial.SetLit(lookAndFeel.BorderShadeMode == GizmoShadeMode.Lit);
                if (solidMaterial.IsLit)
                {
                    solidMaterial.SetLightDirection(camera.transform.forward);
                }
                solidMaterial.SetPass(0);

                Vector3 camPos = camera.transform.position;
                _sortedBoxIndices.Sort(delegate(int i0, int i1)
                {
                    BoxShape3D b0 = _targetHandle.Get3DShape(i0) as BoxShape3D;
                    BoxShape3D b1 = _targetHandle.Get3DShape(i1) as BoxShape3D;

                    float d0 = (b0.Center - camPos).sqrMagnitude;
                    float d1 = (b1.Center - camPos).sqrMagnitude;

                    return(d1.CompareTo(d0));
                });

                if (lookAndFeel.BorderFillMode == GizmoFillMode3D.Filled)
                {
                    foreach (int boxIndex in _sortedBoxIndices)
                    {
                        _targetHandle.Render3DSolid(boxIndex);
                    }
                }
                else
                {
                    foreach (int boxIndex in _sortedBoxIndices)
                    {
                        _targetHandle.Render3DWire(boxIndex);
                    }
                }
            }
        }