Exemplo n.º 1
0
        public SceneGizmoAxisCap(SceneGizmo sceneGizmo, int id, AxisDescriptor gizmoAxisDesc)
            : base(sceneGizmo, id)
        {
            _axisDesc       = gizmoAxisDesc;
            _midAxisBoxFace = _axisDesc.GetAssociatedBoxFace();
            _cap.SetZoomFactorTransform(_zoomFactorTransform);

            if (_axisDesc.IsPositive)
            {
                if (_axisDesc.Index == 0)
                {
                    _labelTexture = TexturePool.Get.XAxisLabel;
                }
                else if (_axisDesc.Index == 1)
                {
                    _labelTexture = TexturePool.Get.YAxisLabel;
                }
                else
                {
                    _labelTexture = TexturePool.Get.ZAxisLabel;
                }
            }

            _colorTransition            = new ColorTransition(_color);
            _cap.Gizmo.PreUpdateBegin  += OnGizmoPreUpdateBegin;
            _cap.Gizmo.PreHandlePicked += OnGizmoHandlePicked;
            _sceneGizmo.LookAndFeel.ConnectAxisCapLookAndFeel(_cap, _axisDesc.Index, _axisDesc.Sign);
        }
Exemplo n.º 2
0
        public SceneGizmoMidCap(SceneGizmo sceneGizmo)
            : base(sceneGizmo, GizmoHandleId.SceneGizmoMidCap)
        {
            sceneGizmo.LookAndFeel.ConnectMidCapLookAndFeel(_cap);
            sceneGizmo.Gizmo.PreHandlePicked += OnGizmoHandlePicked;

            sceneGizmo.Gizmo.PreUpdateBegin += OnGizmoPreUpdateBegin;
        }
        public SceneGizmoCamPrjSwitchLabel(SceneGizmo sceneGizmo)
        {
            _sceneGizmo = sceneGizmo;
            _handle     = _sceneGizmo.Gizmo.CreateHandle(GizmoHandleId.SceneGizmoCamPrjSwitchLabel);
            _handle.Add2DShape(_labelQuad);

            sceneGizmo.Gizmo.PreUpdateBegin  += OnGizmoPreUpdateBegin;
            sceneGizmo.Gizmo.PreHandlePicked += OnGizmoHandlePicked;
        }
Exemplo n.º 4
0
        public bool AddBehaviour(IGizmoBehaviour behaviour)
        {
            if (behaviour == null || behaviour.Gizmo != null)
            {
                return(false);
            }

            GizmoBehaviorInitParams initParams = new GizmoBehaviorInitParams();

            initParams.Gizmo = this;

            behaviour.Init_SystemCall(initParams);
            if (!_behaviours.Add(behaviour))
            {
                return(false);
            }

            Type behaviourType = behaviour.GetType();

            if (behaviourType == typeof(MoveGizmo))
            {
                _moveGizmo = behaviour as MoveGizmo;
            }
            else if (behaviourType == typeof(RotationGizmo))
            {
                _rotationGizmo = behaviour as RotationGizmo;
            }
            else if (behaviourType == typeof(ScaleGizmo))
            {
                _scaleGizmo = behaviour as ScaleGizmo;
            }
            else if (behaviourType == typeof(UniversalGizmo))
            {
                _universalGizmo = behaviour as UniversalGizmo;
            }
            else if (behaviourType == typeof(SceneGizmo))
            {
                _sceneGizmo = behaviour as SceneGizmo;
            }
            else if (behaviourType == typeof(BoxGizmo))
            {
                _boxGizmo = behaviour as BoxGizmo;
            }
            else if (behaviourType == typeof(ObjectTransformGizmo))
            {
                _objectTransformGizmo = behaviour as ObjectTransformGizmo;
            }
            else if (behaviourType == typeof(ObjectExtrudeGizmo))
            {
                _objectExtrudeGizmo = behaviour as ObjectExtrudeGizmo;
            }

            behaviour.OnAttached();
            behaviour.OnEnabled();

            return(true);
        }
Exemplo n.º 5
0
        public bool RemoveBehaviour(IGizmoBehaviour behaviour)
        {
            if (behaviour == null)
            {
                return(false);
            }

            if (behaviour == _moveGizmo)
            {
                _moveGizmo = null;
            }
            else if (behaviour == _rotationGizmo)
            {
                _rotationGizmo = null;
            }
            else if (behaviour == _scaleGizmo)
            {
                _scaleGizmo = null;
            }
            else if (behaviour == _universalGizmo)
            {
                _universalGizmo = null;
            }
            else if (behaviour == _sceneGizmo)
            {
                _sceneGizmo = null;
            }
            else if (behaviour == _boxGizmo)
            {
                _boxGizmo = null;
            }
            else if (behaviour == _objectTransformGizmo)
            {
                _objectTransformGizmo = null;
            }
            else if (behaviour == _objectExtrudeGizmo)
            {
                _objectExtrudeGizmo = null;
            }

            return(_behaviours.Remove(behaviour));
        }
Exemplo n.º 6
0
        public SceneGizmo CreateSceneGizmo(Camera sceneCamera)
        {
            if (GetSceneGizmoByCamera(sceneCamera) != null)
            {
                return(null);
            }

            Gizmo gizmo = new Gizmo();

            RegisterGizmo(gizmo);

            SceneGizmo sceneGizmo = gizmo.AddBehaviour <SceneGizmo>();

            sceneGizmo.SceneGizmoCamera.SceneCamera = sceneCamera;
            sceneGizmo.SharedLookAndFeel            = SharedSceneGizmoLookAndFeel;

            _sceneGizmos.Add(sceneGizmo);

            return(sceneGizmo);
        }
Exemplo n.º 7
0
 public SceneGizmoCap(SceneGizmo sceneGizmo, int capHandleId)
 {
     _sceneGizmo = sceneGizmo;
     _cap        = new GizmoCap3D(sceneGizmo.Gizmo, capHandleId);
 }
 public SceneGizmoCamViewportUpdater(SceneGizmo sceneGizmo)
 {
     _sceneGizmo = sceneGizmo;
 }