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

fix(render): the matte and tinted copies of a material made again with its season and weather, the primitive of a handle to no chunk told as none

The copies don't update themselves, their names aren't files to read again: after a change of the weather or the season the material got its new textures and its copies kept the old ones. They are made again from it then, under their handles. primitive() of an empty handle or one past the banks read out of the bank list; it gives no_primitive there, -1 from the renderer.
This commit is contained in:
maj00r
2026-11-03 22:00:48 +01:00
parent 89c4555e1e
commit 48af69cbf1
5 changed files with 102 additions and 44 deletions

View File

@@ -378,6 +378,8 @@ geometry_bank::vertices( gfx::geometry_handle const &Geometry ) const {
unsigned int
geometry_bank::primitive( gfx::geometry_handle const &Geometry ) const {
if( ( Geometry.chunk == 0 ) || ( Geometry.chunk > m_chunks.size() ) ) { return no_primitive; }
return geometry_bank::chunk( Geometry ).type;
}
@@ -516,6 +518,8 @@ geometrybank_manager::vertices( gfx::geometry_handle const &Geometry ) const {
unsigned int
geometrybank_manager::primitive( gfx::geometry_handle const &Geometry ) const {
if( ( Geometry.bank == 0 ) || ( Geometry.bank > m_geometrybanks.size() ) ) { return geometry_bank::no_primitive; }
return bank( Geometry ).first->primitive( Geometry );
}

View File

@@ -139,8 +139,9 @@ public:
auto vertices( gfx::geometry_handle const &Geometry ) const -> gfx::vertex_array const &;
// provides direct access to vertex user data of specfied chunk
auto userdata( gfx::geometry_handle const &Geometry ) const -> gfx::userdata_array const &;
// kind of geometry of specified chunk, GL_TRIANGLES, GL_TRIANGLE_STRIP...
// kind of geometry of specified chunk, GL_TRIANGLES, GL_TRIANGLE_STRIP...; no_primitive for a handle to no chunk
auto primitive( gfx::geometry_handle const &Geometry ) const -> unsigned int;
static constexpr unsigned int no_primitive { ~0u };
protected:
// types:

View File

@@ -2225,7 +2225,8 @@ gfx::userdata_array const &opengl33_renderer::UserData(const gfx::geometry_handl
int opengl33_renderer::Primitive(gfx::geometry_handle const &Geometry) const
{
return static_cast<int>(m_geometry.primitive(Geometry));
auto const primitive{m_geometry.primitive(Geometry)};
return primitive == gfx::geometry_bank::no_primitive ? -1 : static_cast<int>(primitive);
}
// material methods