16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 19:49:19 +02:00

opacity handling hacks (part 2)

This commit is contained in:
milek7
2022-03-07 20:36:36 +01:00
parent 520342f6f0
commit 6e9041a214

View File

@@ -422,7 +422,7 @@ std::pair<int, int> TSubModel::Load( cParser &parser, bool dynamic )
{ {
const opengl_material &mat = GfxRenderer->Material(m_material); const opengl_material &mat = GfxRenderer->Material(m_material);
// if material have opacity set, replace submodel opacity with it // if material does have opacity set, replace submodel opacity with it
if (mat.opacity) if (mat.opacity)
{ {
iFlags &= ~0x30; iFlags &= ~0x30;
@@ -2056,6 +2056,16 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
{ {
opengl_material const &mat = GfxRenderer->Material(m_material); opengl_material const &mat = GfxRenderer->Material(m_material);
// if material does have opacity set, replace submodel opacity with it
if (mat.opacity)
{
iFlags &= ~0x30;
if (*mat.opacity == 0.0f)
iFlags |= 0x20; // translucent
else
iFlags |= 0x10; // opaque
}
// replace submodel selfillum with material one // replace submodel selfillum with material one
if( mat.selfillum ) { if( mat.selfillum ) {
fLight = mat.selfillum.value(); fLight = mat.selfillum.value();