History

Current state

samcake committed 10 years ago

Commit 414c43c1 parent 93eb60813 files · +396 −287Browse files

Showing the changes to libraries/render-utils/src/DebugDeferredBuffer.cpp (1 of 13 files). Show all

Unified · Split

libraries/render-utils/src/DebugDeferredBuffer.cpp+26−5
@@ -157,10 +157,26 @@ static const std::string DEFAULT_NORMAL_CURVATURE_SHADER{ · 156 unmodified lines
157 " }"157 " }"
158};158};
159 159
160static const std::string DEFAULT_DIFFUSED_CURVATURE_SHADER{
161 "vec4 getFragmentColor() {"
162 " return vec4(pow(vec3(texture(diffusedCurvatureMap, uv).a), vec3(1.0 / 2.2)), 1.0);"
163 // " return vec4(pow(vec3(texture(curvatureMap, uv).xyz), vec3(1.0 / 2.2)), 1.0);"
164 //" return vec4(vec3(1.0 - textureLod(pyramidMap, uv, 3).x * 0.01), 1.0);"
165 " }"
166};
167
168static const std::string DEFAULT_DIFFUSED_NORMAL_CURVATURE_SHADER{
169 "vec4 getFragmentColor() {"
170 //" return vec4(pow(vec3(texture(curvatureMap, uv).a), vec3(1.0 / 2.2)), 1.0);"
171 " return vec4(pow(vec3(texture(diffusedCurvatureMap, uv).xyz), vec3(1.0 / 2.2)), 1.0);"
172 //" return vec4(vec3(1.0 - textureLod(pyramidMap, uv, 3).x * 0.01), 1.0);"
173 " }"
174};
175
160static const std::string DEFAULT_SCATTERING_SHADER{176static const std::string DEFAULT_SCATTERING_SHADER{
161 "vec4 getFragmentColor() {"177 "vec4 getFragmentColor() {"
162 // " return vec4(pow(vec3(texture(scatteringMap, uv).xyz), vec3(1.0 / 2.2)), 1.0);"178 " return vec4(pow(vec3(texture(scatteringMap, uv).xyz), vec3(1.0 / 2.2)), 1.0);"
163 " return vec4(vec3(texture(scatteringMap, uv).xyz), 1.0);"179 // " return vec4(vec3(texture(scatteringMap, uv).xyz), 1.0);"
164 " }"180 " }"
165};181};
166 182
@@ -233,6 +249,10 @@ std::string DebugDeferredBuffer::getShaderSourceCode(Mode mode, std::string cust · 66 unmodified lines
233 return DEFAULT_CURVATURE_SHADER;249 return DEFAULT_CURVATURE_SHADER;
234 case NormalCurvatureMode:250 case NormalCurvatureMode:
235 return DEFAULT_NORMAL_CURVATURE_SHADER;251 return DEFAULT_NORMAL_CURVATURE_SHADER;
252 case DiffusedCurvatureMode:
253 return DEFAULT_DIFFUSED_CURVATURE_SHADER;
254 case DiffusedNormalCurvatureMode:
255 return DEFAULT_DIFFUSED_NORMAL_CURVATURE_SHADER;
236 case ScatteringMode:256 case ScatteringMode:
237 return DEFAULT_SCATTERING_SHADER;257 return DEFAULT_SCATTERING_SHADER;
238 case AmbientOcclusionMode:258 case AmbientOcclusionMode:
@@ -317,12 +337,13 @@ void DebugDeferredBuffer::configure(const Config& config) { · 78 unmodified lines
317 _size = config.size;337 _size = config.size;
318}338}
319 339
320void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const gpu::FramebufferPointer& inputBuffer) {340void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs) {
321 assert(renderContext->args);341 assert(renderContext->args);
322 assert(renderContext->args->hasViewFrustum());342 assert(renderContext->args->hasViewFrustum());
323 RenderArgs* args = renderContext->args;343 RenderArgs* args = renderContext->args;
324 344
325 auto& scatteringFramebuffer = inputBuffer;345 auto& diffusedCurvatureFramebuffer = inputs.getFirst();
346 auto& scatteringFramebuffer = inputs.getSecond();
326 347
327 gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {348 gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
328 batch.enableStereo(false);349 batch.enableStereo(false);
@@ -354,7 +375,7 @@ void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const Ren · 25 unmodified lines
354 batch.setResourceTexture(Shadow, lightStage.lights[0]->shadow.framebuffer->getDepthStencilBuffer());375 batch.setResourceTexture(Shadow, lightStage.lights[0]->shadow.framebuffer->getDepthStencilBuffer());
355 batch.setResourceTexture(Pyramid, framebufferCache->getDepthPyramidTexture());376 batch.setResourceTexture(Pyramid, framebufferCache->getDepthPyramidTexture());
356 batch.setResourceTexture(Curvature, framebufferCache->getCurvatureTexture());377 batch.setResourceTexture(Curvature, framebufferCache->getCurvatureTexture());
357 //batch.setResourceTexture(DiffusedCurvature, diffusedCurvatureBuffer);378 batch.setResourceTexture(DiffusedCurvature, diffusedCurvatureFramebuffer->getRenderBuffer(0));
358 batch.setResourceTexture(Scattering, scatteringFramebuffer->getRenderBuffer(0));379 batch.setResourceTexture(Scattering, scatteringFramebuffer->getRenderBuffer(0));
359 if (DependencyManager::get<DeferredLightingEffect>()->isAmbientOcclusionEnabled()) {380 if (DependencyManager::get<DeferredLightingEffect>()->isAmbientOcclusionEnabled()) {
360 batch.setResourceTexture(AmbientOcclusion, framebufferCache->getOcclusionTexture());381 batch.setResourceTexture(AmbientOcclusion, framebufferCache->getOcclusionTexture());