Merge Reaction renderer features, remove "#ifdef REACTION"s
This commit is contained in:
parent
517c65d85e
commit
9bace5bac7
11 changed files with 122 additions and 225 deletions
|
@ -149,12 +149,6 @@ void GL_BindToTMU( image_t *image, int tmu )
|
|||
** GL_Cull
|
||||
*/
|
||||
void GL_Cull( int cullType ) {
|
||||
#ifdef REACTION
|
||||
// Makro - flip culling if needed
|
||||
qboolean flip = (backEnd.currentEntity != NULL && backEnd.currentEntity->mirrored != qfalse && cullType != CT_TWO_SIDED);
|
||||
cullType ^= flip; // this assumes CT_BACK_SIDED and CT_FRONT_SIDED are 0 or 1
|
||||
#endif
|
||||
|
||||
if ( glState.faceCulling == cullType ) {
|
||||
return;
|
||||
}
|
||||
|
@ -176,6 +170,11 @@ void GL_Cull( int cullType ) {
|
|||
cullFront = !cullFront;
|
||||
}
|
||||
|
||||
if ( backEnd.currentEntity && backEnd.currentEntity->mirrored )
|
||||
{
|
||||
cullFront = !cullFront;
|
||||
}
|
||||
|
||||
qglCullFace( cullFront ? GL_FRONT : GL_BACK );
|
||||
}
|
||||
}
|
||||
|
@ -548,10 +547,6 @@ void RB_BeginDrawingView (void) {
|
|||
// we will only draw a sun if there was sky rendered in this view
|
||||
backEnd.skyRenderedThisView = qfalse;
|
||||
|
||||
#ifdef REACTION
|
||||
backEnd.viewHasSunFlare = qfalse;
|
||||
#endif
|
||||
|
||||
// clip to the plane of the portal
|
||||
if ( backEnd.viewParms.isPortal ) {
|
||||
#if 0
|
||||
|
@ -594,9 +589,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
FBO_t* fbo = NULL;
|
||||
qboolean inQuery = qfalse;
|
||||
|
||||
#if 1 //def REACTION
|
||||
float depth[2];
|
||||
#endif
|
||||
|
||||
|
||||
// save original time for entity shader offsets
|
||||
|
@ -616,10 +609,8 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
oldSort = -1;
|
||||
depthRange = qfalse;
|
||||
|
||||
#if 1 //def REACTION
|
||||
depth[0] = 0.f;
|
||||
depth[1] = 1.f;
|
||||
#endif
|
||||
|
||||
backEnd.pc.c_surfaces += numDrawSurfs;
|
||||
|
||||
|
@ -662,22 +653,6 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
qboolean sunflare = qfalse;
|
||||
depthRange = isCrosshair = qfalse;
|
||||
|
||||
#ifdef REACTION
|
||||
// if we were rendering to a FBO and the previous entity was a sunflare
|
||||
// and the current one isn't, switch back to the main fbo
|
||||
if (oldEntityNum != -1 && fbo && !backEnd.depthFill &&
|
||||
RF_SUNFLARE == (backEnd.refdef.entities[oldEntityNum].e.renderfx & RF_SUNFLARE) &&
|
||||
0 == (backEnd.refdef.entities[entityNum].e.renderfx & RF_SUNFLARE))
|
||||
{
|
||||
if (inQuery) {
|
||||
inQuery = qfalse;
|
||||
qglEndQueryARB(GL_SAMPLES_PASSED_ARB);
|
||||
}
|
||||
FBO_Bind(fbo);
|
||||
qglDepthRange(depth[0], depth[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( entityNum != REFENTITYNUM_WORLD ) {
|
||||
backEnd.currentEntity = &backEnd.refdef.entities[entityNum];
|
||||
backEnd.refdef.floatTime = originalTime - backEnd.currentEntity->e.shaderTime;
|
||||
|
@ -693,31 +668,6 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
R_TransformDlights( backEnd.refdef.num_dlights, backEnd.refdef.dlights, &backEnd.or );
|
||||
}
|
||||
|
||||
#ifdef REACTION
|
||||
// if the current entity is a sunflare
|
||||
if(backEnd.currentEntity->e.renderfx & RF_SUNFLARE && !backEnd.depthFill) {
|
||||
// if we're rendering to a fbo
|
||||
if (fbo) {
|
||||
VectorCopy(backEnd.currentEntity->e.origin, backEnd.sunFlarePos);
|
||||
// switch FBO
|
||||
FBO_Bind(tr.godRaysFbo);
|
||||
|
||||
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
qglClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
qglDepthRange(1.f, 1.f);
|
||||
if (glRefConfig.occlusionQuery && !inQuery && !backEnd.viewHasSunFlare) {
|
||||
inQuery = qtrue;
|
||||
tr.sunFlareQueryActive[tr.sunFlareQueryIndex] = qtrue;
|
||||
qglBeginQueryARB(GL_SAMPLES_PASSED_ARB, tr.sunFlareQuery[tr.sunFlareQueryIndex]);
|
||||
}
|
||||
sunflare = qtrue;
|
||||
} else {
|
||||
depthRange = qtrue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(backEnd.currentEntity->e.renderfx & RF_DEPTHHACK)
|
||||
{
|
||||
// hack the depth range to prevent view model from poking into walls
|
||||
|
@ -766,14 +716,12 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
}
|
||||
}
|
||||
|
||||
#if 1 //def REACTION
|
||||
if(!oldDepthRange)
|
||||
{
|
||||
depth[0] = 0;
|
||||
depth[1] = 0.3f;
|
||||
qglDepthRange (depth[0], depth[1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -784,10 +732,9 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
|
||||
if (!sunflare)
|
||||
qglDepthRange (0, 1);
|
||||
#if 1 //def REACTION
|
||||
|
||||
depth[0] = 0;
|
||||
depth[1] = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
oldDepthRange = depthRange;
|
||||
|
@ -812,16 +759,6 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
inQuery = qfalse;
|
||||
qglEndQueryARB(GL_SAMPLES_PASSED_ARB);
|
||||
}
|
||||
#ifdef REACTION
|
||||
// HACK: flip Z and render black to god rays buffer
|
||||
if (backEnd.frameHasSunFlare && !backEnd.depthFill)
|
||||
{
|
||||
vec4_t black;
|
||||
VectorSet4(black, 0, 0, 0, 1);
|
||||
qglDepthRange (1, 1);
|
||||
FBO_BlitFromTexture(tr.whiteImage, NULL, NULL, tr.godRaysFbo, NULL, NULL, black, GLS_DEPTHFUNC_GREATER);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (glRefConfig.framebufferObject)
|
||||
FBO_Bind(fbo);
|
||||
|
@ -829,9 +766,8 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
// go back to the world modelview matrix
|
||||
|
||||
GL_SetModelviewMatrix( backEnd.viewParms.world.modelMatrix );
|
||||
//if ( depthRange ) {
|
||||
qglDepthRange (0, 1);
|
||||
//}
|
||||
|
||||
qglDepthRange (0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1420,9 +1356,35 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
{
|
||||
RB_RenderDrawSurfList( cmd->drawSurfs, cmd->numDrawSurfs );
|
||||
|
||||
#if 0
|
||||
RB_DrawSun();
|
||||
#endif
|
||||
if (r_drawSun->integer)
|
||||
{
|
||||
RB_DrawSun(0.1, tr.sunShader);
|
||||
}
|
||||
|
||||
if (r_drawSunRays->integer)
|
||||
{
|
||||
FBO_t *oldFbo = glState.currentFBO;
|
||||
FBO_Bind(tr.sunRaysFbo);
|
||||
|
||||
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
qglClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
if (glRefConfig.occlusionQuery)
|
||||
{
|
||||
tr.sunFlareQueryActive[tr.sunFlareQueryIndex] = qtrue;
|
||||
qglBeginQueryARB(GL_SAMPLES_PASSED_ARB, tr.sunFlareQuery[tr.sunFlareQueryIndex]);
|
||||
}
|
||||
|
||||
RB_DrawSun(0.3, tr.sunFlareShader);
|
||||
|
||||
if (glRefConfig.occlusionQuery)
|
||||
{
|
||||
qglEndQueryARB(GL_SAMPLES_PASSED_ARB);
|
||||
}
|
||||
|
||||
FBO_Bind(oldFbo);
|
||||
}
|
||||
|
||||
// darken down any stencil shadows
|
||||
RB_ShadowFinish();
|
||||
|
||||
|
@ -1672,9 +1634,6 @@ const void *RB_SwapBuffers( const void *data ) {
|
|||
|
||||
backEnd.framePostProcessed = qfalse;
|
||||
backEnd.projection2D = qfalse;
|
||||
#ifdef REACTION
|
||||
backEnd.frameHasSunFlare = qfalse;
|
||||
#endif
|
||||
|
||||
return (const void *)(cmd + 1);
|
||||
}
|
||||
|
@ -1764,17 +1723,13 @@ const void *RB_PostProcess(const void *data)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef REACTION
|
||||
if (1)
|
||||
{
|
||||
RB_GodRays();
|
||||
if (r_drawSunRays->integer)
|
||||
RB_SunRays();
|
||||
|
||||
if (1)
|
||||
RB_BokehBlur(backEnd.refdef.blurFactor);
|
||||
else
|
||||
RB_GaussianBlur(backEnd.refdef.blurFactor);
|
||||
}
|
||||
#endif
|
||||
if (1)
|
||||
RB_BokehBlur(backEnd.refdef.blurFactor);
|
||||
else
|
||||
RB_GaussianBlur(backEnd.refdef.blurFactor);
|
||||
|
||||
if (0)
|
||||
{
|
||||
|
@ -1800,7 +1755,7 @@ const void *RB_PostProcess(const void *data)
|
|||
{
|
||||
vec4i_t dstBox;
|
||||
VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
|
||||
FBO_BlitFromTexture(tr.renderImage, NULL, NULL, tr.screenScratchFbo, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, tr.screenScratchFbo, dstBox, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
backEnd.framePostProcessed = qtrue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue