コード例 #1
0
        public override void OnGizmoRender(Camera camera)
        {
            bool multipleRenderCams = RTGizmosEngine.Get.NumRenderCameras > 1;

            if (multipleRenderCams)
            {
                _midCap.ApplyZoomFactor(camera);
                _axesSliders.ApplyZoomFactor(camera);
                _dblSliders.ApplyZoomFactor(camera);
                if (_multiAxisScaleMode == GizmoMultiAxisScaleMode.DoubleAxis)
                {
                    PlaceDblSlidersInSliderPlanes(camera);
                }
            }

            var sortedSliders = _axesSliders.GetRenderSortedSliders(camera);

            foreach (var slider in sortedSliders)
            {
                slider.Render(camera);
            }

            _xySlider.Render(camera);
            _yzSlider.Render(camera);
            _zxSlider.Render(camera);
            _midCap.Render(camera);

            if (LookAndFeel3D.IsScaleGuideVisible && Gizmo.IsDragged && OwnsHandle(Gizmo.DragHandleId))
            {
                _scaleGuide.Render(GameObjectEx.FilterParentsOnly(_scaleGuideTargetObjects), camera);
            }
        }
コード例 #2
0
        public override void OnGizmoRender(Camera camera)
        {
            bool multipleRenderCams = RTGizmosEngine.Get.NumRenderCameras > 1;

            if (multipleRenderCams)
            {
                _mvAxesSliders.ApplyZoomFactor(camera);
                if (!_isMvVertexSnapEnabled && !_is2DModeEnabled)
                {
                    _mvDblSliders.ApplyZoomFactor(camera);
                    PlaceMvDblSlidersInSliderPlanes(camera);
                }

                Update2DGizmoPosition();
                if (_is2DModeEnabled)
                {
                    Update2DModeHandlePositions();
                }

                _rtMidCap.ApplyZoomFactor(camera);
                _rtAxesSliders.ApplyZoomFactor(camera);
                if (_rtCamLookSlider.IsBorderVisible)
                {
                    UpdateRtCamLookSlider(camera);
                }

                _scMidCap.ApplyZoomFactor(camera);
            }

            _rtXSlider.Render(camera);
            _rtYSlider.Render(camera);
            _rtZSlider.Render(camera);
            _rtMidCap.Render(camera);

            var sortedSliders = _mvAxesSliders.GetRenderSortedSliders(camera);

            foreach (var slider in sortedSliders)
            {
                slider.Render(camera);
            }

            _rtCamLookSlider.Render(camera);
            _mvXYSlider.Render(camera);
            _mvYZSlider.Render(camera);
            _mvZXSlider.Render(camera);
            _scMidCap.Render(camera);

            _mvVertSnapCap.Render(camera);
            _mv2DModeSliders.Render(camera);
            _mv2DModeDblSlider.Render(camera);

            if (LookAndFeel3D.IsScScaleGuideVisible && Gizmo.IsDragged && IsScaleHandle(Gizmo.DragHandleId))
            {
                _scScaleGuide.Render(GameObjectEx.FilterParentsOnly(_scScaleGuideTargetObjects), camera);
            }
        }
コード例 #3
0
        public override void OnGizmoRender(Camera camera)
        {
            bool multipleRenderCams = RTGizmosEngine.Get.NumRenderCameras > 1;

            if (multipleRenderCams)
            {
                _midCap.ApplyZoomFactor(camera);
                _axesSliders.ApplyZoomFactor(camera);
                if (_camLookSlider.IsBorderVisible)
                {
                    UpdateCamLookSlider(camera);
                }
            }

            _xSlider.Render(camera);
            _ySlider.Render(camera);
            _zSlider.Render(camera);
            _midCap.Render(camera);
            _camLookSlider.Render(camera);
        }
コード例 #4
0
        public override void OnGizmoRender(Camera camera)
        {
            bool multipleRenderCams = RTGizmosEngine.Get.NumRenderCameras > 1;

            if (multipleRenderCams)
            {
                _axesSliders.ApplyZoomFactor(camera);
                if (_midCap.IsVisible)
                {
                    _midCap.ApplyZoomFactor(camera);
                }
                if (!_isVertexSnapEnabled && !_is2DModeEnabled)
                {
                    _dblSliders.ApplyZoomFactor(camera);
                    PlaceDblSlidersInSliderPlanes(camera);
                }

                Update2DGizmoPosition();
                if (_is2DModeEnabled)
                {
                    Update2DModeHandlePositions();
                }
            }

            List <GizmoLineSlider3D> sortedSliders = _axesSliders.GetRenderSortedSliders(camera);

            foreach (GizmoLineSlider3D slider in sortedSliders)
            {
                slider.Render(camera);
            }

            _midCap.Render(camera);
            _xySlider.Render(camera);
            _yzSlider.Render(camera);
            _zxSlider.Render(camera);

            _vertSnapCap.Render(camera);
            _2DModeSliders.Render(camera);
            _2DModeDblSlider.Render(camera);
        }
コード例 #5
0
        /// <summary>
        /// Renders the slider with the specified camera. This function should be called
        /// directly or indirectly from a Monobehaviour's 'OnRenderObject' function.
        /// </summary>
        public override void Render(Camera camera)
        {
            if (!IsVisible && !Is3DCapVisible)
            {
                return;
            }

            Color color = new Color();

            if (!OverrideColor.IsActive)
            {
                if (Gizmo.HoverHandleId == HandleId)
                {
                    color = LookAndFeel.HoveredColor;
                }
                else
                {
                    color = LookAndFeel.Color;
                }
            }
            else
            {
                color = OverrideColor.Color;
            }

            if (LookAndFeel.IsRotationArcVisible && IsRotating)
            {
                _rotationArc.RotationAngle = _rotationDrag.TotalRotation;
                _rotationArc.Radius        = GetRealLength(GetZoomFactor(camera));
                _rotationArc.Render(LookAndFeel.RotationArcLookAndFeel);
            }

            bool renderCapFirst = !camera.IsPointFacingCamera(GetRealEndPosition(GetZoomFactor(camera)), GetRealDirection());

            if (Is3DCapVisible && renderCapFirst)
            {
                _cap3D.Render(camera);
            }

            if (IsVisible)
            {
                if (LookAndFeel.FillMode == GizmoFillMode3D.Filled)
                {
                    bool isLit = LookAndFeel.ShadeMode == GizmoShadeMode.Lit && LookAndFeel.LineType != GizmoLine3DType.Thin;

                    GizmoSolidMaterial solidMaterial = GizmoSolidMaterial.Get;
                    solidMaterial.ResetValuesToSensibleDefaults();
                    solidMaterial.SetLit(isLit);
                    if (isLit)
                    {
                        solidMaterial.SetLightDirection(camera.transform.forward);
                    }
                    solidMaterial.SetColor(color);
                    solidMaterial.SetPass(0);

                    Handle.Render3DSolid();
                }
                else
                {
                    GizmoLineMaterial lineMaterial = GizmoLineMaterial.Get;
                    lineMaterial.ResetValuesToSensibleDefaults();
                    lineMaterial.SetColor(color);
                    lineMaterial.SetPass(0);

                    Handle.Render3DWire();
                }
            }

            if (Is3DCapVisible && !renderCapFirst)
            {
                _cap3D.Render(camera);
            }
        }