mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:37:49 +02:00
Cleanup the shaders to avoid any uniform in genral, fixed a bug woith the emissive params applied twice for model_lightmap.slf
This commit is contained in:
parent
5a67411d75
commit
fd3efa37e3
4 changed files with 2 additions and 8 deletions
|
@ -218,10 +218,6 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
|
||||||
|
|
||||||
if (lightmapMap && lightmapMap->isDefined()) {
|
if (lightmapMap && lightmapMap->isDefined()) {
|
||||||
batch.setResourceTexture(ShapePipeline::Slot::EMISSIVE_LIGHTMAP_MAP, lightmapMap->getTextureView());
|
batch.setResourceTexture(ShapePipeline::Slot::EMISSIVE_LIGHTMAP_MAP, lightmapMap->getTextureView());
|
||||||
|
|
||||||
auto lightmapOffsetScale = lightmapMap->getLightmapOffsetScale();
|
|
||||||
batch._glUniform2f(locations->emissiveParams, lightmapOffsetScale.x, lightmapOffsetScale.y);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
batch.setResourceTexture(ShapePipeline::Slot::EMISSIVE_LIGHTMAP_MAP, textureCache->getGrayTexture());
|
batch.setResourceTexture(ShapePipeline::Slot::EMISSIVE_LIGHTMAP_MAP, textureCache->getGrayTexture());
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ void main(void) {
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
int matKey = getMaterialKey(mat);
|
int matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTextures(matKey, _texCoord0, albedo, roughness)$>
|
<$fetchMaterialTextures(matKey, _texCoord0, albedo, roughness)$>
|
||||||
<$fetchMaterialLightmap(_texCoord1, emissive)$>
|
<$fetchMaterialLightmap(_texCoord1, lightmapVal)$>
|
||||||
|
|
||||||
|
|
||||||
packDeferredFragmentLightmap(
|
packDeferredFragmentLightmap(
|
||||||
|
@ -40,5 +40,5 @@ void main(void) {
|
||||||
getMaterialRoughness(mat) * roughness,
|
getMaterialRoughness(mat) * roughness,
|
||||||
getMaterialMetallic(mat),
|
getMaterialMetallic(mat),
|
||||||
getMaterialFresnel(mat),
|
getMaterialFresnel(mat),
|
||||||
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
|
lightmapVal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ void ShapePlumber::addPipeline(const Filter& filter, const gpu::ShaderPointer& p
|
||||||
gpu::Shader::makeProgram(*program, slotBindings);
|
gpu::Shader::makeProgram(*program, slotBindings);
|
||||||
|
|
||||||
auto locations = std::make_shared<Locations>();
|
auto locations = std::make_shared<Locations>();
|
||||||
locations->emissiveParams = program->getUniforms().findLocation("emissiveParams");
|
|
||||||
locations->normalFittingMapUnit = program->getTextures().findLocation("normalFittingMap");
|
locations->normalFittingMapUnit = program->getTextures().findLocation("normalFittingMap");
|
||||||
locations->albedoTextureUnit = program->getTextures().findLocation("albedoMap");
|
locations->albedoTextureUnit = program->getTextures().findLocation("albedoMap");
|
||||||
locations->roughnessTextureUnit = program->getTextures().findLocation("roughnessMap");
|
locations->roughnessTextureUnit = program->getTextures().findLocation("roughnessMap");
|
||||||
|
|
|
@ -215,7 +215,6 @@ public:
|
||||||
int metallicTextureUnit;
|
int metallicTextureUnit;
|
||||||
int emissiveTextureUnit;
|
int emissiveTextureUnit;
|
||||||
int occlusionTextureUnit;
|
int occlusionTextureUnit;
|
||||||
int emissiveParams;
|
|
||||||
int normalFittingMapUnit;
|
int normalFittingMapUnit;
|
||||||
int skinClusterBufferUnit;
|
int skinClusterBufferUnit;
|
||||||
int materialBufferUnit;
|
int materialBufferUnit;
|
||||||
|
|
Loading…
Reference in a new issue