medfall

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

commit f380d958b40b29bfb0fd3ade7636eba57909e62a
parent b5c4d79306d200a976de09e69f82249cda5d1667
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Dec 25 17:16:55 +0200

Add a constructor to RenderState

Diffstat:
bsp.cc | 6+++---
hm.cc | 8++++----
immediate.cc | 2+-
mod_btt.cc | 6+++---
renderer.cc | 2+-
renderer.h | 20++++++++++----------
skybox.cc | 2+-
terrain_manager.cc | 2+-
text_renderer.cc | 2+-
9 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/bsp.cc b/bsp.cc @@ -366,7 +366,7 @@ extern "C" GAME_FRAME( game_frame ) { renderer_begin_frame(); renderer_ub_data( test_ub, &fsdata, sizeof( fsdata ) ); - RenderState render_state = { }; + RenderState render_state; render_state.shader = game->test_shader; render_state.ubs[ UB_VS_HOT ] = test_ub; bspr_render( &game->bspr, game->pos, render_state ); @@ -389,7 +389,7 @@ extern "C" GAME_FRAME( game_frame ) { } } - RenderState immediate_render_state = { }; + RenderState immediate_render_state; immediate_render_state.shader = game->test_shader; immediate_render_state.ubs[ UB_VS_HOT ] = test_ub; immediate_render( &imm, immediate_render_state ); @@ -442,7 +442,7 @@ extern "C" GAME_FRAME( game_frame ) { mesh_config.num_vertices = 6; Mesh mesh = renderer_new_mesh( mesh_config ); - RenderState render_state2 = { }; + RenderState render_state2; render_state2.shader = texture_shader; render_state2.textures[ 0 ] = texture; diff --git a/hm.cc b/hm.cc @@ -198,7 +198,7 @@ extern "C" GAME_FRAME( game_frame ) { skybox_render( &game->skybox, game->angles, game->test_sun ); terrain_render( &game->tm, V, P, game->test_sun, current_time ); - RenderState immediate_render_state = { }; + RenderState immediate_render_state; immediate_render_state.shader = game->test_shader; immediate_render_state.depth_func = DEPTHFUNC_DISABLED; immediate_render( &game->test_immediate, immediate_render_state ); @@ -220,7 +220,7 @@ extern "C" GAME_FRAME( game_frame ) { m4 VP = V * P; renderer_ub_data( ub_sphere, &VP, sizeof( VP ) ); - RenderState impact_render_state = { }; + RenderState impact_render_state; impact_render_state.shader = game->test_outline_shader; impact_render_state.ubs[ UB_VS_HOT ] = ub_sphere; immediate_render( &imm, impact_render_state ); @@ -256,7 +256,7 @@ extern "C" GAME_FRAME( game_frame ) { } } - RenderState fireball_render_state = { }; + RenderState fireball_render_state; fireball_render_state.shader = game->test_outline_shader; fireball_render_state.ubs[ UB_VS_HOT ] = ub_sphere; immediate_render( &imm, fireball_render_state ); @@ -346,7 +346,7 @@ extern "C" GAME_FRAME( game_frame ) { m4 VP = V * P; renderer_ub_data( ub_sphere, &VP, sizeof( VP ) ); - RenderState impact_render_state = { }; + RenderState impact_render_state; impact_render_state.shader = game->test_outline_shader; impact_render_state.ubs[ UB_VS_HOT ] = ub_sphere; immediate_render( &imm, impact_render_state ); diff --git a/immediate.cc b/immediate.cc @@ -216,7 +216,7 @@ void immediate_arrow( } void immediate_render( const ImmediateContext * ctx, Shader shader, Texture texture ) { - RenderState render_state = { }; + RenderState render_state; render_state.shader = shader; render_state.textures[ 0 ] = texture; diff --git a/mod_btt.cc b/mod_btt.cc @@ -267,7 +267,7 @@ extern "C" GAME_FRAME( game_frame ) { renderer_ub_data( ub_vs, &VP, sizeof( VP ) ); renderer_ub_data( ub_fs, &fs_data, sizeof( fs_data ) ); - RenderState render_state = { }; + RenderState render_state; render_state.shader = game->test_shader; render_state.ubs[ UB_VS_HOT ] = ub_vs; render_state.ubs[ UB_FS_HOT ] = ub_fs; @@ -290,7 +290,7 @@ extern "C" GAME_FRAME( game_frame ) { } else printf( "nope\n" ); - RenderState impact_render_state = { }; + RenderState impact_render_state; impact_render_state.shader = game->test_outline_shader; impact_render_state.ubs[ UB_VS_HOT ] = ub_vs; immediate_render( &imm, impact_render_state ); @@ -302,7 +302,7 @@ extern "C" GAME_FRAME( game_frame ) { v3u32 maxs = v3u32( qt.dim, qt.dim, qt.nodes[ 0 ].max_z ); draw_qt( &imm, AABBu32( mins, maxs ), qt.nodes, 0 ); - RenderState qt_render_state = { }; + RenderState qt_render_state; qt_render_state.shader = game->test_outline_shader; qt_render_state.ubs[ UB_VS_HOT ] = ub_vs; qt_render_state.wireframe = true; diff --git a/renderer.cc b/renderer.cc @@ -453,7 +453,7 @@ static GLenum primitivetype_to_glenum( PrimitiveType primitive_type ) { return 0; } -static RenderState previous_render_state = { }; +static RenderState previous_render_state; void renderer_draw_mesh( const Mesh & mesh, RenderState state ) { if( state.shader != previous_render_state.shader ) { diff --git a/renderer.h b/renderer.h @@ -60,16 +60,16 @@ struct TB { #define RENDERER_MAX_UBS 4 struct RenderState { - Texture textures[ RENDERER_MAX_TEXTURES ]; - TB tbs[ RENDERER_MAX_TEXTURE_BUFFERS ]; - UB ubs[ RENDERER_MAX_UBS ]; - Shader shader; - DepthFunc depth_func; - CullFace cull_face; - bool disable_depth_writes; - bool disable_colour_writes; - bool enable_alpha_blending; - bool wireframe; + Texture textures[ RENDERER_MAX_TEXTURES ] = { }; + TB tbs[ RENDERER_MAX_TEXTURE_BUFFERS ] = { }; + UB ubs[ RENDERER_MAX_UBS ] = { }; + Shader shader = 0; + DepthFunc depth_func = DEPTHFUNC_LESS; + CullFace cull_face = CULLFACE_BACK; + bool disable_depth_writes = false; + bool disable_colour_writes = false; + bool enable_alpha_blending = false; + bool wireframe = false; }; enum PrimitiveType { diff --git a/skybox.cc b/skybox.cc @@ -93,7 +93,7 @@ void skybox_render( const Skybox * skybox, v3 view_angles, float sun ) { renderer_ub_data( skybox->vertex_uniforms, &vsdata, sizeof( vsdata ) ); renderer_ub_data( skybox->fragment_uniforms, &fsdata, sizeof( fsdata ) ); - RenderState render_state = { }; + RenderState render_state; render_state.shader = skybox->shader; render_state.cull_face = CULLFACE_FRONT; render_state.disable_depth_writes = true; diff --git a/terrain_manager.cc b/terrain_manager.cc @@ -457,7 +457,7 @@ void terrain_render( TerrainManager * tm, const m4 & V, const m4 & P, float sun, renderer_tb_data( tm->point_light_colours, tbo2, sizeof( tbo2 ) ); /* end lighting */ - RenderState render_state = { }; + RenderState render_state; render_state.shader = tm->shader; render_state.ubs[ UB_VS_HOT ] = tm->vertex_uniforms; render_state.ubs[ UB_FS_HOT ] = tm->fragment_uniforms; diff --git a/text_renderer.cc b/text_renderer.cc @@ -147,7 +147,7 @@ void draw_text( const char * str, float x, float y, float pixel_size ) { str++; } - RenderState render_state = { }; + RenderState render_state; render_state.shader = shader; render_state.textures[ 0 ] = sizes[ size_idx ].atlas; render_state.depth_func = DEPTHFUNC_DISABLED;