Skip to content

Commit

Permalink
ref: gl: connect ripply water to others parts of renderer (init, rese…
Browse files Browse the repository at this point in the history
…t, animation and rendering)
  • Loading branch information
a1batross committed Oct 30, 2023
1 parent a22b389 commit 0c09e59
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ref/gl/gl_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/*
Expand Down Expand Up @@ -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" );
}
Expand Down
2 changes: 2 additions & 0 deletions ref/gl/gl_rmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,8 @@ void R_RenderScene( void )

R_MarkLeaves();
R_DrawFog ();
if( RI.drawWorld )
R_AnimateRipples();

R_CheckGLFog();
R_DrawWorld();
Expand Down
1 change: 1 addition & 0 deletions ref/gl/gl_rmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ void R_NewMap( void )

GL_BuildLightmaps ();
R_GenerateVBO();
R_ResetRipples();

if( gEngfuncs.drawFuncs->R_NewMap != NULL )
gEngfuncs.drawFuncs->R_NewMap();
Expand Down
9 changes: 5 additions & 4 deletions ref/gl/gl_rsurf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 0c09e59

Please sign in to comment.