test for variable render scale
authorhgn <hgodden00@gmail.com>
Thu, 6 Apr 2023 02:13:47 +0000 (03:13 +0100)
committerhgn <hgodden00@gmail.com>
Thu, 6 Apr 2023 02:13:47 +0000 (03:13 +0100)
common.h
skaterift.c
world_water.h

index 9eda6f67ae0e59dfcf76c8fd39b0f26d46d7d8ae..24c7815071fb8df17020148703c23bd80ed02403 100644 (file)
--- a/common.h
+++ b/common.h
@@ -120,6 +120,9 @@ VG_STATIC int   k_debug_light_indices = 0,
                 k_debug_light_complexity = 0,
                 k_light_preview = 0;
 
+VG_STATIC int   g_render_x = 1,
+                g_render_y = 1;
+
 VG_STATIC int freecam = 0;
 VG_STATIC int walk_grid_iterations = 1;
 VG_STATIC float fc_speed = 10.0f;
index 1db6db52ab3e8c4d939f4ea91d1a9cee95dd3557..00dbb110fa1a78279df0b2ff463c20c6afb5fd45 100644 (file)
@@ -250,6 +250,7 @@ VG_STATIC void vg_load(void)
    /* 'systems' are completely loaded now */
 
    /* load home world */
+   //world_load( &world_global.worlds[0], "maps/mp_gridmap.mdl" );
    world_load( &world_global.worlds[0], "maps/mp_mtzero.mdl" );
 
 #if 0
@@ -485,6 +486,7 @@ VG_STATIC void render_player_transparent(void)
 VG_STATIC void render_scene(void)
 {
    render_fb_bind( gpipeline.fb_main );
+   glViewport( 0,0, g_render_x, g_render_y );
    glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
    glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
 
@@ -504,6 +506,7 @@ VG_STATIC void render_scene(void)
 
    render_water_texture( view_world, &main_camera, 0 );
    render_fb_bind( gpipeline.fb_main );
+   glViewport( 0,0, g_render_x, g_render_y );
    render_water_surface( view_world, &main_camera );
 
    int depth = 1;
@@ -585,7 +588,11 @@ VG_STATIC void vg_render(void)
 {
    glBindFramebuffer( GL_FRAMEBUFFER, 0 );
 
-   glViewport( 0,0, vg.window_x, vg.window_y );
+   float scale = (sin(vg.time)*0.5f+0.5f)*0.75f+0.25f;
+   g_render_x = VG_MAX((float)vg.window_x * scale,64),
+   g_render_y = VG_MAX((float)vg.window_y * scale,64);
+
+   glViewport( 0,0, g_render_x, g_render_y );
    glDisable( GL_DEPTH_TEST );
 
    glClearColor( 1.0f, 0.0f, 0.0f, 0.0f );
index 5dd1b919c3ebd958262d9f4219441e841a9c00fb..7d67b136893d80753bea1f776d24d3e9620145e2 100644 (file)
@@ -121,7 +121,7 @@ VG_STATIC void render_water_texture( world_instance *world, camera *cam,
    glEnable( GL_DEPTH_TEST );
    glDisable( GL_BLEND );
    render_world_depth( world, &beneath_cam );
-   glViewport( 0, 0, vg.window_x, vg.window_y );
+   glViewport( 0,0, g_render_x, g_render_y );
 }
 
 VG_STATIC void render_water_surface( world_instance *world, camera *cam )