X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=render.h;h=ea88ecc4df956c54f206f50a3b5c5946a17aea43;hb=137d40d96fe923600d8378b8e138e3c276f27ff4;hp=751ca1ba54bb9f60e9847697548dcfd75409919e;hpb=cb1d2f9fbec8a274aaf7a80c5fb552b928148b1e;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/render.h b/render.h index 751ca1b..ea88ecc 100644 --- a/render.h +++ b/render.h @@ -20,13 +20,14 @@ static f32 k_render_scale = 1.0f; static i32 k_blur_effect = 1; static f32 k_blur_strength = 0.3f; static f32 k_fov = 0.86f; +static f32 k_cam_height = 0.8f; typedef struct framebuffer framebuffer; /* * All standard buffers used in rendering */ -VG_STATIC struct pipeline{ +static struct pipeline{ glmesh fsquad; framebuffer *fb_main, @@ -195,7 +196,7 @@ framebuffers[] = /* * Get the current (automatically scaled or fixed) resolution of framebuffer */ -VG_STATIC void render_fb_get_current_res( struct framebuffer *fb, +static void render_fb_get_current_res( struct framebuffer *fb, int *x, int *y ) { if( fb->resolution_div ){ @@ -208,7 +209,7 @@ VG_STATIC void render_fb_get_current_res( struct framebuffer *fb, } } -VG_STATIC void render_fb_inverse_ratio( framebuffer *fb, v2f inverse ) +static void render_fb_inverse_ratio( framebuffer *fb, v2f inverse ) { if( fb ){ int x, y; @@ -227,7 +228,7 @@ VG_STATIC void render_fb_inverse_ratio( framebuffer *fb, v2f inverse ) /* * Bind framebuffer for drawing to */ -VG_STATIC void render_fb_bind( framebuffer *fb, int use_scaling ) +static void render_fb_bind( framebuffer *fb, int use_scaling ) { int x, y; render_fb_get_current_res( fb, &x, &y ); @@ -250,7 +251,7 @@ VG_STATIC void render_fb_bind( framebuffer *fb, int use_scaling ) /* * Bind framebuffer attachment's texture */ -VG_STATIC void render_fb_bind_texture( framebuffer *fb, +static void render_fb_bind_texture( framebuffer *fb, int attachment, int slot ) { struct framebuffer_attachment *at = &fb->attachments[attachment]; @@ -276,7 +277,7 @@ VG_STATIC void render_fb_bind_texture( framebuffer *fb, /* * Convert OpenGL attachment ID enum to string */ -VG_STATIC const char *render_fb_attachment_str( GLenum e ) +static const char *render_fb_attachment_str( GLenum e ) { struct { GLenum e; const char *str; } formats[] = @@ -300,7 +301,7 @@ VG_STATIC const char *render_fb_attachment_str( GLenum e ) * Convert OpenGL texture format enums from TexImage2D table 1,2 & * RenderBufferStorage Table 1, into strings */ -VG_STATIC const char *render_fb_format_str( GLenum format ) +static const char *render_fb_format_str( GLenum format ) { struct { GLenum e; const char *str; } formats[] = @@ -395,7 +396,7 @@ VG_STATIC const char *render_fb_format_str( GLenum format ) /* * Bind and allocate texture for framebuffer attachment */ -VG_STATIC void render_fb_allocate_texture( struct framebuffer *fb, +static void render_fb_allocate_texture( struct framebuffer *fb, struct framebuffer_attachment *a ) { int rx, ry; @@ -417,7 +418,7 @@ VG_STATIC void render_fb_allocate_texture( struct framebuffer *fb, /* * Full allocation of a framebuffer */ -VG_STATIC void render_fb_allocate( struct framebuffer *fb ) +static void render_fb_allocate( struct framebuffer *fb ) { glGenFramebuffers( 1, &fb->fb ); glBindFramebuffer( GL_FRAMEBUFFER, fb->fb ); @@ -501,7 +502,7 @@ VG_STATIC void render_fb_allocate( struct framebuffer *fb ) /* * Resize/Update all framebuffers(we know about) */ -VG_STATIC void render_fb_resize(void) +static void render_fb_resize(void) { if( !gpipeline.ready ) return; @@ -514,10 +515,10 @@ VG_STATIC void render_fb_resize(void) } } -VG_STATIC int render_framebuffer_control( int argc, char const *argv[] ); -VG_STATIC void render_framebuffer_poll( int argc, char const *argv[] ); +static int render_framebuffer_control( int argc, char const *argv[] ); +static void render_framebuffer_poll( int argc, char const *argv[] ); -VG_STATIC void async_render_init( void *payload, u32 size ) +static void async_render_init( void *payload, u32 size ) { /* * Complete Framebuffers @@ -581,12 +582,14 @@ VG_STATIC void async_render_init( void *payload, u32 size ) gpipeline.ready = 1; } -VG_STATIC void render_init(void) +static void render_init(void) { vg_console_reg_var( "blur_strength", &k_blur_strength, k_var_dtype_f32, 0 ); vg_console_reg_var( "render_scale", &k_render_scale, k_var_dtype_f32, VG_VAR_PERSISTENT ); vg_console_reg_var( "fov", &k_fov, k_var_dtype_f32, VG_VAR_PERSISTENT ); + vg_console_reg_var( "cam_height", &k_cam_height, + k_var_dtype_f32, VG_VAR_PERSISTENT ); vg_console_reg_var( "blur_effect", &k_blur_effect, k_var_dtype_i32, VG_VAR_PERSISTENT ); @@ -601,19 +604,19 @@ VG_STATIC void render_init(void) /* * Utility */ -VG_STATIC void render_fsquad(void) +static void render_fsquad(void) { glBindVertexArray( gpipeline.fsquad.vao ); glDrawArrays( GL_TRIANGLES, 0, 6 ); } -VG_STATIC void render_fsquad1(void) +static void render_fsquad1(void) { glBindVertexArray( gpipeline.fsquad.vao ); glDrawArrays( GL_TRIANGLES, 6, 6 ); } -VG_STATIC void render_fsquad2(void) +static void render_fsquad2(void) { glBindVertexArray( gpipeline.fsquad.vao ); glDrawArrays( GL_TRIANGLES, 66,6 ); @@ -622,7 +625,7 @@ VG_STATIC void render_fsquad2(void) /* * Call this inside the UI function */ -VG_STATIC void render_view_framebuffer_ui(void) +static void render_view_framebuffer_ui(void) { #if 0 int viewing_count = 0; @@ -678,7 +681,7 @@ VG_STATIC void render_view_framebuffer_ui(void) #endif } -VG_STATIC void render_framebuffer_show( struct framebuffer *fb, +static void render_framebuffer_show( struct framebuffer *fb, struct framebuffer_attachment *at, int operation ) { @@ -692,7 +695,7 @@ VG_STATIC void render_framebuffer_show( struct framebuffer *fb, * arg1: framebuffer name /"all" * arg2: subname /none */ -VG_STATIC int render_framebuffer_control( int argc, char const *argv[] ) +static int render_framebuffer_control( int argc, char const *argv[] ) { if( argc < 2 ){ vg_error( "Usage: fb \"show/hide\" /\"all\" /none\n" ); @@ -740,7 +743,7 @@ VG_STATIC int render_framebuffer_control( int argc, char const *argv[] ) return 0; } -VG_STATIC void render_framebuffer_poll( int argc, char const *argv[] ) +static void render_framebuffer_poll( int argc, char const *argv[] ) { const char *term = argv[argc-1];