History

Introducing the Normal fitting algorithm for better normal in the deferred buffer

Sam Gateau committed 11 years ago

Commit 95682e61 parent a4f105f8 files · +46 −2Browse files

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

Unified · Split

libraries/render-utils/src/Model.cpp+8−0
@@ -105,6 +105,8 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key, · 104 unmodified lines
105105 slotBindings.insert(gpu::Shader::Binding(std::string("specularMap"), 2));
106106 slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), 3));
107107 slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), 4));
108+ slotBindings.insert(gpu::Shader::Binding(std::string("normalFittingMap"), DeferredLightingEffect::NORMAL_FITTING_MAP_SLOT));
109+
108110
109111 gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vertexShader, pixelShader));
110112 gpu::Shader::makeProgram(*program, slotBindings);
@@ -180,6 +182,8 @@ void Model::RenderPipelineLib::initLocations(gpu::ShaderPointer& program, Model: · 69 unmodified lines
180182 locations.emissiveParams = program->getUniforms().findLocation("emissiveParams");
181183 locations.glowIntensity = program->getUniforms().findLocation("glowIntensity");
182184
185+ locations.normalFittingMapUnit = program->getTextures().findLocation("normalFittingMap");
186+
183187 locations.specularTextureUnit = program->getTextures().findLocation("specularMap");
184188 locations.emissiveTextureUnit = program->getTextures().findLocation("emissiveMap");
185189
@@ -1864,6 +1868,10 @@ void Model::pickPrograms(gpu::Batch& batch, RenderMode mode, bool translucent, f · 1678 unmodified lines
18641868 const float DEFAULT_GLOW_INTENSITY = 1.0f; // FIXME - glow is removed
18651869 batch._glUniform1f(locations->glowIntensity, DEFAULT_GLOW_INTENSITY);
18661870 }
1871+
1872+ if ((locations->normalFittingMapUnit > -1)) {
1873+ batch.setResourceTexture(locations->normalFittingMapUnit, DependencyManager::get<TextureCache>()->getNormalFittingTexture());
1874+ }
18671875 }
18681876
18691877 bool Model::initWhenReady(render::ScenePointer scene) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t