funneh wöter wäve shader

this should be a fof flag so it can be applied if desired instead of doing all this crap, but its too late for such things at this point
This commit is contained in:
Alug committed 2025-07-05 22:45:10 +02:00
1 parent d80b21e804
commit d18567e0c4
4 files changed
+33 -5

No files matched your search

+2
View File
@@ -201,6 +201,7 @@ enum
SHADER_SPRITE,
SHADER_MODEL,
SHADER_WATER,
SHADER_WAVE,
SHADER_FOG,
SHADER_SKY,
SHADER_PALETTE_POSTPROCESS,
@@ -263,6 +264,7 @@ enum EPolyFlags
PF_ForceWrapX = 0x00020000, // Force repeat texture on X
PF_ForceWrapY = 0x00040000, // Forces repeat texture on Y
PF_Ripple = 0x00100000, // Water ripple effect. The current backend doesn't use it for anything.
PF_Wave = 0x00200000, // Water wave effect.
PF_Skydecal = 0x20000000 // Enables smaller polygon offset, to be used for skywalls only
// 0x20000000
// 0x40000000
+7 -5
View File
@@ -754,6 +754,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
shader = SHADER_FOG;
else if (cv_ripplewater.value && (PolyFlags & PF_Ripple))
shader = SHADER_WATER;
else if (cv_ripplewater.value && (PolyFlags & PF_Wave))
shader = SHADER_WAVE;
else
shader = SHADER_FLOOR;
@@ -2896,8 +2898,8 @@ static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float v
static FBITFIELD HWR_RippleBlend(sector_t *sector, ffloor_t *rover, boolean ceiling)
{
(void)sector;
(void)ceiling;
return /*R_IsRipplePlane(sector, rover, ceiling)*/ (rover->flags & FF_RIPPLE) ? PF_Ripple : 0;
//(void)ceiling;
return /*R_IsRipplePlane(sector, rover, ceiling)*/ ((rover->flags & FF_RIPPLE) ? (ceiling ? PF_Wave : PF_Ripple) : 0);
}
// -----------------+
@@ -3057,7 +3059,7 @@ static void HWR_Subsector(size_t num)
// rendering heights for bottom and top planes
// yes there were functions for this stuff, no idea why it wasnt used but bleh
bottomCullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy);
topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
if (gl_frontsector->cullheight)
{
@@ -3143,7 +3145,7 @@ static void HWR_Subsector(size_t num)
true,
*rover->topheight,
*gl_frontsector->lightlist[light].lightlevel,
CLAMP(rover->alpha, 0 ,255), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : static_cast<FBITFIELD>(PF_Translucent)),
CLAMP(rover->alpha, 0 ,255), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, *rover->topheight < rover->target->ceilingheight-(20*FRACUNIT) /*random offset that seems fitting ig*/) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : static_cast<FBITFIELD>(PF_Translucent)),
false, gl_frontsector->lightlist[light].extra_colormap);
}
else
@@ -3151,7 +3153,7 @@ static void HWR_Subsector(size_t num)
HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gl_frontsector, true));
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < topCullHeight));
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, *rover->topheight < rover->target->ceilingheight-(20*FRACUNIT))|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap);
}
}
+3
View File
@@ -41,6 +41,9 @@ static struct {
// Water shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WATER_FRAGMENT_SHADER},
// Water Wave shader
{GLSL_WAVE_VERTEX_SHADER, GLSL_WATER_FRAGMENT_SHADER},
// Fog shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_FOG_FRAGMENT_SHADER},
+21
View File
@@ -31,6 +31,27 @@
"gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n" \
"}\0"
// adjust the amplitude for beeegger wäves on ze wöter
// this is pretty meh but idk what im doing lmao
#define GLSL_WAVE_VERTEX_SHADER \
"uniform float leveltime;\n" \
"const float waveSpeed = 2.5;\n" \
"const float waveFrequency = 0.7;\n" \
"const float waveAmplitude = 1.8;\n" \
"void main()\n" \
"{\n" \
"vec4 modelPos = gl_Vertex;\n" \
"float timeF = leveltime * waveSpeed;\n" \
"float wave1 = sin(timeF) * waveAmplitude;\n" \
"float wave2 = cos(timeF * 1.3) * waveAmplitude;\n" \
"modelPos.y += wave1 + wave2;\n" \
"vec4 worldPos = gl_ModelViewMatrix * modelPos;\n" \
"gl_Position = gl_ProjectionMatrix * worldPos;\n" \
"gl_FrontColor = gl_Color;\n" \
"gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;\n" \
"gl_ClipVertex = worldPos;\n" \
"}\0"
// reinterpretation of sprite lighting for models
// it's a combination of how it works for normal sprites & papersprites
#define GLSL_MODEL_LIGHTING_VERTEX_SHADER \