fix long standing grind bug
[carveJwlIkooP6JGAAIwe30JlM.git] / render.h
index a80f78acff6048e8655d6bff56b9f9237972f2c2..d626b7a0a013e07af77c64dfaac33d727237bca1 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
 
@@ -36,7 +26,8 @@ VG_STATIC struct pipeline{
 
    framebuffer *fb_main,
                *fb_water_reflection,
-               *fb_water_beneath;
+               *fb_water_beneath,
+               *fb_workshop_preview;
    int ready;
 
    float view_render_scale,
@@ -175,6 +166,27 @@ framebuffers[] =
             .attachment     = GL_DEPTH_STENCIL_ATTACHMENT
          }
       }
+   },
+   {
+      "workshop_preview",
+      .link = &gpipeline.fb_workshop_preview,
+      .resolution_div = 0,
+      .fixed_w = WORKSHOP_PREVIEW_WIDTH, .fixed_h = WORKSHOP_PREVIEW_HEIGHT,
+      .attachments = 
+      {
+         {
+            "colour", k_framebuffer_attachment_type_texture,
+            .internalformat = GL_RGB,
+            .format         = GL_RGB,
+            .type           = GL_UNSIGNED_BYTE,
+            .attachment     = GL_COLOR_ATTACHMENT0
+         },
+         {
+            "depth_stencil", k_framebuffer_attachment_type_renderbuffer,
+            .internalformat = GL_DEPTH24_STENCIL8,
+            .attachment = GL_DEPTH_STENCIL_ATTACHMENT
+         }
+      }
    }
 };
 
@@ -547,6 +559,8 @@ VG_STATIC void async_render_init( void *payload, u32 size )
 
    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 );
@@ -593,6 +607,7 @@ VG_STATIC void render_fsquad1(void)
  */
 VG_STATIC void render_view_framebuffer_ui(void)
 {
+#if 0
    int viewing_count = 0;
 
    glBindVertexArray( gpipeline.fsquad.vao );
@@ -643,6 +658,7 @@ VG_STATIC void render_view_framebuffer_ui(void)
          viewing_count ++;
       }
    }
+#endif
 }
 
 VG_STATIC void render_framebuffer_show( struct framebuffer *fb,