+/*
+ * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
+ */
+
#ifndef WATER_H
#define WATER_H
.fbdepth = { .format = GL_RGBA, .div = 4 }
};
-static int world_water_init(void)
+static void world_water_init(void)
{
vg_info( "world_water_init\n" );
shader_water_register();
- if( vg_acquire_thread_sync(1) )
+ vg_acquire_thread_sync();
{
- if( !fb_init( &wrender.fbreflect ) ||
- !fb_init( &wrender.fbdepth ) )
- {
- vg_release_thread_sync(1);
- return 0;
- }
+ fb_init( &wrender.fbreflect );
+ fb_init( &wrender.fbdepth );
vg_tex2d_init( (vg_tex2d *[]){&tex_water_surf}, 1 );
-
vg_success( "done\n" );
- vg_release_thread_sync(1);
- return 1;
}
- else
- return 0;
+ vg_release_thread_sync();
}
static void world_water_free(void *_)
m4x4f projection;
m4x4_projection( projection,
gpipeline.fov,
- (float)vg_window_x / (float)vg_window_y,
+ (float)vg.window_x / (float)vg.window_y,
0.1f, 900.0f );
plane_clip_projection( projection, clippa );
m4x4_mul( projection, view, projection );
m4x4_projection( projection,
gpipeline.fov,
- (float)vg_window_x / (float)vg_window_y,
+ (float)vg.window_x / (float)vg.window_y,
0.1f, 900.0f );
plane_clip_projection( projection, clippb );
m4x4_mul( projection, view, projection );
render_world_depth( projection, camera );
- glViewport( 0, 0, vg_window_x, vg_window_y );
+ glViewport( 0, 0, vg.window_x, vg.window_y );
}
static void render_water_surface( m4x4f pv, m4x3f camera )
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 });
+ 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_uTime( vg.time );
shader_water_uCamera( camera[3] );
shader_water_uSurfaceY( wrender.height );