예제 #1
0
        public void Render(TimeSpan renderingTime)
        {
            if (_device == null)
            {
                return;
            }
            var dt = (float)(renderingTime - _lastRenderingTime).TotalSeconds;

            if (dt <= 0)
            {
                return;
            }
            _lastRenderingTime = renderingTime;
            using (_view.StartRenderPass(_renderTarget.NativePointer))
            {
                _device.BeginScene();

                _camera.Sample(dt);
                var view = _camera.WorldView;
                _device.SetTransform(TransformState.View, ref view);

                _device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, new ColorBGRA(0.2f, 0.2f, 0.2f, 1.0f), 1.0f, 0);
                if (_service.HasLoadedTile && (!_service.HasBuiltNavMesh || _geometryVisible))
                {
                    _sceneRenderer.Render(_service.Scene);
                }

                if (_service.HasBuiltNavMesh)
                {
                    RenderPath();
                }

                _device.SetRenderState(RenderState.CullMode, Cull.None);
                if (_service.HasBuiltNavMesh && _service.CurrentNavigationMeshRenderer != null)
                {
                    _service.CurrentNavigationMeshRenderer.Render(_service.BuildResult);
                }
                _device.SetRenderState(RenderState.CullMode, Cull.Clockwise);

                _device.EndScene();
            }
        }