From fd3efa37e31fb8b3f51830f98b4e6505f7d44f27 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 22 Apr 2016 10:56:21 -0700 Subject: [PATCH] Cleanup the shaders to avoid any uniform in genral, fixed a bug woith the emissive params applied twice for model_lightmap.slf --- libraries/render-utils/src/MeshPartPayload.cpp | 4 ---- libraries/render-utils/src/model_lightmap.slf | 4 ++-- libraries/render/src/render/ShapePipeline.cpp | 1 - libraries/render/src/render/ShapePipeline.h | 1 - 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index 57f0464251..6571674e44 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -218,10 +218,6 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat if (lightmapMap && lightmapMap->isDefined()) { batch.setResourceTexture(ShapePipeline::Slot::EMISSIVE_LIGHTMAP_MAP, lightmapMap->getTextureView()); - - auto lightmapOffsetScale = lightmapMap->getLightmapOffsetScale(); - batch._glUniform2f(locations->emissiveParams, lightmapOffsetScale.x, lightmapOffsetScale.y); - } else { batch.setResourceTexture(ShapePipeline::Slot::EMISSIVE_LIGHTMAP_MAP, textureCache->getGrayTexture()); } diff --git a/libraries/render-utils/src/model_lightmap.slf b/libraries/render-utils/src/model_lightmap.slf index 46d81d39e1..3afbbfd405 100755 --- a/libraries/render-utils/src/model_lightmap.slf +++ b/libraries/render-utils/src/model_lightmap.slf @@ -30,7 +30,7 @@ void main(void) { Material mat = getMaterial(); int matKey = getMaterialKey(mat); <$fetchMaterialTextures(matKey, _texCoord0, albedo, roughness)$> - <$fetchMaterialLightmap(_texCoord1, emissive)$> + <$fetchMaterialLightmap(_texCoord1, lightmapVal)$> packDeferredFragmentLightmap( @@ -40,5 +40,5 @@ void main(void) { getMaterialRoughness(mat) * roughness, getMaterialMetallic(mat), getMaterialFresnel(mat), - (vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb)); + lightmapVal); } diff --git a/libraries/render/src/render/ShapePipeline.cpp b/libraries/render/src/render/ShapePipeline.cpp index cf8bbd4ec8..b09d4b1356 100644 --- a/libraries/render/src/render/ShapePipeline.cpp +++ b/libraries/render/src/render/ShapePipeline.cpp @@ -66,7 +66,6 @@ void ShapePlumber::addPipeline(const Filter& filter, const gpu::ShaderPointer& p gpu::Shader::makeProgram(*program, slotBindings); auto locations = std::make_shared(); - locations->emissiveParams = program->getUniforms().findLocation("emissiveParams"); locations->normalFittingMapUnit = program->getTextures().findLocation("normalFittingMap"); locations->albedoTextureUnit = program->getTextures().findLocation("albedoMap"); locations->roughnessTextureUnit = program->getTextures().findLocation("roughnessMap"); diff --git a/libraries/render/src/render/ShapePipeline.h b/libraries/render/src/render/ShapePipeline.h index 5358e9ac4c..22aa22d4c9 100644 --- a/libraries/render/src/render/ShapePipeline.h +++ b/libraries/render/src/render/ShapePipeline.h @@ -215,7 +215,6 @@ public: int metallicTextureUnit; int emissiveTextureUnit; int occlusionTextureUnit; - int emissiveParams; int normalFittingMapUnit; int skinClusterBufferUnit; int materialBufferUnit;