Exemple #1
0
        public override void Initialize()
        {
            _position = new Properties.Vector3(0, 0, 0);
            _position.PropertyChanged += PositionPropertyChanged;

            Engine.QueueInitializationAction(() =>
            {
                _viewCamera = Engine.Renderer.Scene.CreateCamera("ViewPoint");
                _viewCamera.ProjectionType = ProjectionType.PT_PERSPECTIVE;

                _viewCamera.Position = Mogre.Vector3.ZERO;
                _viewCamera.LookAt(Mogre.Vector3.ZERO);
                _viewCamera.NearClipDistance = 0.01f;
                _viewCamera.FarClipDistance  = 1000.0f;
                _viewCamera.FOVy             = new Degree(100f);
                _viewCamera.AutoAspectRatio  = true;

                Engine.Renderer.Camera = _viewCamera;
                Engine.Renderer.RenderWindow.AddViewport(_viewCamera);

                _initialized = true;
            });
        }
Exemple #2
0
        private void RenderFrame()
        {
            if (!MogitorsRoot.Instance.IsSceneLoaded ||
                (Width <= 0 && Height <= 0))
            {
                return;
            }

            if (MogitorsRoot.Instance.IsClearScreenNeeded)
            {
                Mogre.Camera clearCam = MogitorsRoot.Instance.SceneManager.CreateCamera("sbtClearCam");
                clearCam.NearClipDistance = 0.0001f;
                clearCam.FarClipDistance  = 0.0002f;
                clearCam.LookAt(0, -1, 0);
                MogitorsRoot.Instance.RenderTarget.AddViewport(clearCam, 0);
            }

            if (PreRender != null)
            {
                PreRender(this, EventArgs.Empty);
            }

            this.root.RenderOneFrame();

            if (PostRender != null)
            {
                PostRender(this, EventArgs.Empty);
            }

            if (MogitorsRoot.Instance.IsClearScreenNeeded)
            {
                MogitorsRoot.Instance.RenderTarget.RemoveViewport(0);
                MogitorsRoot.Instance.SceneManager.DestroyCamera("sbtClearCam");
                MogitorsRoot.Instance.IsClearScreenNeeded = false;
            }
        }