Ejemplo n.º 1
0
        private void Render(Scene scene, float elapsedMilliseconds)
        {
            Screen.Clear();
            sceneRenderer.Render(Screen, scene, elapsedMilliseconds);

            statusBarRenderer.Render(Screen, scene);

            statusBarRenderer.Render(Screen, scene);

            Screen.Update();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Call once per frame to render the scene to the current viewport.
        /// </summary>
        public void Render(UiState state, ICameraController cam, Renderer target, int toVideo, bool VRModel = false)
        {
            RenderFlags flags = 0;

            if (state.ShowNormals && toVideo == 0)
            {
                flags |= RenderFlags.ShowNormals;
            }
            if (state.ShowBBs && toVideo == 0)
            {
                flags |= RenderFlags.ShowBoundingBoxes;
            }
            if ((state.ShowSkeleton || _overrideSkeleton) && toVideo == 0)
            {
                flags |= RenderFlags.ShowSkeleton;
            }
            if (state.RenderLit)
            {
                flags |= RenderFlags.Shaded;
            }
            if (state.RenderTextured || VRModel)
            {
                flags |= RenderFlags.Textured;
            }
            if (state.RenderWireframe && toVideo == 0)
            {
                flags |= RenderFlags.Wireframe;
            }
            if (state.UseSceneLights && !VRModel)
            {
                flags |= RenderFlags.UseSceneLights;
            }
            if (!state.UseSceneLights && !VRModel && toVideo == 0)
            {
                flags |= RenderFlags.ShowLightDirection;
            }

            flags |= RenderFlags.ShowGhosts;
            flags |= RenderFlags.ForceTwoSidedLighting;

            _wantSetTexturesChanged = false;
            _sceneRenderer.Render(cam, _meshesToShow, _nodesToShowChanged, _texturesChanged, flags, target);

            lock (_texChangeLock)
            {
                if (!_wantSetTexturesChanged)
                {
                    _texturesChanged = false;
                }
            }

            _nodesToShowChanged = false;
        }
Ejemplo n.º 3
0
        private void CreateMapTile(IScene scene)
        {
            if (m_renderer != null && m_gridClient != null)
            {
                Vector3  camPos   = new Vector3(127.5f, 127.5f, 221.7025033688163f);
                Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, 256, 256, 256f, 256f);
                Image    image    = m_renderer.Render(scene, viewport);

                if (image != null)
                {
                    m_gridClient.AddOrUpdateMapTile(SceneInfo.FromScene(scene), image);
                }
                else
                {
                    m_log.Warn("Failed to render map tile for " + scene.Name);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Call once per frame to render the scene to the current viewport.
        /// </summary>
        public void Render(UiState state, ICameraController cam, Renderer target)
        {
            RenderFlags flags = 0;

            if (state.ShowNormals)
            {
                flags |= RenderFlags.ShowNormals;
            }
            if (state.ShowBBs)
            {
                flags |= RenderFlags.ShowBoundingBoxes;
            }
            if (state.ShowSkeleton || _overrideSkeleton)
            {
                flags |= RenderFlags.ShowSkeleton;
            }
            if (state.RenderLit)
            {
                flags |= RenderFlags.Shaded;
            }
            if (state.RenderTextured)
            {
                flags |= RenderFlags.Textured;
            }
            if (state.RenderWireframe)
            {
                flags |= RenderFlags.Wireframe;
            }

            flags |= RenderFlags.ShowGhosts;

            _wantSetTexturesChanged = false;
            _renderer.Render(cam, _meshesToShow, _nodesToShowChanged, _texturesChanged, flags, target);

            lock (_texChangeLock)
            {
                if (!_wantSetTexturesChanged)
                {
                    _texturesChanged = false;
                }
            }

            _nodesToShowChanged = false;
        }
Ejemplo n.º 5
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();
            }
        }