medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 0f522205317e5a7d8e27e1ea45238c851db8c7ab
parent 65ec2591e48f0d4a314f46ed94bc85138338ff57
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Fri Dec  9 20:32:48 +0200

More efficient draw_qt

Diffstat:
mod_btt.cc | 13+++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/mod_btt.cc b/mod_btt.cc @@ -216,17 +216,14 @@ struct FSData { }; static void draw_qt( ImmediateContext * imm, AABBu32 aabb, const array< HeightmapQuadTreeNode > nodes, size_t node_idx ) { - if( aabb.maxs.x - aabb.mins.x >= 32 ) { - v3 mins( aabb.mins.x, aabb.mins.y, aabb.mins.z ); - v3 maxs( aabb.maxs.x, aabb.maxs.y, aabb.maxs.z ); - immediate_aabb( imm, mins, maxs, v4( 0, 0, 1, 1 ) ); - } - else return; - - if( aabb.maxs.x - aabb.mins.x == 1 || aabb.maxs.y - aabb.mins.y == 1 ) { + if( aabb.maxs.x - aabb.mins.x < 32 ) { return; } + v3 mins( aabb.mins.x, aabb.mins.y, aabb.mins.z ); + v3 maxs( aabb.maxs.x, aabb.maxs.y, aabb.maxs.z ); + immediate_aabb( imm, mins, maxs, v4( 0, 0, 1, 1 ) ); + for( size_t i = 0; i < 4; i++ ) { AABBu32 child_aabb = aabb.quadrant( i ).clamp_z( nodes[ node_idx * 4 + i + 1 ].min_z, nodes[ node_idx * 4 + i + 1 ].max_z ); draw_qt( imm, child_aabb, nodes, node_idx * 4 + i + 1 );