Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 272 vs 286 for /trunk/Source Code/Rendering/DeferredShadingRenderer.cpp

Diff revisions: vs.
  @@ -65,13 +65,6 @@
65 65 _renderQuads.push_back(CreateResource<Quad3D>(mrt3));
66 66 _renderQuads.push_back(CreateResource<Quad3D>(mrt4));
67 67 _renderQuads.push_back(CreateResource<Quad3D>(mrtPreviewSmall));
68 - for(Quad3D* renderQuad : _renderQuads){
69 - assert(renderQuad);
70 - renderQuad->setCustomShader(_previewDeferredShader);
71 - renderQuad->renderInstance()->preDraw(true);
72 - }
73 - _renderQuads[0]->setCustomShader(_deferredShader);
74 - _renderQuads[4]->setCustomShader(_deferredShader);
75 68
76 69 ParamHandler& par = ParamHandler::getInstance();
77 70 STUBBED("Shadow maps are currently disabled for Deferred Rendering! -Ionut")
  @@ -123,7 +116,7 @@
123 116
124 117 void DeferredShadingRenderer::render(const DELEGATE_CBK& renderCallback, const SceneRenderState& sceneRenderState) {
125 118 GFX_DEVICE.setRenderStage(DEFERRED_STAGE);
126 - SET_DEFAULT_STATE_BLOCK();
119 +
127 120 Light::LightMap& lights = LightManager::getInstance().getLights();
128 121 if(lights.size() != _cachedLightCount){
129 122 _cachedLightCount = (U16)lights.size();
  @@ -153,7 +146,7 @@
153 146 void DeferredShadingRenderer::firstPass(const DELEGATE_CBK& renderCallback, const SceneRenderState& sceneRenderState){
154 147 //Pass 1
155 148 //Draw the geometry, saving parameters into the buffer
156 - _deferredBuffer->Begin(FrameBuffer::defaultPolicy());
149 + _deferredBuffer->Begin(Framebuffer::defaultPolicy());
157 150 renderCallback();
158 151 _deferredBuffer->End();
159 152 }
  @@ -168,19 +161,29 @@
168 161 _deferredBuffer->Bind(2, TextureDescriptor::Color2);
169 162 _deferredBuffer->Bind(3, TextureDescriptor::Color3);
170 163 _lightTexture->Bind(4);
171 - if(_debugView){
172 - _previewDeferredShader->bind();
173 - _previewDeferredShader->UniformTexture("tex",4);
174 - GFX_DEVICE.renderInstance(_renderQuads[1]->renderInstance());
175 - _previewDeferredShader->UniformTexture("tex",1);
176 - GFX_DEVICE.renderInstance(_renderQuads[2]->renderInstance());
177 - _previewDeferredShader->UniformTexture("tex",2);
178 - GFX_DEVICE.renderInstance(_renderQuads[3]->renderInstance());
179 - }
180 - _deferredShader->bind();
181 - _deferredShader->Uniform("lightCount",(I32)_cachedLightCount);
182 164
183 - GFX_DEVICE.renderInstance(_renderQuads[ _debugView ? 4 : 0]->renderInstance());
165 + GenericDrawCommand cmd;
166 + cmd.setStateHash(GFX_DEVICE.getDefaultStateBlock(true));
167 + cmd.setDrawIDs(GFX_DEVICE.getDrawIDs(0));
168 + cmd.setShaderProgram(_previewDeferredShader);
169 + if(_debugView){
170 + _previewDeferredShader->bind();
171 + _previewDeferredShader->UniformTexture("tex",4);
172 + if(_renderQuads[1]->onDraw(nullptr, GFX_DEVICE.getRenderStage()))
173 + GFX_DEVICE.submitRenderCommand(_renderQuads[1]->getGeometryVB(), cmd);
174 + _previewDeferredShader->UniformTexture("tex",1);
175 + if(_renderQuads[2]->onDraw(nullptr, GFX_DEVICE.getRenderStage()))
176 + GFX_DEVICE.submitRenderCommand(_renderQuads[2]->getGeometryVB(), cmd);
177 + _previewDeferredShader->UniformTexture("tex",2);
178 + if(_renderQuads[3]->onDraw(nullptr, GFX_DEVICE.getRenderStage()))
179 + GFX_DEVICE.submitRenderCommand(_renderQuads[3]->getGeometryVB(), cmd);
180 + }
181 + _deferredShader->bind();
182 + _deferredShader->Uniform("lightCount",(I32)_cachedLightCount);
183 +
184 + cmd.setShaderProgram(_deferredShader);
185 + if(_renderQuads[ _debugView ? 4 : 0]->onDraw(nullptr, GFX_DEVICE.getRenderStage()))
186 + GFX_DEVICE.submitRenderCommand(_renderQuads[ _debugView ? 4 : 0]->getGeometryVB(), cmd);
184 187
185 188 GFX_DEVICE.toggle2D(false);
186 189 GUI& gui = GUI::getInstance();