コード例 #1
0
        private void Render()
        {
            GraphicsContext.CullMode = CullMode.None;
            GraphicsContext.Clear(1.0f);

            SetFilterMode();

            _modelRenderer.SetEffect(_effect);
            _modelRenderer.SelectedAnchor = _editor.FocusAnchor;

            _effect.Technique = _techniqueHandle;
            _effect.Begin();

            _effect.BeginPass(0);

            _effect.SetMatrix("worldMat", Matrix.Identity);
            var wvpm = _viewMat * _projection;

            _effect.SetMatrix("worldViewProjMat", wvpm);

            _effect.CommitChanges();

            _ray = BasicCamera.ScreenToWorldRay(GraphicsContext, MousePosition.X, MousePosition.Y);

            RenderModel();

            _effect.SetMatrix("worldMat", Matrix.Identity);
            _effect.SetMatrix("worldViewProjMat", wvpm);
            _effect.CommitChanges();
            GraphicsContext.World      = Matrix.Identity;
            GraphicsContext.View       = _viewMat;
            GraphicsContext.Projection = _projection;

            _modelRenderer.Wireframe = false;
            _coordinateMarkerRenderer.Render(_effect);
            _modelRenderer.FloorPlane();

            _effect.EndPass();

            _effect.End();

            _guiRenderer.Render(_guiManager);

            _consoleRenderer.Render();
        }
コード例 #2
0
ファイル: EditorWindow.cs プロジェクト: UKMonkey/Gobos
        protected override void OnRender()
        {
            base.OnRender();
            AlphaBlending(true);

            _guiRenderer.Render(_gui);
            _consoleRenderer.Render();

            if (_gui.HoverWidget != null)
            {
                var widgetPosition = new Vector2(_mousePosition.X, _mousePosition.Y) - _gui.HoverWidget.GetAbsolutePosition();
                var widgetName     = _gui.HoverWidget.UniqueName;

                _font.DrawString("Screen: " + _mousePosition + "  Widget[" + widgetName + "]:" + widgetPosition, 0, 0, Colours.Yellow);
            }
            else
            {
                _font.DrawString("Screen: " + _mousePosition, 0, 0, Colours.Yellow);
            }
        }
コード例 #3
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            _frameBuffer.Bind();//TODO
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            //gt.updateTimer();
            //Console.WriteLine(gt.renderPartialTicks);

            DateTime now = DateTime.Now;

            _partialTicks = (float)MathHelper.Clamp((now - _updateTimer).TotalSeconds / TargetUpdatePeriod, 0, 1);

            if (_ticked)
            {
                _ticked = false;

                //Console.WriteLine(_partialTicks);
                _partialTicks %= 1f;
            }

            if ((now - _lastFpsDate).TotalMilliseconds >= 1000)
            {
                _fpsCounterLast = _fpsCounter;
                _fpsCounter     = 0;
                _lastFpsDate    = now;
            }

            RunGlTasks();

            HandleMouseMovement();
            Camera.UpdateViewMatrix();

            //RENDER SCREEN
            if (World != null)
            {
                SkyboxRenderer?.Render(_partialTicks);
                WorldRenderer?.Render(World, _partialTicks);
                ParticleRenderer?.Render(_partialTicks);
                EntityRenderer?.Render(_partialTicks);
            }

            //render other gui
            if (Player != null)
            {
                GuiRenderer?.RenderCrosshair();
                GuiRenderer?.RenderHUD();
            }

            //render gui screen
            if (GuiScreen != null)
            {
                CursorVisible = true;
                GuiRenderer?.Render(GuiScreen);
            }

            if (_takeScreenshot)
            {
                _takeScreenshot = false;

                CaptureScreen();
            }

            _frameBuffer.BindDefault();
            _frameBuffer.CopyToScreen();//TODO

            SwapBuffers();

            _fpsCounter++;
            //_spinner.SpinOnce();
        }
コード例 #4
0
ファイル: Editor.cs プロジェクト: aldyjepara/flood
 public void Render(RenderBlock rb)
 {
     GuiRenderer.Clear();
     MainWindow.Render();
     GuiRenderer.Render(rb);
 }