mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 01:48:59 +02:00
Good to go for merge
This commit is contained in:
parent
67abdab8b2
commit
3c075532f8
5 changed files with 11 additions and 31 deletions
|
@ -151,13 +151,11 @@ bool NetworkGeometry::isLoadedWithTextures() const {
|
|||
(material->lightmapTexture && !material->lightmapTexture->isLoaded())) {
|
||||
return false;
|
||||
}
|
||||
if (/*material->useAlbedoMapOpacity && */ material->albedoTexture && material->albedoTexture->getGPUTexture()) {
|
||||
if (material->albedoTexture && material->albedoTexture->getGPUTexture()) {
|
||||
// Reassign the texture to make sure that itsalbedo alpha channel material key is detected correctly
|
||||
material->_material->setTextureMap(model::MaterialKey::ALBEDO_MAP, material->_material->getTextureMap(model::MaterialKey::ALBEDO_MAP));
|
||||
// Reset the materialKey transparentTexture key only, as it is albedoTexture-dependent
|
||||
const auto& usage = material->albedoTexture->getGPUTexture()->getUsage();
|
||||
bool isTransparentTexture = usage.isAlpha() && !usage.isAlphaMask();
|
||||
// material->_material->setTransparentTexture(isTransparentTexture);
|
||||
// FIXME: Materials with *some* transparent textures seem to give all *other* textures alphas of 0.
|
||||
_hasTransparentTextures = isTransparentTexture && _hasTransparentTextures;
|
||||
}
|
||||
}
|
||||
|
@ -385,7 +383,6 @@ static NetworkMaterial* buildNetworkMaterial(NetworkGeometry* geometry, const FB
|
|||
if (!material.opacityTexture.filename.isEmpty()) {
|
||||
if (material.albedoTexture.filename == material.opacityTexture.filename) {
|
||||
// Best case scenario, just indicating that the albedo map contains transparency
|
||||
networkMaterial->useAlbedoMapOpacity;
|
||||
albedoMap->setUseAlphaChannel(true);
|
||||
} else {
|
||||
// Opacity Map is different from the Abledo map, not supported
|
||||
|
|
|
@ -199,8 +199,6 @@ public:
|
|||
QSharedPointer<NetworkTexture> occlusionTexture;
|
||||
QString lightmapTextureName;
|
||||
QSharedPointer<NetworkTexture> lightmapTexture;
|
||||
bool useAlbedoMapOpacity{ false };
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -91,23 +91,7 @@ void Material::setTextureMap(MapChannel channel, const TextureMapPointer& textur
|
|||
if (textureMap->getTextureView().isValid()) {
|
||||
auto usage = textureMap->getTextureView()._texture->getUsage();
|
||||
if (usage.isAlpha()) {
|
||||
// Texture has alpha, is nut just a mask or a true transparent channel
|
||||
if (usage.isAlphaMask()) {
|
||||
_key.setOpacityMaskMap(true);
|
||||
_key.setTranslucentMap(false);
|
||||
} else {
|
||||
_key.setOpacityMaskMap(false);
|
||||
_key.setTranslucentMap(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (textureMap->isDefined()) {
|
||||
if (textureMap->getTextureView().isValid()) {
|
||||
auto usage = textureMap->getTextureView()._texture->getUsage();
|
||||
if (usage.isAlpha()) {
|
||||
// Texture has alpha, is nut just a mask or a true transparent channel
|
||||
// Texture has alpha, is not just a mask or a true transparent channel
|
||||
if (usage.isAlphaMask()) {
|
||||
_key.setOpacityMaskMap(true);
|
||||
_key.setTranslucentMap(false);
|
||||
|
|
|
@ -32,11 +32,12 @@ public:
|
|||
METALLIC_VAL_BIT,
|
||||
GLOSSY_VAL_BIT,
|
||||
OPACITY_VAL_BIT,
|
||||
|
||||
EMISSIVE_MAP_BIT,
|
||||
ALBEDO_MAP_BIT,
|
||||
OPACITY_MASK_MAP_BIT, // OPacity Map and Opacity MASK map are mutually exclusive
|
||||
OPACITY_TRANSLUCENT_MAP_BIT,
|
||||
|
||||
// THe map bits must be in the smae sequence as the enum names for the map channels
|
||||
EMISSIVE_MAP_BIT,
|
||||
ALBEDO_MAP_BIT,
|
||||
METALLIC_MAP_BIT,
|
||||
ROUGHNESS_MAP_BIT,
|
||||
NORMAL_MAP_BIT,
|
||||
|
|
|
@ -44,11 +44,11 @@ const int ALBEDO_VAL_BIT = 0x00000002;
|
|||
const int METALLIC_VAL_BIT = 0x00000004;
|
||||
const int GLOSSY_VAL_BIT = 0x00000008;
|
||||
const int OPACITY_VAL_BIT = 0x00000010;
|
||||
const int OPACITY_MASK_MAP_BIT = 0x00000020;
|
||||
const int OPACITY_TRANSLUCENT_MAP_BIT = 0x00000040;
|
||||
|
||||
const int EMISSIVE_MAP_BIT = 0x00000020;
|
||||
const int ALBEDO_MAP_BIT = 0x00000040;
|
||||
const int OPACITY_MASK_MAP_BIT = 0x00000080;
|
||||
const int OPACITY_TRANSLUCENT_MAP_BIT = 0x00000100;
|
||||
const int EMISSIVE_MAP_BIT = 0x00000080;
|
||||
const int ALBEDO_MAP_BIT = 0x00000100;
|
||||
const int METALLIC_MAP_BIT = 0x00000200;
|
||||
const int ROUGHNESS_MAP_BIT = 0x00000400;
|
||||
const int NORMAL_MAP_BIT = 0x00000800;
|
||||
|
|
Loading…
Reference in a new issue