Exemplo n.º 1
0
        public override void RenderWire()
        {
            OBB obb = new OBB(GetAABB(), _rotation);

            if (_wireRenderDesc.WireMode == WireRenderMode.Wire)
            {
                GraphicsEx.DrawWireBox(obb);
            }
            else
            {
                GraphicsEx.DrawWireCornerBox(obb, _wireRenderDesc.CornerLinePercentage);
            }
        }
Exemplo n.º 2
0
        public override void OnGizmoRender(Camera camera)
        {
            var boxWireMaterial = GizmoLineMaterial.Get;

            boxWireMaterial.ResetValuesToSensibleDefaults();
            boxWireMaterial.SetColor(LookAndFeel3D.BoxWireColor);
            boxWireMaterial.SetPass(0);
            GraphicsEx.DrawWireBox(new OBB(BoxCenter, _boxSize, BoxRotation));

            if (RTGizmosEngine.Get.NumRenderCameras > 1)
            {
                UpdateTickPositions();
            }

            _leftTick.Render(camera);
            _rightTick.Render(camera);
            _topTick.Render(camera);
            _bottomTick.Render(camera);
            _frontTick.Render(camera);
            _backTick.Render(camera);
        }
Exemplo n.º 3
0
        public override void OnGizmoRender(Camera camera)
        {
            var boxWireMaterial = GizmoLineMaterial.Get;

            boxWireMaterial.ResetValuesToSensibleDefaults();
            boxWireMaterial.SetColor(LookAndFeel3D.BoxWireColor);
            boxWireMaterial.SetPass(0);
            GraphicsEx.DrawWireBox(OBB);

            bool multipleRenderCams = RTGizmosEngine.Get.NumRenderCameras > 1;

            if (multipleRenderCams)
            {
                _extrudeSliders.ApplyZoomFactor(camera);
                UpdateExtrudeSliderTransforms();
            }

            var sortedSliders = _extrudeSliders.GetRenderSortedSliders(camera);

            foreach (var slider in sortedSliders)
            {
                slider.Render(camera);
            }
        }
        public void Render()
        {
            if (_sharedLookAndFeel == null)
            {
                return;
            }

            if (IsActive)
            {
                Material material = MaterialPool.Get.SimpleColor;

                if (_sharedLookAndFeel.DrawBoxes)
                {
                    material.SetColor(_sharedLookAndFeel.BoxLineColor);
                    material.SetZTestEnabled(true);
                    material.SetPass(0);

                    var boundsQConfig = GetObjectBoundsQConfig();
                    foreach (var targetObject in _targetObjects)
                    {
                        if (targetObject == null)
                        {
                            continue;
                        }

                        OBB worldOBB = ObjectBounds.CalcWorldOBB(targetObject, boundsQConfig);
                        if (worldOBB.IsValid)
                        {
                            GraphicsEx.DrawWireBox(worldOBB);
                        }
                    }
                }

                Camera  camera          = Camera.current;
                Vector2 screenSnapPivot = camera.WorldToScreenPoint(_snapPivotPoint);
                if (_sharedLookAndFeel.PivotShapeType == PivotPointShapeType.Circle)
                {
                    material.SetZTestEnabled(false);
                    material.SetColor(_sharedLookAndFeel.PivotPointFillColor);
                    material.SetPass(0);

                    const int      numCirclePoints   = 100;
                    List <Vector2> pivotCirclePoints = PrimitiveFactory.Generate2DCircleBorderPointsCW(screenSnapPivot, _sharedLookAndFeel.PivotCircleRadius, numCirclePoints);
                    GLRenderer.DrawTriangleFan2D(screenSnapPivot, pivotCirclePoints, camera);

                    if (_sharedLookAndFeel.DrawPivotBorder)
                    {
                        material.SetColor(_sharedLookAndFeel.PivotPointBorderColor);
                        material.SetPass(0);
                        GLRenderer.DrawLineLoop2D(pivotCirclePoints, camera);
                    }
                }
                else
                if (_sharedLookAndFeel.PivotShapeType == PivotPointShapeType.Square)
                {
                    material.SetZTestEnabled(false);
                    material.SetColor(_sharedLookAndFeel.PivotPointFillColor);
                    material.SetPass(0);

                    Rect pivotRect = RectEx.FromCenterAndSize(screenSnapPivot, Vector2Ex.FromValue(_sharedLookAndFeel.PivotSquareSideLength));
                    GLRenderer.DrawRect2D(pivotRect, camera);

                    if (_sharedLookAndFeel.DrawPivotBorder)
                    {
                        material.SetColor(_sharedLookAndFeel.PivotPointBorderColor);
                        material.SetPass(0);
                        GLRenderer.DrawRectBorder2D(pivotRect, camera);
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void Render()
        {
            if (SharedLookAndFeel == null)
            {
                return;
            }

            if (IsActive && _grabSurfaceInfo.SurfaceType != GrabSurfaceType.Invalid)
            {
                Material material = MaterialPool.Get.SimpleColor;
                if (SharedLookAndFeel.DrawAnchorLines)
                {
                    List <Vector3> linePoints = new List <Vector3>(_grabTargets.Count * 2);
                    foreach (GrabTarget grabTarget in _grabTargets)
                    {
                        linePoints.Add(grabTarget.Transform.position);
                        linePoints.Add(_grabSurfaceInfo.AnchorPoint);
                    }

                    material.SetZTestAlways();
                    material.SetColor(_sharedLookAndFeel.AnchorLineColor);
                    material.SetPass(0);
                    GLRenderer.DrawLines3D(linePoints);
                }

                if (SharedLookAndFeel.DrawObjectBoxes)
                {
                    material.SetZTestLess();
                    material.SetColor(SharedLookAndFeel.ObjectBoxWireColor);
                    material.SetPass(0);

                    ObjectBounds.QueryConfig boundsQConfig = GetObjectBoundsQConfig();
                    foreach (GrabTarget grabTarget in _grabTargets)
                    {
                        OBB obb = ObjectBounds.CalcHierarchyWorldOBB(grabTarget.GameObject, boundsQConfig);
                        if (obb.IsValid)
                        {
                            GraphicsEx.DrawWireBox(obb);
                        }
                    }
                }

                if (SharedLookAndFeel.DrawObjectPosTicks)
                {
                    material.SetColor(SharedLookAndFeel.ObjectPosTickColor);
                    material.SetPass(0);

                    foreach (GrabTarget grabTarget in _grabTargets)
                    {
                        Vector2 screenPos = Camera.current.WorldToScreenPoint(grabTarget.Transform.position);
                        GLRenderer.DrawRect2D(RectEx.FromCenterAndSize(screenPos, Vector2Ex.FromValue(SharedLookAndFeel.ObjectPosTickSize)), Camera.current);
                    }
                }

                if (SharedLookAndFeel.DrawAnchorPosTick)
                {
                    material.SetColor(SharedLookAndFeel.AnchorPosTickColor);
                    material.SetPass(0);

                    Vector2 anchorScreenPos = Camera.current.WorldToScreenPoint(_grabSurfaceInfo.AnchorPoint);
                    GLRenderer.DrawRect2D(RectEx.FromCenterAndSize(anchorScreenPos, Vector2Ex.FromValue(SharedLookAndFeel.AnchorPosTickSize)), Camera.current);
                }
            }
        }