mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
add adapter for legacy reflection materials
This commit is contained in:
@@ -108,11 +108,15 @@ std::string_view MaterialAdapterLegacyMatFile::GetTexturePathForEntry(
|
||||
if (auto it = m_texture_mapping.find("_normals:");
|
||||
it != m_texture_mapping.end()) {
|
||||
return it->second.m_path;
|
||||
}
|
||||
}
|
||||
if (auto it = m_texture_mapping.find("_normalmap:");
|
||||
it != m_texture_mapping.end()) {
|
||||
return it->second.m_path;
|
||||
}
|
||||
}
|
||||
if (auto it = m_texture_mapping.find("_reflmap:");
|
||||
it != m_texture_mapping.end()) {
|
||||
return it->second.m_path;
|
||||
}
|
||||
if (auto it = m_texture_mapping.find("2:"); it != m_texture_mapping.end()) {
|
||||
return it->second.m_path;
|
||||
}
|
||||
@@ -138,6 +142,9 @@ std::string_view MaterialAdapterLegacyMatFile::GetShader() const {
|
||||
if (IsNormalMapShader() && HasNormalMap()) {
|
||||
return "legacy_normalmap";
|
||||
}
|
||||
if (HasNormalMap()) {
|
||||
return "legacy_reflection";
|
||||
}
|
||||
return "legacy";
|
||||
}
|
||||
|
||||
@@ -255,6 +262,7 @@ bool MaterialAdapterLegacyMatFile::ParseLevel(cParser& parser, int priority) {
|
||||
bool MaterialAdapterLegacyMatFile::HasNormalMap() const {
|
||||
return m_texture_mapping.find("_normals:") != m_texture_mapping.end() ||
|
||||
m_texture_mapping.find("_normalmap:") != m_texture_mapping.end() ||
|
||||
m_texture_mapping.find("_reflmap:") != m_texture_mapping.end() ||
|
||||
m_texture_mapping.find("2:") != m_texture_mapping.end();
|
||||
}
|
||||
|
||||
@@ -267,6 +275,10 @@ bool MaterialAdapterLegacyMatFile::IsNormalMapShader() const {
|
||||
m_shader.find("parallax") != std::string::npos;
|
||||
}
|
||||
|
||||
bool MaterialAdapterLegacyMatFile::IsReflectionShader() const {
|
||||
return m_shader.find("reflmap") != std::string::npos;
|
||||
}
|
||||
|
||||
bool MaterialAdapterLegacyMatFile::IsSpecGlossShader() const {
|
||||
return m_shader.find("specgloss") != std::string::npos;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ struct MaterialAdapterLegacyMatFile : public MaterialAdapterInternal {
|
||||
bool HasSpecGlossMap() const;
|
||||
bool IsSpecGlossShader() const;
|
||||
bool IsNormalMapShader() const;
|
||||
bool IsReflectionShader() const;
|
||||
std::unordered_map<std::string, TextureEntry> m_texture_mapping;
|
||||
virtual int GetShadowRank() const override { return m_shadow_rank; }
|
||||
virtual std::optional<float> GetOpacity() const override;
|
||||
|
||||
Reference in New Issue
Block a user