X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_water.c;h=085e25250ac8217ea746c97bdf918c67105f79f6;hb=e311bbe2fa903a7e2a922f202f389b799193195d;hp=fca39720e0aa5ad119da60e34adf18d18a95f55e;hpb=342fcbf6fda017bdd38d56ce0fa7c9e59e589f3b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_water.c b/world_water.c index fca3972..085e252 100644 --- a/world_water.c +++ b/world_water.c @@ -12,8 +12,7 @@ #include "shaders/scene_water_fast.h" #include "scene.h" -VG_STATIC void world_water_init(void) -{ +static void world_water_init(void){ vg_info( "world_water_init\n" ); shader_scene_water_register(); shader_scene_water_fast_register(); @@ -25,29 +24,26 @@ VG_STATIC void world_water_init(void) vg_success( "done\n" ); } -VG_STATIC void water_set_surface( world_instance *world, float height ) -{ +static void water_set_surface( world_instance *world, float height ){ world->water.height = height; v4_copy( (v4f){ 0.0f, 1.0f, 0.0f, height }, world->water.plane ); } -VG_STATIC void world_link_lighting_ub( world_instance *world, GLuint shader ); -VG_STATIC void world_bind_position_texture( world_instance *world, +static void world_link_lighting_ub( world_instance *world, GLuint shader ); +static void world_bind_position_texture( world_instance *world, GLuint shader, GLuint location, int slot ); -VG_STATIC void world_bind_light_array( world_instance *world, +static void world_bind_light_array( world_instance *world, GLuint shader, GLuint location, int slot ); -VG_STATIC void world_bind_light_index( world_instance *world, +static void world_bind_light_index( world_instance *world, GLuint shader, GLuint location, int slot ); /* * Does not write motion vectors */ -VG_STATIC void render_water_texture( world_instance *world, camera *cam, - int layer_depth ) -{ +static void render_water_texture( world_instance *world, camera *cam ){ if( !world->water.enabled || (vg.quality_profile == k_quality_profile_low) ) return; @@ -91,7 +87,7 @@ VG_STATIC void render_water_texture( world_instance *world, camera *cam, glEnable( GL_DEPTH_TEST ); glDisable( GL_BLEND ); glCullFace( GL_FRONT ); - render_world( world, &water_cam, layer_depth ); + render_world( world, &water_cam, 0, 1, 0, 1 ); glCullFace( GL_BACK ); /* @@ -121,8 +117,7 @@ VG_STATIC void render_water_texture( world_instance *world, camera *cam, //glViewport( 0,0, g_render_x, g_render_y ); } -VG_STATIC void render_water_surface( world_instance *world, camera *cam ) -{ +static void render_water_surface( world_instance *world, camera *cam ){ if( !world->water.enabled ) return; @@ -141,16 +136,10 @@ VG_STATIC void render_water_surface( world_instance *world, camera *cam ) 1.0f / (float)vg.window_x, 1.0f / (float)vg.window_y }); - world_link_lighting_ub( world, _shader_scene_water.id ); - world_bind_position_texture( world, _shader_scene_water.id, - _uniform_scene_water_g_world_depth, 2 ); - world_bind_light_array( world, _shader_scene_water.id, - _uniform_scene_water_uLightsArray, 4 ); - world_bind_light_index( world, _shader_scene_water.id, - _uniform_scene_water_uLightsIndex, 5 ); + WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, scene_water ); - render_fb_bind_texture( gpipeline.fb_water_beneath, 0, 3 ); - shader_scene_water_uTexBack( 3 ); + render_fb_bind_texture( gpipeline.fb_water_beneath, 0, 5 ); + shader_scene_water_uTexBack( 5 ); shader_scene_water_uTime( world_static.time ); shader_scene_water_uCamera( cam->transform[3] ); shader_scene_water_uSurfaceY( world->water.height ); @@ -191,11 +180,8 @@ VG_STATIC void render_water_surface( world_instance *world, camera *cam ) shader_scene_water_fast_uTime( world_static.time ); shader_scene_water_fast_uCamera( cam->transform[3] ); shader_scene_water_fast_uSurfaceY( world->water.height ); - world_link_lighting_ub( world, _shader_scene_water_fast.id ); - world_bind_position_texture( world, _shader_scene_water_fast.id, - _uniform_scene_water_fast_g_world_depth, 2 ); - world_bind_light_array( world, _shader_scene_water_fast.id, - _uniform_scene_water_fast_uLightsArray, 4 ); + + WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, scene_water_fast ); m4x3f full; m4x3_identity( full );