diff --git a/D3D11Engine/D3D11GraphicsEngine.cpp b/D3D11Engine/D3D11GraphicsEngine.cpp index f2cb48a2..a5950f80 100644 --- a/D3D11Engine/D3D11GraphicsEngine.cpp +++ b/D3D11Engine/D3D11GraphicsEngine.cpp @@ -2759,16 +2759,18 @@ XRESULT D3D11GraphicsEngine::DrawWorldMesh( bool noTextures ) { key.Texture = aniTex; } + if ( worldMesh.first.Info->MaterialType == MaterialInfo::MT_Portal ) { + FrameTransparencyMeshesPortal.push_back( worldMesh ); + continue; + } else if ( worldMesh.first.Info->MaterialType == MaterialInfo::MT_WaterfallFoam ) { + FrameTransparencyMeshesWaterfall.push_back( worldMesh ); + continue; + } + // Check for alphablending if ( worldMesh.first.Material->GetAlphaFunc() > zMAT_ALPHA_FUNC_NONE && worldMesh.first.Material->GetAlphaFunc() != zMAT_ALPHA_FUNC_TEST ) { - if ( worldMesh.first.Info->MaterialType == MaterialInfo::MT_Portal ) { - FrameTransparencyMeshesPortal.push_back( worldMesh ); - } else if ( worldMesh.first.Info->MaterialType == MaterialInfo::MT_WaterfallFoam ) { - FrameTransparencyMeshesWaterfall.push_back( worldMesh ); - } else { - FrameTransparencyMeshes.push_back( worldMesh ); - } + FrameTransparencyMeshes.push_back( worldMesh ); } else { // Create a new pair using the animated texture meshList.emplace_back( key, worldMesh.second ); diff --git a/D3D11Engine/WorldConverter.cpp b/D3D11Engine/WorldConverter.cpp index e24f0d4c..dae9c47f 100644 --- a/D3D11Engine/WorldConverter.cpp +++ b/D3D11Engine/WorldConverter.cpp @@ -352,16 +352,19 @@ HRESULT WorldConverter::ConvertWorldMesh( zCPolygon** polys, unsigned int numPol continue; } - //Flag portals so that we can apply a different PS shader later - if ( poly->GetPolyFlags()->PortalPoly && poly->GetMaterial()->GetTexture() ) { - std::string textureName = poly->GetMaterial()->GetTexture()->GetNameWithoutExt(); - if ( textureName == "OWODFLWOODGROUND" ) { - continue; //this is a ground texture that is sometimes re-used for visual tricks to darken tunnels, etc. We don't want to treat this as a portal. - } else { - MaterialInfo* info = Engine::GAPI->GetMaterialInfoFrom( poly->GetMaterial()->GetTexture() ); - if ( info ) { + // Flag portals so that we can apply a different PS shader later + if ( poly->GetPolyFlags()->PortalPoly ) { + zCMaterial* polymat = poly->GetMaterial(); + if ( zCTexture* tex = polymat->GetTextureSingle() ) { + std::string textureName = tex->GetNameWithoutExt(); + if ( textureName == "OWODFLWOODGROUND" ) { + continue; // this is a ground texture that is sometimes re-used for visual tricks to darken tunnels, etc. We don't want to treat this as a portal. + } else { + MaterialInfo* info = Engine::GAPI->GetMaterialInfoFrom( tex ); info->MaterialType = MaterialInfo::MT_Portal; } + } else { + continue; } } diff --git a/D3D11Engine/zCMaterial.h b/D3D11Engine/zCMaterial.h index f4846bb2..7ea95419 100644 --- a/D3D11Engine/zCMaterial.h +++ b/D3D11Engine/zCMaterial.h @@ -165,7 +165,7 @@ class zCMaterial { } bool HasTexAniMap() { - return *reinterpret_cast(THISPTR_OFFSET( GothicMemoryLocations::zCMaterial::Offset_AlphaFunc )) & GothicMemoryLocations::zCMaterial::Mask_FlagTexAniMap; + return *reinterpret_cast(THISPTR_OFFSET( GothicMemoryLocations::zCMaterial::Offset_Flags )) & GothicMemoryLocations::zCMaterial::Mask_FlagTexAniMap; } XMFLOAT2 GetTexAniMapDelta() {