mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-20 15:04:54 +02:00
feat(renderer): a matte variant of a material for the parts of rails no wheel rolls on: it lights the same maps as weathered steel, with the weathering scaled per vertex by userdata, so a polished running surface fades into unused steel without a bright stripe; the cut faces of rails are drawn in it in an extra pass
This commit is contained in:
@@ -2225,6 +2225,12 @@ material_handle opengl33_renderer::Fetch_Material(std::string const &Filename, b
|
||||
return m_materials.create(Filename, Loadnow);
|
||||
}
|
||||
|
||||
material_handle opengl33_renderer::Matte_Material(material_handle const Material)
|
||||
{
|
||||
|
||||
return m_materials.create_matte(Material);
|
||||
}
|
||||
|
||||
std::shared_ptr<gl::program> opengl33_renderer::Fetch_Shader(const std::string &name)
|
||||
{
|
||||
auto it = m_shaders.find(name);
|
||||
@@ -4476,6 +4482,39 @@ void opengl33_renderer::Render(scene::basic_cell::path_sequence::const_iterator
|
||||
}
|
||||
flush_batch();
|
||||
|
||||
// cut faces of rails, in matte variants of the rail materials
|
||||
if ((m_renderpass.draw_mode == rendermode::color) || (m_renderpass.draw_mode == rendermode::reflections))
|
||||
{
|
||||
for (auto first{First}; first != Last; ++first)
|
||||
{
|
||||
auto const track{*first};
|
||||
|
||||
if (false == track->m_visible)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (auto const &cuts : {std::make_pair(track->m_materialcut1, &track->GeometryCut1), std::make_pair(track->m_materialcut2, &track->GeometryCut2)})
|
||||
{
|
||||
if ((cuts.first == null_handle) || cuts.second->empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (track->eEnvironment != e_flat)
|
||||
{
|
||||
flush_batch();
|
||||
setup_environment_light(track->eEnvironment);
|
||||
Bind_Material(cuts.first);
|
||||
draw(std::begin(*cuts.second), std::end(*cuts.second));
|
||||
setup_environment_light();
|
||||
continue;
|
||||
}
|
||||
begin_batch(cuts.first);
|
||||
m_pathbatch.insert(std::end(m_pathbatch), std::begin(*cuts.second), std::end(*cuts.second));
|
||||
}
|
||||
}
|
||||
flush_batch();
|
||||
}
|
||||
|
||||
// fourth pass: per-track sleeper models (sleepermodel optional directive).
|
||||
// drawn after rails/trackbeds so depth pre-pass culling is favourable, and only in passes
|
||||
// where Render_Sleepers actually does work (it gates itself on draw mode / distance).
|
||||
|
||||
Reference in New Issue
Block a user