projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bugs
[carveJwlIkooP6JGAAIwe30JlM.git]
/
world_gate.h
diff --git
a/world_gate.h
b/world_gate.h
index 083d68be351fd983effc4017362a3f4167509dfc..21cabe9d22150fdd79ff29666b2a3a32a8c019dc 100644
(file)
--- a/
world_gate.h
+++ b/
world_gate.h
@@
-1,27
+1,34
@@
+/*
+ * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
+ */
+
#ifndef WORLD_GATE_H
#define WORLD_GATE_H
#ifndef WORLD_GATE_H
#define WORLD_GATE_H
+#define GATE_RENDER_PERFORMANCE
+
#include "common.h"
#include "model.h"
#include "render.h"
#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"
#include "world_water.h"
+
typedef struct teleport_gate teleport_gate;
static struct
{
struct framebuffer fb;
glmesh mdl;
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 =
{
}
grender =
{
- .high_qual = 0,
.fb = {
.format = GL_RGB,
.div = 1
.fb = {
.format = GL_RGB,
.div = 1
@@
-45,8
+52,12
@@
static void gate_transform_update( teleport_gate *gate )
static void world_gates_init(void)
{
vg_info( "world_gates_init\n" );
static void world_gates_init(void)
{
vg_info( "world_gates_init\n" );
+
+#ifndef GATE_RENDER_PERFORMANCE
shader_gate_register();
shader_gate_register();
+#else
shader_gatelq_register();
shader_gatelq_register();
+#endif
mdl_header *mgate = mdl_load( "models/rs_gate.mdl" );
mdl_header *mgate = mdl_load( "models/rs_gate.mdl" );
@@
-126,22
+137,19
@@
static int render_gate( teleport_gate *gate, v3f viewpos, m4x3f camera )
m4x4_mul( projection, view, projection );
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 );
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_use();
- shader_gatelq_uPv( vg
_
pv );
+ shader_gatelq_uPv( vg
.
pv );
shader_gatelq_uMdl( gate_xform );
shader_gatelq_uCam( viewpos );
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){
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 );
glEnable( GL_STENCIL_TEST );
glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
@@
-154,14
+162,14
@@
static int render_gate( teleport_gate *gate, v3f viewpos, m4x3f camera )
glClear( GL_DEPTH_BUFFER_BIT );
glStencilFunc( GL_EQUAL, 1, 0xFF );
glStencilMask( 0x00 );
glClear( GL_DEPTH_BUFFER_BIT );
glStencilFunc( GL_EQUAL, 1, 0xFF );
glStencilMask( 0x00 );
- }
+#endif
render_world( projection, cam_new );
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
*/
* rendering
*/
@@
-194,9
+202,7
@@
static int render_gate( teleport_gate *gate, v3f viewpos, m4x3f camera )
mesh_draw( &grender.mdl );
glDisable(GL_BLEND);
mesh_draw( &grender.mdl );
glDisable(GL_BLEND);
- }
- else
- {
+#else
glDisable( GL_STENCIL_TEST );
render_water_texture( cam_new );
glDisable( GL_STENCIL_TEST );
render_water_texture( cam_new );
@@
-208,7
+214,7
@@
static int render_gate( teleport_gate *gate, v3f viewpos, m4x3f camera )
glStencilMask( 0xFF );
glStencilFunc( GL_ALWAYS, 1, 0xFF );
glDisable( GL_STENCIL_TEST );
glStencilMask( 0xFF );
glStencilFunc( GL_ALWAYS, 1, 0xFF );
glDisable( GL_STENCIL_TEST );
- }
+#endif
return 1;
}
return 1;
}