X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=render.h;h=ea88ecc4df956c54f206f50a3b5c5946a17aea43;hb=137d40d96fe923600d8378b8e138e3c276f27ff4;hp=b6633943b68df2def3f51499fced0dfbf8885278;hpb=1f7014d965883820f984877b8ca15c1e439cf9cf;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/render.h b/render.h index b663394..ea88ecc 100644 --- a/render.h +++ b/render.h @@ -11,30 +11,23 @@ #include "shaders/blitblur.h" #include "shaders/blitcolour.h" -#if 0 -#include "shaders/standard.h" -#include "shaders/vblend.h" -#endif - #define WORKSHOP_PREVIEW_WIDTH 504 #define WORKSHOP_PREVIEW_HEIGHT 336 - -VG_STATIC void render_water_texture( world_instance *world, camera *cam, - int layer_depth ); -VG_STATIC void render_water_surface( world_instance *world, camera *cam ); -VG_STATIC void render_world( world_instance *world, camera *cam, - int layer_depth ); -VG_STATIC void render_world_depth( world_instance *world, camera *cam ); - #ifndef RENDER_H #define RENDER_H +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, @@ -42,11 +35,8 @@ VG_STATIC struct pipeline{ *fb_water_beneath, *fb_workshop_preview; int ready; - - float view_render_scale, - water_render_scale; } -gpipeline = { .view_render_scale = 1.0f }; +gpipeline; struct framebuffer{ const char *display_name; @@ -206,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 ){ @@ -219,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; @@ -238,14 +228,14 @@ 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 ); if( use_scaling ){ - x = gpipeline.view_render_scale*(float)x; - y = gpipeline.view_render_scale*(float)y; + x = k_render_scale*(float)x; + y = k_render_scale*(float)y; x = VG_MAX( 16, x ); y = VG_MAX( 16, y ); @@ -261,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]; @@ -287,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[] = @@ -311,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[] = @@ -406,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; @@ -428,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 ); @@ -512,10 +502,9 @@ 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; + if( !gpipeline.ready ) return; for( int i=0; i/"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" ); @@ -734,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];