Corrected transparency mode
parent
a1ea633a3e
commit
a54a59146d
|
@ -90,6 +90,11 @@ struct Color
|
||||||
c.a *= scale;
|
c.a *= scale;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color operator*(const Color& other) const
|
||||||
|
{
|
||||||
|
return Color{ r * other.r, g * other.g, b * other.b, a * other.a };
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3581,14 +3581,14 @@ void CEngine::Draw3DScene()
|
||||||
|
|
||||||
objectRenderer->Begin();
|
objectRenderer->Begin();
|
||||||
objectRenderer->SetLighting(false);
|
objectRenderer->SetLighting(false);
|
||||||
objectRenderer->SetTransparency(TransparencyMode::ALPHA);
|
objectRenderer->SetTransparency(TransparencyMode::BLACK);
|
||||||
objectRenderer->SetAlphaScissor(0.0f);
|
objectRenderer->SetAlphaScissor(0.5f);
|
||||||
|
objectRenderer->SetCullMode(false);
|
||||||
|
|
||||||
// Draw transparent objects
|
// Draw transparent objects
|
||||||
|
|
||||||
if (transparent)
|
if (transparent)
|
||||||
{
|
{
|
||||||
int tState = ENG_RSTATE_TTEXTURE_BLACK | ENG_RSTATE_2FACE;
|
|
||||||
Color tColor = Color(68.0f / 255.0f, 68.0f / 255.0f, 68.0f / 255.0f, 68.0f / 255.0f);
|
Color tColor = Color(68.0f / 255.0f, 68.0f / 255.0f, 68.0f / 255.0f, 68.0f / 255.0f);
|
||||||
|
|
||||||
for (int objRank = 0; objRank < static_cast<int>(m_objects.size()); objRank++)
|
for (int objRank = 0; objRank < static_cast<int>(m_objects.size()); objRank++)
|
||||||
|
@ -3635,9 +3635,8 @@ void CEngine::Draw3DScene()
|
||||||
|
|
||||||
float dirty = (p3.state & ENG_RSTATE_DUAL_BLACK) && m_dirty ? 1.0 : 0.0;
|
float dirty = (p3.state & ENG_RSTATE_DUAL_BLACK) && m_dirty ? 1.0 : 0.0;
|
||||||
objectRenderer->SetDirty(dirty);
|
objectRenderer->SetDirty(dirty);
|
||||||
auto color = p3.material.diffuse;
|
auto color = p3.material.diffuse * tColor;
|
||||||
objectRenderer->SetColor({ color.r, color.g, color.b, 0.5f });// -m_objects[objRank].transparency });
|
objectRenderer->SetColor({ color.r, color.g, color.b, 1.0f });
|
||||||
objectRenderer->SetCullMode((p3.state& ENG_RSTATE_2FACE) == 0);
|
|
||||||
objectRenderer->DrawObject(p3.buffer);
|
objectRenderer->DrawObject(p3.buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,13 +312,13 @@ void CGL33ObjectRenderer::SetTransparency(TransparencyMode mode)
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_FALSE);
|
||||||
break;
|
break;
|
||||||
case TransparencyMode::WHITE:
|
case TransparencyMode::WHITE:
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_DST_COLOR, GL_ZERO);
|
glBlendFunc(GL_DST_COLOR, GL_ZERO);
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue