Skip to content

Commit

Permalink
matrixhaxx
Browse files Browse the repository at this point in the history
  • Loading branch information
dsvensson committed Jan 20, 2025
1 parent c5a28ff commit 07530db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
18 changes: 7 additions & 11 deletions src/glsl/draw_aliasmodel.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,6 @@ void main()
if (mode != EZQ_ALIAS_MODE_OUTLINES && mode != EZQ_ALIAS_MODE_OUTLINES_SPEC) {
vec4 tex = texture(samplers[fsMaterialSampler], fsTextureCoord.st);
vec4 altTex = texture(samplers[fsMaterialSampler], fsAltTextureCoord.st);
#ifdef DRAW_CAUSTIC_TEXTURES
vec4 caustic = texture(
causticsTex,
vec2(
// Using multipler of 3 here - not in other caustics logic but range
// isn't enough otherwise, effect too subtle
(fsTextureCoord.s + sin(0.465 * (time + fsTextureCoord.t))) * 3 * -0.1234375,
(fsTextureCoord.t + sin(0.465 * (time + fsTextureCoord.s))) * 3 * -0.1234375
)
);
#endif

if (mode == EZQ_ALIAS_MODE_SHELLS) {
vec4 color1 = vec4(
Expand All @@ -99,6 +88,13 @@ void main()

#ifdef DRAW_CAUSTIC_TEXTURES
if ((fsFlags & AMF_CAUSTICS) == AMF_CAUSTICS) {
vec4 caustic = texture(causticsTex, vec2(
// Using multipler of 3 here - not in other caustics logic but range
// isn't enough otherwise, effect too subtle
(fsTextureCoord.s + sin(0.465 * (time + fsTextureCoord.t))) * 3 * -0.1234375,
(fsTextureCoord.t + sin(0.465 * (time + fsTextureCoord.s))) * 3 * -0.1234375
));

// FIXME: Do proper GL_DECAL etc
frag_colour = vec4(caustic.rgb * frag_colour.rgb * 1.8, frag_colour.a);
}
Expand Down
18 changes: 8 additions & 10 deletions src/glsl/draw_world.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,7 @@ void main()
#ifdef DRAW_DETAIL_TEXTURES
vec4 detail = texture(detailTex, DetailCoord);
#endif
#ifdef DRAW_CAUSTIC_TEXTURES
vec4 caustic = texture(
causticsTex,
vec2(
(TextureCoord.s + sin(0.465 * (time + TextureCoord.t))) * -0.1234375,
(TextureCoord.t + sin(0.465 * (time + TextureCoord.s))) * -0.1234375
)
);
#endif

#if defined(DRAW_LUMA_TEXTURES) || defined(DRAW_LUMA_TEXTURES_FB)
vec4 lumaColor = texture(materialTex[SamplerNumber], LumaCoord);
#endif
Expand Down Expand Up @@ -245,7 +237,13 @@ void main()
#endif

#ifdef DRAW_CAUSTIC_TEXTURES
frag_colour = vec4(mix(frag_colour.rgb, caustic.rgb * frag_colour.rgb * 2.0, min(1, Flags & EZQ_SURFACE_UNDERWATER)), frag_colour.a);
if ((Flags & EZQ_SURFACE_UNDERWATER) != 0) {
vec4 caustic = texture(causticsTex, vec2(
(TextureCoord.s + sin(0.465 * (time + TextureCoord.t))) * -0.1234375,
(TextureCoord.t + sin(0.465 * (time + TextureCoord.s))) * -0.1234375
));
frag_colour = vec4(caustic.rgb * frag_colour.rgb * 2.0, frag_colour.a);
}
#endif

#ifdef DRAW_DETAIL_TEXTURES
Expand Down

0 comments on commit 07530db

Please sign in to comment.