From a6af32dafdde4e2618450b89ac0bb2d52a59ba4b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 30 Oct 2023 06:26:18 +0300 Subject: [PATCH] ref: gl: connect ripply water to others parts of renderer (init, reset, animation and rendering) --- ref/gl/gl_image.c | 3 +++ ref/gl/gl_rmain.c | 2 ++ ref/gl/gl_rmisc.c | 1 + ref/gl/gl_rsurf.c | 9 +++++---- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ref/gl/gl_image.c b/ref/gl/gl_image.c index 355f6c49..9c2fcc61 100644 --- a/ref/gl/gl_image.c +++ b/ref/gl/gl_image.c @@ -342,6 +342,8 @@ void R_SetTextureParameters( void ) // change all the existing mipmapped texture objects for( i = 0; i < gl_numTextures; i++ ) GL_UpdateTextureParams( i ); + + R_UpdateRippleTexParams(); } /* @@ -2317,6 +2319,7 @@ void R_InitImages( void ) // validate cvars R_SetTextureParameters(); GL_CreateInternalTextures(); + R_InitRipples(); gEngfuncs.Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" ); } diff --git a/ref/gl/gl_rmain.c b/ref/gl/gl_rmain.c index da815a01..9a5a3702 100644 --- a/ref/gl/gl_rmain.c +++ b/ref/gl/gl_rmain.c @@ -969,6 +969,8 @@ void R_RenderScene( void ) R_MarkLeaves(); R_DrawFog (); + if( RI.drawWorld ) + R_AnimateRipples(); R_CheckGLFog(); R_DrawWorld(); diff --git a/ref/gl/gl_rmisc.c b/ref/gl/gl_rmisc.c index e0d82d36..9395b008 100644 --- a/ref/gl/gl_rmisc.c +++ b/ref/gl/gl_rmisc.c @@ -150,6 +150,7 @@ void R_NewMap( void ) GL_BuildLightmaps (); R_GenerateVBO(); + R_ResetRipples(); if( gEngfuncs.drawFuncs->R_NewMap != NULL ) gEngfuncs.drawFuncs->R_NewMap(); diff --git a/ref/gl/gl_rsurf.c b/ref/gl/gl_rsurf.c index aeedb386..bd64a43c 100644 --- a/ref/gl/gl_rsurf.c +++ b/ref/gl/gl_rsurf.c @@ -204,7 +204,7 @@ void GL_SetupFogColorForSurfaces( void ) vec3_t fogColor; float factor, div; - if( !glState.isFogEnabled) + if( !glState.isFogEnabled ) return; if( RI.currententity && RI.currententity->curstate.rendermode == kRenderTransTexture ) @@ -1135,14 +1135,15 @@ void R_RenderBrushPoly( msurface_t *fa, int cull_type ) t = R_TextureAnimation( fa ); - GL_Bind( XASH_TEXTURE0, t->gl_texturenum ); - if( FBitSet( fa->flags, SURF_DRAWTURB )) { + R_UploadRipples( t ); + // warp texture, no lightmaps EmitWaterPolys( fa, (cull_type == CULL_BACKSIDE)); return; } + else GL_Bind( XASH_TEXTURE0, t->gl_texturenum ); if( t->fb_texturenum ) { @@ -1411,7 +1412,7 @@ void R_DrawWaterSurfaces( void ) continue; // set modulate mode explicitly - GL_Bind( XASH_TEXTURE0, t->gl_texturenum ); + R_UploadRipples( t ); for( ; s; s = s->texturechain ) EmitWaterPolys( s, false );