projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
compiler fun
[carveJwlIkooP6JGAAIwe30JlM.git]
/
world_water.h
diff --git
a/world_water.h
b/world_water.h
index e054a111a788dea8440d06be1e8ac473f5e03227..cd4836a44cfefcdd550dc33aca5a687193745345 100644
(file)
--- a/
world_water.h
+++ b/
world_water.h
@@
-21,14
+21,6
@@
VG_STATIC void world_water_init(void)
vg_acquire_thread_sync();
{
vg_acquire_thread_sync();
{
- world.water.fbreflect.format = GL_RGB;
- world.water.fbreflect.div = 3;
- world.water.fbdepth.format = GL_RGBA;
- world.water.fbdepth.div = 4;
-
- fb_init( &world.water.fbreflect );
- fb_init( &world.water.fbdepth );
-
vg_tex2d_init( (vg_tex2d *[]){&tex_water_surf}, 1 );
}
vg_release_thread_sync();
vg_tex2d_init( (vg_tex2d *[]){&tex_water_surf}, 1 );
}
vg_release_thread_sync();
@@
-36,15
+28,6
@@
VG_STATIC void world_water_init(void)
vg_success( "done\n" );
}
vg_success( "done\n" );
}
-VG_STATIC void water_fb_resize(void)
-{
- if( !world.water.enabled )
- return;
-
- fb_resize( &world.water.fbreflect );
- fb_resize( &world.water.fbdepth );
-}
-
VG_STATIC void water_set_surface( float height )
{
world.water.height = height;
VG_STATIC void water_set_surface( float height )
{
world.water.height = height;
@@
-60,7
+43,7
@@
VG_STATIC void render_water_texture( camera *cam )
return;
/* Draw reflection buffa */
return;
/* Draw reflection buffa */
-
fb_use( &world.water.fbreflect
);
+
render_fb_bind( gpipeline.fb_water_reflection
);
glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
/*
glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
/*
@@
-69,6
+52,8
@@
VG_STATIC void render_water_texture( camera *cam )
float cam_height = cam->transform[3][1] - world.water.height;
camera water_cam;
float cam_height = cam->transform[3][1] - world.water.height;
camera water_cam;
+ water_cam.farz = cam->farz;
+ water_cam.nearz = cam->nearz;
v3_copy( cam->transform[3], water_cam.transform[3] );
water_cam.transform[3][1] -= 2.0f * cam_height;
v3_copy( cam->transform[3], water_cam.transform[3] );
water_cam.transform[3][1] -= 2.0f * cam_height;
@@
-102,7
+87,7
@@
VG_STATIC void render_water_texture( camera *cam )
* Create beneath view matrix
*/
camera beneath_cam;
* Create beneath view matrix
*/
camera beneath_cam;
-
fb_use( &world.water.fbdep
th );
+
render_fb_bind( gpipeline.fb_water_benea
th );
glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
m4x3_copy( cam->transform, beneath_cam.transform );
glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
m4x3_copy( cam->transform, beneath_cam.transform );
@@
-132,7
+117,7
@@
VG_STATIC void render_water_surface( camera *cam )
/* Draw surface */
shader_water_use();
/* Draw surface */
shader_water_use();
-
fb_bindtex( &world.water.fbreflect
, 0 );
+
render_fb_bind_texture( gpipeline.fb_water_reflection, 0
, 0 );
shader_water_uTexMain( 0 );
vg_tex2d_bind( &tex_water_surf, 1 );
shader_water_uTexMain( 0 );
vg_tex2d_bind( &tex_water_surf, 1 );
@@
-143,7
+128,7
@@
VG_STATIC void render_water_surface( camera *cam )
shader_link_standard_ub( _shader_water.id, 2 );
shader_link_standard_ub( _shader_water.id, 2 );
-
fb_bindtex( &world.water.fbdepth
, 3 );
+
render_fb_bind_texture( gpipeline.fb_water_beneath, 0
, 3 );
shader_water_uTexBack( 3 );
shader_water_uTime( world.time );
shader_water_uCamera( cam->transform[3] );
shader_water_uTexBack( 3 );
shader_water_uTime( world.time );
shader_water_uCamera( cam->transform[3] );