Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 330 vs 331 for /trunk/Source Code/Rendering/DeferredShadingRenderer.cpp

Diff revisions: vs.
  @@ -34,14 +34,14 @@
34 34 gBufferSampler.toggleMipMaps(false);
35 35
36 36 TextureDescriptor gBuffer[4]; /// 4 Gbuffer elements (mipmaps are ignored for deferredBuffers)
37 - //Albedo
38 - gBuffer[0] = TextureDescriptor(TEXTURE_2D, RGBA8, UNSIGNED_BYTE); //R8G8B8A8, 32bit format for diffuse
39 - //Position
40 - gBuffer[1] = TextureDescriptor(TEXTURE_2D, RGBA32F, FLOAT_32); //R32G32B32A32, HDR 128bit format for position data
41 - //Normals
42 - gBuffer[2] = TextureDescriptor(TEXTURE_2D, RGBA16F, FLOAT_32); //R16G16B16A16, 64bit format for normals
43 - //Blend (for transparent objects - unused for now)
44 - gBuffer[3] = TextureDescriptor(TEXTURE_2D, RGBA8, UNSIGNED_BYTE); //R8G8B8A8, 32bit format for blend
37 + //Albedo R8G8B8A8, 32bit format for diffuse
38 + gBuffer[0] = TextureDescriptor(TEXTURE_2D, RGBA8, UNSIGNED_BYTE);
39 + //Position R32G32B32A32, HDR 128bit format for position data
40 + gBuffer[1] = TextureDescriptor(TEXTURE_2D, RGBA32F, FLOAT_32);
41 + //Normals R16G16B16A16, 64bit format for normals
42 + gBuffer[2] = TextureDescriptor(TEXTURE_2D, RGBA16F, FLOAT_32);
43 + //Blend (for transparent objects - unused for now) R8G8B8A8, 32bit format for blend
44 + gBuffer[3] = TextureDescriptor(TEXTURE_2D, RGBA8, UNSIGNED_BYTE);
45 45
46 46 for(U8 i = 0; i < 4; i++) gBuffer[i].setSampler(gBufferSampler);
47 47
  @@ -107,15 +107,16 @@
107 107 RemoveResource(_renderQuads[3]);
108 108 RemoveResource(_renderQuads[4]);
109 109 _renderQuads.clear();
110 - MemoryManager::SAFE_DELETE( _deferredBuffer );
110 + MemoryManager::DELETE( _deferredBuffer );
111 111 if(_deferredShader != nullptr){
112 112 RemoveResource(_deferredShader);
113 113 }
114 114 RemoveResource(_previewDeferredShader);
115 - MemoryManager::SAFE_DELETE( _lightTexture );
115 + MemoryManager::DELETE( _lightTexture );
116 116 }
117 117
118 - void DeferredShadingRenderer::processVisibleNodes(const vectorImpl<SceneGraphNode* >& visibleNodes, const GFXDevice::GPUBlock& gpuBlock) {
118 + void DeferredShadingRenderer::processVisibleNodes(const vectorImpl<SceneGraphNode* >& visibleNodes,
119 + const GFXDevice::GPUBlock& gpuBlock) {
119 120 GFX_DEVICE.setRenderStage(DEFERRED_STAGE);
120 121
121 122 Light::LightMap& lights = LightManager::getInstance().getLights();
  @@ -142,13 +143,15 @@
142 143 _lightTexture->End();
143 144 }
144 145
145 - void DeferredShadingRenderer::render(const DELEGATE_CBK<>& renderCallback, const SceneRenderState& sceneRenderState) {
146 + void DeferredShadingRenderer::render(const DELEGATE_CBK<>& renderCallback,
147 + const SceneRenderState& sceneRenderState) {
146 148
147 149 firstPass(renderCallback, sceneRenderState);
148 150 secondPass(sceneRenderState);
149 151 }
150 152
151 - void DeferredShadingRenderer::firstPass(const DELEGATE_CBK<>& renderCallback, const SceneRenderState& sceneRenderState){
153 + void DeferredShadingRenderer::firstPass(const DELEGATE_CBK<>& renderCallback,
154 + const SceneRenderState& sceneRenderState) {
152 155 //Pass 1
153 156 //Draw the geometry, saving parameters into the buffer
154 157 _deferredBuffer->Begin(Framebuffer::defaultPolicy());
  @@ -158,7 +161,7 @@
158 161
159 162 void DeferredShadingRenderer::secondPass(const SceneRenderState& sceneRenderState){
160 163 //Pass 2
161 - //Draw a 2D fullscreen quad that has the lighting shader applied to it and all generated textures bound to that shader
164 + //Draw a 2D fullscreen quad with lighting shader applied and all generated textures bound to that shader
162 165 GFX_DEVICE.toggle2D(true);
163 166
164 167 _deferredBuffer->Bind(0, TextureDescriptor::Color0);
  @@ -230,7 +233,8 @@
230 233 _renderQuads[3]->setCorner(Quad3D::TOP_RIGHT, vec3<F32>(width, height, 0));
231 234 _renderQuads[3]->setCorner(Quad3D::BOTTOM_LEFT, vec3<F32>(width / 2, height / 2, 0));
232 235 _renderQuads[3]->setCorner(Quad3D::BOTTOM_RIGHT, vec3<F32>(width, height / 2, 0));
233 - //Using a separate, smaller render quad for debug view because it's faster than resizing a quad back and forth -Ionut
236 + // Using a separate, smaller render quad for debug view because it's faster
237 + // than resizing a quad back and forth -Ionut
234 238 _renderQuads[4]->setDimensions(vec4<F32>(0, 0, width / 2, height / 2));
235 239 }
236 240