+/*
+ * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
+ */
+
#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
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" );
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_uPv( vg.pv );
shader_gatelq_uMdl( gate_xform );
shader_gatelq_uCam( viewpos );
- shader_gatelq_uTime( vg_time*0.25f );
+ shader_gatelq_uTime( vg.time*0.25f );
shader_gatelq_uInvRes( (v2f){
- 1.0f / (float)vg_window_x,
- 1.0f / (float)vg_window_y });
+ 1.0f / (float)vg.window_x,
+ 1.0f / (float)vg.window_y });
glEnable( GL_STENCIL_TEST );
glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
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
*/
mesh_draw( &grender.mdl );
glDisable(GL_BLEND);
- }
- else
- {
+#else
glDisable( GL_STENCIL_TEST );
render_water_texture( cam_new );
glStencilMask( 0xFF );
glStencilFunc( GL_ALWAYS, 1, 0xFF );
glDisable( GL_STENCIL_TEST );
- }
+#endif
return 1;
}