boards and tht
[carveJwlIkooP6JGAAIwe30JlM.git] / render.h
index 41aeef241ef529b7bc33522f8cb1dea880b3d067..6b956de3eb867a8d261057c95dbf5b34e9243ba3 100644 (file)
--- a/render.h
+++ b/render.h
 #include "shaders/blitblur.h"
 #include "shaders/blitcolour.h"
 
-#if 0
-#include "shaders/standard.h"
-#include "shaders/vblend.h"
-#endif
-
-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 );
-
+#define WORKSHOP_PREVIEW_WIDTH  504
+#define WORKSHOP_PREVIEW_HEIGHT 336
 #ifndef RENDER_H
 #define RENDER_H
 
@@ -181,7 +171,7 @@ framebuffers[] =
       "workshop_preview",
       .link = &gpipeline.fb_workshop_preview,
       .resolution_div = 0,
-      .fixed_w = 504, .fixed_h = 336,
+      .fixed_w = WORKSHOP_PREVIEW_WIDTH, .fixed_h = WORKSHOP_PREVIEW_HEIGHT,
       .attachments = 
       {
          {
@@ -536,12 +526,14 @@ VG_STATIC void async_render_init( void *payload, u32 size )
       render_fb_allocate( fb );
    }
 
+   f32 rh = 0x1p-4f, ih = 0.3f;
+
    float quad[] = { 
       0.00f,0.00f, 1.00f,1.00f, 0.00f,1.00f,    /* fsquad */
       0.00f,0.00f, 1.00f,0.00f, 1.00f,1.00f,    
 
-      0.00f,0.00f, 1.00f,0x1p-4f,0.00f,0x1p-4f,    /* fsquad1 */
-      0.00f,0.00f, 1.00f,0.00f,  1.00f,0x1p-4f,
+      0.00f,0.00f, 1.00f,rh,     0.00f,rh,    /* fsquad1 */
+      0.00f,0.00f, 1.00f,0.00f,  1.00f,rh,
 
       /* 9x9 debug grid */
       /* row0 */
@@ -565,10 +557,15 @@ VG_STATIC void async_render_init( void *payload, u32 size )
       0.30f,0.60f, 0.60f,0.60f, 0.60f,0.90f,
       0.60f,0.60f, 0.90f,0.90f, 0.60f,0.90f,
       0.60f,0.60f, 0.90f,0.60f, 0.90f,0.90f,
+
+      0.00f,ih, 1.00f,ih+rh, 0.00f,ih+rh,    /* fsquad2 */
+      0.00f,ih, 1.00f,ih,    1.00f,ih+rh,
    };
 
    vg_console_reg_cmd( "fb", render_framebuffer_control, 
                              render_framebuffer_poll );
+   vg_console_reg_var( "render_scale", &gpipeline.view_render_scale,
+                       k_var_dtype_f32, VG_VAR_PERSISTENT );
 
    glGenVertexArrays( 1, &gpipeline.fsquad.vao );
    glGenBuffers( 1, &gpipeline.fsquad.vbo );
@@ -610,6 +607,12 @@ VG_STATIC void render_fsquad1(void)
    glDrawArrays( GL_TRIANGLES, 6, 6 );
 }
 
+VG_STATIC void render_fsquad2(void)
+{
+   glBindVertexArray( gpipeline.fsquad.vao );
+   glDrawArrays( GL_TRIANGLES, 66,6 );
+}
+
 /*
  * Call this inside the UI function
  */