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
105 slotBindings.insert(gpu::Shader::Binding(std::string("specularMap"), 2));105 slotBindings.insert(gpu::Shader::Binding(std::string("specularMap"), 2));
106 slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), 3));106 slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), 3));
107 slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), 4));107 slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), 4));
108 slotBindings.insert(gpu::Shader::Binding(std::string("normalFittingMap"), DeferredLightingEffect::NORMAL_FITTING_MAP_SLOT));
109
108 110
109 gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vertexShader, pixelShader));111 gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vertexShader, pixelShader));
110 gpu::Shader::makeProgram(*program, slotBindings);112 gpu::Shader::makeProgram(*program, slotBindings);
@@ -180,6 +182,8 @@ void Model::RenderPipelineLib::initLocations(gpu::ShaderPointer& program, Model: · 69 unmodified lines
180 locations.emissiveParams = program->getUniforms().findLocation("emissiveParams");182 locations.emissiveParams = program->getUniforms().findLocation("emissiveParams");
181 locations.glowIntensity = program->getUniforms().findLocation("glowIntensity");183 locations.glowIntensity = program->getUniforms().findLocation("glowIntensity");
182 184
185 locations.normalFittingMapUnit = program->getTextures().findLocation("normalFittingMap");
186
183 locations.specularTextureUnit = program->getTextures().findLocation("specularMap");187 locations.specularTextureUnit = program->getTextures().findLocation("specularMap");
184 locations.emissiveTextureUnit = program->getTextures().findLocation("emissiveMap");188 locations.emissiveTextureUnit = program->getTextures().findLocation("emissiveMap");
185 189
@@ -1864,6 +1868,10 @@ void Model::pickPrograms(gpu::Batch& batch, RenderMode mode, bool translucent, f · 1678 unmodified lines
1864 const float DEFAULT_GLOW_INTENSITY = 1.0f; // FIXME - glow is removed1868 const float DEFAULT_GLOW_INTENSITY = 1.0f; // FIXME - glow is removed
1865 batch._glUniform1f(locations->glowIntensity, DEFAULT_GLOW_INTENSITY);1869 batch._glUniform1f(locations->glowIntensity, DEFAULT_GLOW_INTENSITY);
1866 }1870 }
1871
1872 if ((locations->normalFittingMapUnit > -1)) {
1873 batch.setResourceTexture(locations->normalFittingMapUnit, DependencyManager::get<TextureCache>()->getNormalFittingTexture());
1874 }
1867}1875}
1868 1876
1869bool Model::initWhenReady(render::ScenePointer scene) {1877bool 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