medfall

A super great game engine
Log | Files | Refs

commit eaf4ae47482574012bb5c211a2c6531f47d43b8e
parent 3575feb7c693a6fab5a32383177c8731010df2d6
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat,  4 Nov 2017 16:09:31 +0200

Move draw_wireframe/draw_quadtree into GameState

Diffstat:
clipmap.cc | 11++++-------
game.h | 3+++
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/clipmap.cc b/clipmap.cc @@ -180,9 +180,6 @@ static void draw_qt( MinMaxu32 aabb, const array< HeightmapQuadTreeNode > nodes, } } -static bool draw_wireframe = false; -static bool draw_quadtree = false; - GAME_FRAME( game_frame ) { float fb = float( input->keys[ KEY_W ] - input->keys[ KEY_S ] ); float lr = float( input->keys[ KEY_D ] - input->keys[ KEY_A ] ); @@ -195,9 +192,9 @@ GAME_FRAME( game_frame ) { dyaw += input->keys[ KEY_J ] - input->keys[ KEY_L ]; if( input->keys[ KEY_M ] && input->key_edges[ KEY_M ] ) - draw_wireframe = !draw_wireframe; + game->draw_wireframe = !game->draw_wireframe; if( input->keys[ KEY_T ] && input->key_edges[ KEY_T ] ) - draw_quadtree = !draw_quadtree; + game->draw_quadtree = !game->draw_quadtree; dpitch -= float( input->mouse_dy * 0.25 ); dyaw -= float( input->mouse_dx * 0.25 ); @@ -256,7 +253,7 @@ GAME_FRAME( game_frame ) { render_state.textures[ 1 ] = clipmap.normalmap; render_state.textures[ 2 ] = clipmap.horizonmap; render_state.textures[ 3 ] = renderer_blue_noise(); - render_state.wireframe = draw_wireframe; + render_state.wireframe = game->draw_wireframe; renderer_draw_mesh( clipmap.tile, render_state ); } } @@ -276,7 +273,7 @@ GAME_FRAME( game_frame ) { immediate_render( impact_render_state ); } - if( draw_quadtree ) { + if( game->draw_quadtree ) { v3u32 mins = v3u32( 0, 0, clipmap.quadtree.nodes[ 0 ].min_z ); v3u32 maxs = v3u32( clipmap.quadtree.dim, clipmap.quadtree.dim, clipmap.quadtree.nodes[ 0 ].max_z ); draw_qt( MinMaxu32( mins, maxs ), clipmap.quadtree.nodes, 0 ); diff --git a/game.h b/game.h @@ -42,6 +42,9 @@ struct GameState { BTTs btt; GPUBTT gpubtt; Heightmap hm; + + bool draw_wireframe; + bool draw_quadtree; }; struct GameMemory {