mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 13:56:24 +02:00
Merge pull request #14801 from SamGondelman/transparent
Case 20867: Fix translucent textures not getting reset
This commit is contained in:
commit
d418fa282a
4 changed files with 12 additions and 14 deletions
|
@ -53,7 +53,7 @@ bool ShapeEntityRenderer::needsRenderUpdate() const {
|
|||
}
|
||||
|
||||
auto mat = _materials.find("0");
|
||||
if (mat != _materials.end() && mat->second.needsUpdate()) {
|
||||
if (mat != _materials.end() && (mat->second.needsUpdate() || mat->second.areTexturesLoading())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ bool ShapeEntityRenderer::useMaterialPipeline(const graphics::MultiMaterial& mat
|
|||
|
||||
ShapeKey ShapeEntityRenderer::getShapeKey() {
|
||||
auto mat = _materials.find("0");
|
||||
if (mat != _materials.end() && mat->second.needsUpdate()) {
|
||||
if (mat != _materials.end() && (mat->second.needsUpdate() || mat->second.areTexturesLoading())) {
|
||||
RenderPipelines::updateMultiMaterial(mat->second);
|
||||
}
|
||||
|
||||
|
|
|
@ -409,11 +409,11 @@ void Geometry::setTextures(const QVariantMap& textureMap) {
|
|||
|
||||
material->setTextures(textureMap);
|
||||
_areTexturesLoaded = false;
|
||||
|
||||
// If we only use cached textures, they should all be loaded
|
||||
areTexturesLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
// If we only use cached textures, they should all be loaded
|
||||
areTexturesLoaded();
|
||||
} else {
|
||||
qCWarning(modelnetworking) << "Ignoring setTextures(); geometry not ready";
|
||||
}
|
||||
|
@ -422,10 +422,7 @@ void Geometry::setTextures(const QVariantMap& textureMap) {
|
|||
bool Geometry::areTexturesLoaded() const {
|
||||
if (!_areTexturesLoaded) {
|
||||
for (auto& material : _materials) {
|
||||
// Check if material textures are loaded
|
||||
bool materialMissingTexture = material->isMissingTexture();
|
||||
|
||||
if (materialMissingTexture) {
|
||||
if (material->isMissingTexture()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ void MeshPartPayload::updateKey(const render::ItemKey& key) {
|
|||
ItemKey::Builder builder(key);
|
||||
builder.withTypeShape();
|
||||
|
||||
if (_drawMaterials.needsUpdate()) {
|
||||
if (_drawMaterials.needsUpdate() || _drawMaterials.areTexturesLoading()) {
|
||||
RenderPipelines::updateMultiMaterial(_drawMaterials);
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ void ModelMeshPartPayload::updateKey(const render::ItemKey& key) {
|
|||
builder.withDeformed();
|
||||
}
|
||||
|
||||
if (_drawMaterials.needsUpdate()) {
|
||||
if (_drawMaterials.needsUpdate() || _drawMaterials.areTexturesLoading()) {
|
||||
RenderPipelines::updateMultiMaterial(_drawMaterials);
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, PrimitiveMode pr
|
|||
return;
|
||||
}
|
||||
|
||||
if (_drawMaterials.needsUpdate()) {
|
||||
if (_drawMaterials.needsUpdate() || _drawMaterials.areTexturesLoading()) {
|
||||
RenderPipelines::updateMultiMaterial(_drawMaterials);
|
||||
}
|
||||
|
||||
|
|
|
@ -482,6 +482,7 @@ void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial
|
|||
auto itr = textureMaps.find(graphics::MaterialKey::ALBEDO_MAP);
|
||||
if (itr != textureMaps.end()) {
|
||||
if (itr->second->isDefined()) {
|
||||
material->resetOpacityMap();
|
||||
drawMaterialTextures->setTexture(gr::Texture::MaterialAlbedo, itr->second->getTextureView());
|
||||
wasSet = true;
|
||||
} else {
|
||||
|
@ -492,8 +493,8 @@ void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial
|
|||
forceDefault = true;
|
||||
}
|
||||
schemaKey.setAlbedoMap(true);
|
||||
schemaKey.setOpacityMaskMap(materialKey.isOpacityMaskMap());
|
||||
schemaKey.setTranslucentMap(materialKey.isTranslucentMap());
|
||||
schemaKey.setOpacityMaskMap(material->getKey().isOpacityMaskMap());
|
||||
schemaKey.setTranslucentMap(material->getKey().isTranslucentMap());
|
||||
}
|
||||
break;
|
||||
case graphics::MaterialKey::METALLIC_MAP_BIT:
|
||||
|
|
Loading…
Reference in a new issue