Exemplo n.º 1
0
        private float _timeSinceLastFrameLastUpdate; // Time value passed to the last call of the method "Update"

        #endregion Fields

        #region Constructors

        public CameraControlSystem(SceneManager sceneManager, string name, Camera camera = null, bool reCalcOnTargetMoving = true)
        {
            _sceneMgr = sceneManager;
            _name = name;
            _targetNode = null;
            _targetNodeListener = null;
            _recalcOnTargetMoving = reCalcOnTargetMoving;
            _currentCameraMode = null;

            _cameraNode = _sceneMgr.RootSceneNode.CreateChildSceneNode(_name + "SceneNode");

            if (camera == null) {
                _camera = _sceneMgr.CreateCamera(_name);
                _isOwnCamera = true;
            } else {
                _camera = camera;
                _isOwnCamera = false;
            }

            //Reset to default parameters
            _camera.Position = Vector3.ZERO;
            _camera.Orientation = Quaternion.IDENTITY;

            // ... and attach the Ogre camera to the camera node
            _cameraNode.AttachObject(_camera);

            _cameraModes = new Dictionary<string, CameraMode>();
        }
Exemplo n.º 2
0
 public virtual void DeleteCameraModes()
 {
     foreach (var mCameraMode in _cameraModes)
     {
         mCameraMode.Value.Dispose();
     }
     _cameraModes.Clear();
     _currentCameraMode = null;
 }
Exemplo n.º 3
0
        public string GetCameraModeName(CameraMode cameraMode)
        {
            foreach (var pair in _cameraModes)
            {
                if (pair.Value == cameraMode)
                {
                    return(pair.Key);
                }
            }

            return("");
        }
Exemplo n.º 4
0
        public CameraControlSystem(SceneManager sceneManager, string name, SceneNode customCameraSceneNode, bool reCalcOnTargetMoving = true)
        {
            _sceneMgr             = sceneManager;
            _name                 = name;
            _targetNode           = null;
            _targetNodeListener   = null;
            _recalcOnTargetMoving = reCalcOnTargetMoving;
            _currentCameraMode    = null;

            _cameraNode  = _sceneMgr.RootSceneNode.CreateChildSceneNode(_name + "SceneNode");
            _isOwnCamera = false;
            _cameraNode.AddChild(customCameraSceneNode);

            _cameraModes = new Dictionary <string, CameraMode>();
        }
Exemplo n.º 5
0
        public CameraControlSystem(SceneManager sceneManager, string name, SceneNode customCameraSceneNode, bool reCalcOnTargetMoving = true)
        {
            _sceneMgr = sceneManager;
            _name = name;
            _targetNode = null;
            _targetNodeListener = null;
            _recalcOnTargetMoving = reCalcOnTargetMoving;
            _currentCameraMode = null;

            _cameraNode = _sceneMgr.RootSceneNode.CreateChildSceneNode(_name + "SceneNode");
            _isOwnCamera = false;
            _cameraNode.AddChild(customCameraSceneNode);

            _cameraModes = new Dictionary<string, CameraMode>();
        }
Exemplo n.º 6
0
 public void RegisterCameraMode(string name, CameraMode cameraMode)
 {
     _cameraModes[name] = cameraMode;
 }
Exemplo n.º 7
0
 public void RemoveCameraMode(CameraMode cameraMode)
 {
     _cameraModes.Remove(GetCameraModeName(cameraMode));
 }
Exemplo n.º 8
0
 public void RemoveCameraMode(CameraMode cameraMode)
 {
     _cameraModes.Remove(GetCameraModeName(cameraMode));
 }
Exemplo n.º 9
0
 public void RegisterCameraMode(string name, CameraMode cameraMode)
 {
     _cameraModes[name] = cameraMode;
 }
Exemplo n.º 10
0
        public string GetCameraModeName(CameraMode cameraMode)
        {
            foreach (var pair in _cameraModes) {
                if (pair.Value == cameraMode) {
                    return pair.Key;
                }
            }

            return "";
        }
Exemplo n.º 11
0
 public virtual void DeleteCameraModes()
 {
     foreach (var mCameraMode in _cameraModes) {
         mCameraMode.Value.Dispose();
     }
     _cameraModes.Clear();
     _currentCameraMode = null;
 }