mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-12 00:33:29 +02:00
Cleaner way maybe
This commit is contained in:
parent
f76b6da96e
commit
3ec812d5c3
3 changed files with 8 additions and 5 deletions
|
@ -59,8 +59,7 @@ scriptable::ScriptableMaterial::ScriptableMaterial(const graphics::MaterialPoint
|
|||
model = material->getModel().c_str();
|
||||
opacity = material->getOpacity();
|
||||
|
||||
opacityMode = (opacity < 1.0f ? "opacityVarAlpha" : "opaque");
|
||||
|
||||
opacityMode = QString(graphics::MaterialKey::getAlphaMapModeName(material->getAlphaMapMode()).c_str());
|
||||
roughness = material->getRoughness();
|
||||
metallic = material->getMetallic();
|
||||
scattering = material->getScattering();
|
||||
|
@ -82,8 +81,6 @@ scriptable::ScriptableMaterial::ScriptableMaterial(const graphics::MaterialPoint
|
|||
albedoMap = map->getTextureSource()->getUrl().toString();
|
||||
if (map->useAlphaChannel()) {
|
||||
opacityMap = albedoMap;
|
||||
//opacityMode = (material->getKey().isOpacityMaskMap() ? "opacityMapAlphaMask" : "opacityMapAlphaBlend");
|
||||
opacityMode = (material->getKey().isOpacityMaskMap() ? "opacityMapAlphaMask" : "opacityMapAlphaBlend");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,12 @@ const float Material::DEFAULT_ROUGHNESS { 1.0f };
|
|||
const float Material::DEFAULT_SCATTERING{ 0.0f };
|
||||
const float Material::DEFAULT_ALPHA_CUTOFF { 0.5f };
|
||||
|
||||
|
||||
std::string MaterialKey::getAlphaMapModeName(AlphaMapMode mode) {
|
||||
const std::string names[3] = { "ALPHA_MAP_OPAQUE", "ALPHA_MAP_MASK", "ALPHA_MAP_BLEND" };
|
||||
return names[mode];
|
||||
}
|
||||
|
||||
Material::Material() {
|
||||
for (int i = 0; i < NUM_TOTAL_FLAGS; i++) {
|
||||
_propertyFallthroughs[i] = false;
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
ALPHA_MAP_MASK,
|
||||
ALPHA_MAP_BLEND,
|
||||
};
|
||||
static std::string getAlphaMapModeName(AlphaMapMode mode);
|
||||
|
||||
// The signature is the Flags
|
||||
Flags _flags;
|
||||
|
@ -211,7 +212,6 @@ public:
|
|||
}
|
||||
AlphaMapMode getAlphaMapMode() const { return (_flags[OPACITY_MASK_MAP_BIT] ? ALPHA_MAP_MASK : (_flags[OPACITY_TRANSLUCENT_MAP_BIT] ? ALPHA_MAP_BLEND : ALPHA_MAP_OPAQUE)); }
|
||||
|
||||
|
||||
bool isTranslucent() const { return isTranslucentFactor() || isTranslucentMap(); }
|
||||
bool isOpaque() const { return !isTranslucent(); }
|
||||
bool isSurfaceOpaque() const { return isOpaque() && !isOpacityMaskMap(); }
|
||||
|
|
Loading…
Reference in a new issue