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);
            }
        }
Exemple #2
0
        public void RenderFrame(VisibiltyManager visibilityManager, Vector3 viewPosition)
        {
            _rc.SetDefaultFramebuffer();
            _rc.ClearBuffer();

            foreach (PipelineStage stage in _stages)
            {
                if (stage.Enabled)
                {
                    stage.ExecuteStage(visibilityManager, viewPosition);
                }
            }

            _rc.SwapBuffers();
        }
Exemple #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");
            }
        }
Exemple #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();
            }
        }
Exemple #5
0
        public void ExecuteStage(VisibiltyManager visibilityManager, Vector3 viewPosition)
        {
            if (_outputFramebuffer == null)
            {
                Window window = RenderContext.Window;
                RenderContext.SetViewport(0, 0, window.Width, window.Height);
                RenderContext.SetDefaultFramebuffer();
            }
            else
            {
                RenderContext.SetViewport(0, 0, _outputFramebuffer.Width, _outputFramebuffer.Height);
                RenderContext.SetFramebuffer(_outputFramebuffer);
            }

            RenderContext.SetRasterizerState(RenderContext.DefaultRasterizerState);
            RenderContext.SetVertexBuffer(_quadVB);
            RenderContext.SetIndexBuffer(_quadIB);
            RenderContext.SetMaterial(_quadMaterial);
            _quadMaterial.UseTexture(0, _textureBinding);
            RenderContext.DrawIndexedPrimitives(6, 0);
        }