17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-08 18:50:34 +01:00

Instancing: skip the buckets of a cell lying wholly beyond the range of their instances (#225)

* perf(instancing): skip a cell's buckets lying wholly beyond the range of their instances

* perf(instancing): go only through the instances drawn one by one in the per-node pass

* perf(instancing): leave out of the color pass the cells holding only instances too far to be drawn

* refactor(instancing): keep the caches of the instances of a cell without mutable fields, set by the renderer when the cell is queued
This commit is contained in:
pawelw
2026-11-07 12:35:55 +01:00
committed by GitHub
parent 3a29a165a9
commit 55ba7a9f41
6 changed files with 119 additions and 2 deletions

View File

@@ -514,6 +514,7 @@ bool submodel_tree_blocks_instancing( TSubModel const *Sub ) {
} // anonymous namespace
int TAnimModel::s_instanceable_total = 0;
unsigned int TAnimModel::s_instanceable_revoked = 0;
int TAnimModel::s_classified_total = 0;
int TAnimModel::s_rejected_no_pmodel = 0;
int TAnimModel::s_rejected_lights = 0;
@@ -551,6 +552,7 @@ std::shared_ptr<TAnimContainer> TAnimModel::AddContainer(std::string const &Name
m_animlist.push_back(tmp);
// containers are added by events after the instance was loaded and bucketed;
// the instanced path skips RaAnimate(), so this instance has to be drawn on its own
if( m_instanceable ) { ++s_instanceable_revoked; }
m_instanceable = false;
return tmp;
}
@@ -780,6 +782,7 @@ void TAnimModel::SkinSet( int const Index, material_handle const Material ) {
m_materialdata.replacable_skins[ std::clamp( Index, 1, 4 ) ] = Material;
// the instance stays in the bucket of its old skin set, where it would get the textures of the batch
if( m_instanceable ) { ++s_instanceable_revoked; }
m_instanceable = false;
}