17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 10:29:13 +01:00

fix(track): seasonal and specgloss track materials blended at the joints

This commit is contained in:
2026-10-21 23:15:29 +02:00
parent 283b8523e6
commit 674abfeeab
9 changed files with 220 additions and 69 deletions

View File

@@ -152,8 +152,9 @@ public:
// itself where it can't be blended
material_handle
create_blend( material_handle const Material, std::array<material_handle, 3> const &Others, bool const Grain );
// whether the material can be blended so: a diffuse texture lit as mat_default, or with a normal map lit as normalmap,
// sunlessnormalmap or shadowlessnormalmap; not changing with the weather and seasons, not tinted
// whether the material can be blended so: a diffuse texture lit as mat_default, or with a normal map (and a specgloss map)
// lit as normalmap, sunlessnormalmap or shadowlessnormalmap (and their _specgloss); not tinted. the blending materials take the
// textures of another season or weather with the materials they blend
bool
blendable( material_handle const Material );
opengl_material const &
@@ -171,14 +172,22 @@ private:
// types
typedef std::vector<opengl_material> material_sequence;
typedef std::unordered_map<std::string, std::size_t> index_map;
// a blending material: the material of the track, those it blends into at the ends, whether in grains
using blend_key = std::tuple<material_handle, material_handle, material_handle, material_handle, bool>;
// methods:
// checks whether specified texture is in the texture bank. returns texture id, or npos.
material_handle
find_in_databank( std::string const &Materialname ) const;
// how the material is lit, of the materials a track blends: 0 as mat_default, 1 normalmap, 2 sunlessnormalmap,
// 3 shadowlessnormalmap; -1 where it can't be blended
// 3 shadowlessnormalmap, 4 more for their _specgloss; -1 where it can't be blended
int
blend_lighting( material_handle const Material );
// the blending material made of the current textures of the materials. returns: false when they can't be blended
bool
build_blend( blend_key const &Key, opengl_material &Blend );
// the blending materials made again in their places, after the materials changed their textures
void
rebuild_blends();
public:
// checks whether specified file exists. returns name of the located file, or empty string.
static std::pair<std::string, std::string>
@@ -190,7 +199,8 @@ private:
index_map m_materialmappings;
std::unordered_map<material_handle, material_handle> m_mattes;
std::map<std::tuple<material_handle, float, float, float>, material_handle> m_tints;
std::map<std::tuple<material_handle, material_handle, material_handle, material_handle, bool>, material_handle> m_blends;
std::map<blend_key, material_handle> m_blends;
std::vector<std::pair<material_handle, blend_key>> m_blendsources;
std::unordered_map<material_handle, int> m_blendables;
};