dont remember
[carveJwlIkooP6JGAAIwe30JlM.git] / world_gate.h
index 083d68be351fd983effc4017362a3f4167509dfc..89945b94a031a16b467db081f5b18503c4cb44ec 100644 (file)
@@ -1,27 +1,30 @@
 #ifndef WORLD_GATE_H
 #define WORLD_GATE_H
 
+#define GATE_RENDER_PERFORMANCE
+
 #include "common.h"
 #include "model.h"
 #include "render.h"
-#include "shaders/gate.h"
-#include "shaders/gatelq.h"
+
+#ifndef GATE_RENDER_PERFORMANCE
+  #include "shaders/gate.h"
+#else
+  #include "shaders/gatelq.h"
+#endif
+
 #include "world_water.h"
 
+
 typedef struct teleport_gate teleport_gate;
 
 static struct
 {
    struct framebuffer fb;
    glmesh mdl;
-
-   int high_qual; /* If in high performance mode, we don't use RT's, and
-                      instead use stencil buffers.
-                      There is therefore no heat warp effect. */
 }
 grender =
 {
-   .high_qual = 0,
    .fb = {
       .format = GL_RGB,
       .div = 1
@@ -45,8 +48,12 @@ static void gate_transform_update( teleport_gate *gate )
 static void world_gates_init(void)
 {
    vg_info( "world_gates_init\n" );
+
+#ifndef GATE_RENDER_PERFORMANCE
    shader_gate_register();
+#else
    shader_gatelq_register();
+#endif
 
    mdl_header *mgate = mdl_load( "models/rs_gate.mdl" );
 
@@ -126,14 +133,11 @@ static int render_gate( teleport_gate *gate, v3f viewpos, m4x3f camera )
 
    m4x4_mul( projection, view, projection );
 
-   if( grender.high_qual )
-   {
+#ifndef GATE_RENDER_PERFORMANCE
       fb_use( &grender.fb );
       glClearColor( 0.11f, 0.35f, 0.37f, 1.0f );
       glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
-   }
-   else
-   {
+#else
       shader_gatelq_use();
       shader_gatelq_uPv( vg_pv );
       shader_gatelq_uMdl( gate_xform );
@@ -154,14 +158,14 @@ static int render_gate( teleport_gate *gate, v3f viewpos, m4x3f camera )
       glClear( GL_DEPTH_BUFFER_BIT );
       glStencilFunc( GL_EQUAL, 1, 0xFF );
       glStencilMask( 0x00 ); 
-   }
+#endif
 
    render_world( projection, cam_new );
 
-   if( grender.high_qual )
-   {
+#ifndef GATE_RENDER_PERFORMANCE
+
       /*
-       * TODO: Need to find a way to draw a stencil buffer into the water 
+       * NOTE: Need to find a way to draw a stencil buffer into the water 
        *       rendering 
        */
 
@@ -194,9 +198,7 @@ static int render_gate( teleport_gate *gate, v3f viewpos, m4x3f camera )
       mesh_draw( &grender.mdl );
 
       glDisable(GL_BLEND);
-   }
-   else
-   {
+#else
       glDisable( GL_STENCIL_TEST );
 
       render_water_texture( cam_new );
@@ -208,7 +210,7 @@ static int render_gate( teleport_gate *gate, v3f viewpos, m4x3f camera )
       glStencilMask( 0xFF );
       glStencilFunc( GL_ALWAYS, 1, 0xFF );
       glDisable( GL_STENCIL_TEST );
-   }
+#endif
 
    return 1;
 }