Both DIFFUSE and ALBEDO can dictate transparency.
This commit is contained in:
parent
5282f693f9
commit
f646be2e47
|
@ -44,14 +44,16 @@ static bool TriangleTexturePolarity(const Vec2f &uv0, const Vec2f &uv1, const Ve
|
||||||
static RawMaterialType
|
static RawMaterialType
|
||||||
GetMaterialType(const RawModel &raw, const int textures[RAW_TEXTURE_USAGE_MAX], const bool vertexTransparency, const bool skinned)
|
GetMaterialType(const RawModel &raw, const int textures[RAW_TEXTURE_USAGE_MAX], const bool vertexTransparency, const bool skinned)
|
||||||
{
|
{
|
||||||
// If diffusely texture, determine material type based on texture occlusion.
|
// DIFFUSE and ALBEDO are different enough to represent distinctly, but they both help determine transparency.
|
||||||
if (textures[RAW_TEXTURE_USAGE_DIFFUSE] >= 0) {
|
int diffuseTexture = textures[RAW_TEXTURE_USAGE_DIFFUSE];
|
||||||
switch (raw.GetTexture(textures[RAW_TEXTURE_USAGE_DIFFUSE]).occlusion) {
|
if (diffuseTexture < 0) {
|
||||||
case RAW_TEXTURE_OCCLUSION_OPAQUE:
|
diffuseTexture = textures[RAW_TEXTURE_USAGE_ALBEDO];
|
||||||
return skinned ? RAW_MATERIAL_TYPE_SKINNED_OPAQUE : RAW_MATERIAL_TYPE_OPAQUE;
|
}
|
||||||
case RAW_TEXTURE_OCCLUSION_TRANSPARENT:
|
// determine material type based on texture occlusion.
|
||||||
return skinned ? RAW_MATERIAL_TYPE_SKINNED_TRANSPARENT : RAW_MATERIAL_TYPE_TRANSPARENT;
|
if (diffuseTexture >= 0) {
|
||||||
}
|
return (raw.GetTexture(diffuseTexture).occlusion == RAW_TEXTURE_OCCLUSION_OPAQUE)
|
||||||
|
? (skinned ? RAW_MATERIAL_TYPE_SKINNED_OPAQUE : RAW_MATERIAL_TYPE_OPAQUE)
|
||||||
|
: (skinned ? RAW_MATERIAL_TYPE_SKINNED_TRANSPARENT : RAW_MATERIAL_TYPE_TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// else if there is any vertex transparency, treat whole mesh as transparent
|
// else if there is any vertex transparency, treat whole mesh as transparent
|
||||||
|
|
Loading…
Reference in New Issue