mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-21 07:13:19 +02:00
Cull the scenery models drawn on their own on the GPU with the instances
This commit is contained in:
@@ -511,6 +511,16 @@ bool submodel_tree_blocks_instancing( TSubModel const *Sub ) {
|
||||
if( submodel_tree_blocks_instancing( Sub->Next ) ) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
// returns true if any submodel of the tree turns to the camera: a billboard is placed from the modelview of the drawn
|
||||
// instance, which a walk started from the origin of the instance doesn't have
|
||||
bool submodel_tree_faces_camera( TSubModel const *Sub ) {
|
||||
if( Sub == nullptr ) { return false; }
|
||||
if( ( Sub->b_Anim == TAnimType::at_Billboard ) || ( Sub->b_aAnim == TAnimType::at_Billboard ) ) { return true; }
|
||||
if( submodel_tree_faces_camera( Sub->Child ) ) { return true; }
|
||||
if( submodel_tree_faces_camera( Sub->Next ) ) { return true; }
|
||||
return false;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
int TAnimModel::s_instanceable_total = 0;
|
||||
@@ -530,6 +540,7 @@ void TAnimModel::update_instanceable_flag() {
|
||||
// refs are intentionally allowed — they're either passed per-instance via
|
||||
// Material() or share global state (season) across all instances.
|
||||
m_instanceable = false;
|
||||
m_cameraindependent = ( pModel != nullptr ) && ( false == submodel_tree_faces_camera( pModel->Root ) );
|
||||
++s_classified_total;
|
||||
if( pModel == nullptr ) { ++s_rejected_no_pmodel; return; }
|
||||
if( iNumLights != 0 ) { ++s_rejected_lights; return; }
|
||||
|
||||
Reference in New Issue
Block a user