Exemple #1
0
        /// <summary>
        /// Allows the node to render itself for debugging purposes. The client
        /// code is responsible for setting up the rendering material.
        /// </summary>
        /// <remarks>
        /// This method is recursive and will draw the node's children also. Thus,
        /// it is enough to call this method for the root of a sphere tree in order
        /// to draw the entire tree.
        /// </remarks>
        public void DebugDraw()
        {
            // Draw the node
            Matrix4x4 nodeTransform = Matrix4x4.TRS(_sphere.Center, Quaternion.identity, Vector3Ex.FromValue(_sphere.Radius));

            Graphics.DrawMeshNow(MeshPool.Get.UnitSphere, nodeTransform);

            // Draw the node's children
            foreach (var child in _children)
            {
                child.DebugDraw();
            }
        }
        private void UpdateTransform(Camera camera)
        {
            Vector3            midAxisPos       = _sceneGizmo.SceneGizmoCamera.LookAtPoint;
            RTSceneGizmoCamera sceneGizmoCamera = _sceneGizmo.SceneGizmoCamera;
            Vector3            axisDirection    = _sceneGizmo.Gizmo.Transform.GetAxis3D(_axisDesc);

            _zoomFactorTransform.Position3D = midAxisPos;
            float zoomFactor = _cap.GetZoomFactor(camera);

            Vector3 midCapSize = _sceneGizmo.LookAndFeel.MidCapType == GizmoCap3DType.Box ?
                                 Vector3Ex.FromValue(_sceneGizmo.LookAndFeel.MidCapBoxSize * zoomFactor) : Vector3Ex.FromValue(_sceneGizmo.LookAndFeel.MidCapSphereRadius * 2.0f * zoomFactor);
            Vector3 midBoxFaceCenter = BoxMath.CalcBoxFaceCenter(midAxisPos, midCapSize, Quaternion.identity, _midAxisBoxFace);

            _cap.CapSlider3DInvert(axisDirection, midBoxFaceCenter);
        }