- /* Draw surface */
- shader_water_use();
-
- fb_bindtex( &wrender.fbreflect, 0 );
- shader_water_uTexMain( 0 );
-
- vg_tex2d_bind( &tex_water_surf, 1 );
- shader_water_uTexDudv( 1 );
- shader_water_uInvRes( (v2f){
- 1.0f / (float)vg.window_x,
- 1.0f / (float)vg.window_y });
-
- shader_link_standard_ub( _shader_water.id, 2 );
-
- fb_bindtex( &wrender.fbdepth, 3 );
- shader_water_uTexBack( 3 );
- shader_water_uTime( vg.time );
- shader_water_uCamera( camera[3] );
- shader_water_uSurfaceY( wrender.height );
-
- shader_water_uPv( pv );
-
- m4x3f full;
- m4x3_identity( full );
- full[3][1] = wrender.height;
-
- shader_water_uMdl( full );
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glBlendEquation(GL_FUNC_ADD);
-
- mesh_bind( &wrender.mdl );
- mesh_draw( &wrender.mdl );
-
- glDisable(GL_BLEND);
+ if( vg.quality_profile == k_quality_profile_high ){
+ /* Draw surface */
+ shader_scene_water_use();
+
+ render_fb_bind_texture( gpipeline.fb_water_reflection, 0, 0 );
+ shader_scene_water_uTexMain( 0 );
+
+ vg_tex2d_bind( &tex_water_surf, 1 );
+ shader_scene_water_uTexDudv( 1 );
+ shader_scene_water_uInvRes( (v2f){
+ 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 );
+
+ render_fb_bind_texture( gpipeline.fb_water_beneath, 0, 3 );
+ shader_scene_water_uTexBack( 3 );
+ shader_scene_water_uTime( world_global.time );
+ shader_scene_water_uCamera( cam->transform[3] );
+ shader_scene_water_uSurfaceY( world->water.height );
+
+ shader_scene_water_uPv( cam->mtx.pv );
+ shader_scene_water_uPvmPrev( cam->mtx_prev.pv );
+
+ m4x3f full;
+ m4x3_identity( full );
+ shader_scene_water_uMdl( full );
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glBlendEquation(GL_FUNC_ADD);
+
+ mesh_bind( &world->mesh_no_collide );
+
+ for( int i=0; i<world->surface_count; i++ ){
+ struct world_surface *mat = &world->surfaces[i];
+
+ if( mat->info.shader == k_shader_water ){
+ shader_scene_water_uShoreColour( mat->info.colour );
+ shader_scene_water_uOceanColour( mat->info.colour1 );
+
+ mdl_draw_submesh( &mat->sm_no_collide );
+ }
+ }
+
+ glDisable(GL_BLEND);
+ }
+ else if( vg.quality_profile == k_quality_profile_low ){
+ shader_scene_water_fast_use();
+
+ vg_tex2d_bind( &tex_water_surf, 1 );
+ shader_scene_water_fast_uTexDudv( 1 );
+ shader_scene_water_fast_uTime( world_global.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 );
+
+ m4x3f full;
+ m4x3_identity( full );
+ shader_scene_water_fast_uMdl( full );
+ shader_scene_water_fast_uPv( cam->mtx.pv );
+ shader_scene_water_fast_uPvmPrev( cam->mtx_prev.pv );
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glBlendEquation(GL_FUNC_ADD);
+
+ mesh_bind( &world->mesh_no_collide );
+
+ for( int i=0; i<world->surface_count; i++ ){
+ struct world_surface *mat = &world->surfaces[i];
+
+ if( mat->info.shader == k_shader_water ){
+ shader_scene_water_fast_uShoreColour( mat->info.colour );
+ shader_scene_water_fast_uOceanColour( mat->info.colour1 );
+
+ mdl_draw_submesh( &mat->sm_no_collide );
+ }
+ }
+
+ glDisable(GL_BLEND);
+ }