Exemplo n.º 1
0
        public void ExecuteStage(VisibiltyManager visibilityManager, Vector3 viewPosition)
        {
            if (OverrideFramebuffer == null)
            {
                RenderContext.SetDefaultFramebuffer();
            }
            else
            {
                RenderContext.SetFramebuffer(OverrideFramebuffer);
            }
            RenderContext.SetViewport(0, 0, RenderContext.CurrentFramebuffer.Width, RenderContext.CurrentFramebuffer.Height);
            _renderQueue.Clear();
            visibilityManager.CollectVisibleObjects(_renderQueue, Name, ref _cameraFrustum, viewPosition);
            if (Comparer != null)
            {
                _renderQueue.Sort(Comparer);
            }
            else
            {
                _renderQueue.Sort();
            }

            foreach (RenderItem item in _renderQueue)
            {
                item.Render(RenderContext, Name);
            }
        }
Exemplo n.º 2
0
        public void Render(
            GraphicsDevice gd,
            CommandList rc,
            SceneContext sc,
            RenderPasses pass,
            BoundingFrustum frustum,
            Vector3 viewPosition,
            RenderQueue <IRenderable> renderQueue,
            List <IRenderable> renderableList,
            Comparer <RenderItemIndex> comparer,
            bool threaded)
        {
            renderQueue.Clear();

            renderableList.Clear();
            CollectFreeObjects(pass, renderableList);
            renderQueue.AddRange(renderableList, viewPosition);

            if (comparer == null)
            {
                renderQueue.Sort();
            }
            else
            {
                renderQueue.Sort(comparer);
            }

            foreach (var renderable in renderQueue)
            {
                renderable.Render(gd, rc, sc, pass);
            }
        }
Exemplo n.º 3
0
        public void ExecuteStage(VisibiltyManager visibilityManager, Vector3 cameraPosition)
        {
            UpdateLightProjection();
            RenderContext.ClearScissorRectangle();
            RenderContext.SetFramebuffer(_shadowMapFramebuffer);
            RenderContext.ClearBuffer();
            RenderContext.SetViewport(0, 0, DepthMapWidth, DepthMapHeight);
            _queue.Clear();
            visibilityManager.CollectVisibleObjects(_queue, "ShadowMap", Vector3.Zero);
            _queue.Sort();

            foreach (RenderItem item in _queue)
            {
                item.Render(RenderContext, "ShadowMap");
            }
        }
Exemplo n.º 4
0
        public void ExecuteStage(VisibiltyManager visibilityManager, Vector3 viewPosition)
        {
            RenderContext.ClearScissorRectangle();
            RenderContext.SetFramebuffer(_shadowMapFramebuffer);
            RenderContext.ClearBuffer();
            RenderContext.SetViewport(0, 0, DepthMapWidth, DepthMapHeight);
            _queue.Clear();
            visibilityManager.CollectVisibleObjects(_queue, "ShadowMap", DirectionalLightPosition);
            _queue.Sort();
            foreach (RenderItem item in _queue)
            {
                item.Render(RenderContext, "ShadowMap");
            }

            if (_takeScreenshot)
            {
                _takeScreenshot = false;
                SaveDepthTextureToFile();
            }
        }
Exemplo n.º 5
0
        public void Render(
            GraphicsDevice gd,
            CommandList rc,
            GraphicsSystem sc,
            RenderPasses pass,
            BoundingFrustum frustum,
            Vector3 viewPosition,
            RenderQueue renderQueue,
            List <ICullRenderable> ICullRenderableList,
            List <IRenderable> renderableList,
            Comparer <RenderItemIndex> comparer,
            bool threaded)
        {
            renderQueue.Clear();

            ICullRenderableList.Clear();
            CollectVisibleObjects(ref frustum, pass, ICullRenderableList);
            renderQueue.AddRange(ICullRenderableList, viewPosition);

            renderableList.Clear();
            CollectFreeObjects(pass, renderableList);
            renderQueue.AddRange(renderableList, viewPosition);

            if (comparer == null)
            {
                renderQueue.Sort();
            }
            else
            {
                renderQueue.Sort(comparer);
            }

            foreach (IRenderable renderable in renderQueue)
            {
                renderable.Render(gd, rc, sc, pass);
            }

            if (threaded)
            {
                lock (_allPerFrameRenderablesSet)
                {
                    foreach (ICullRenderable thing in ICullRenderableList)
                    {
                        _allPerFrameRenderablesSet.Add(thing);
                    }
                    foreach (IRenderable thing in renderableList)
                    {
                        _allPerFrameRenderablesSet.Add(thing);
                    }
                }
            }
            else
            {
                foreach (ICullRenderable thing in ICullRenderableList)
                {
                    _allPerFrameRenderablesSet.Add(thing);
                }
                foreach (IRenderable thing in renderableList)
                {
                    _allPerFrameRenderablesSet.Add(thing);
                }
            }
        }