feat: add wake, rose, terrain, pathfinding, gameover, clouds, enemy shooting, variable bird speed refactor: some things
This commit is contained in:
+9
-23
@@ -1,17 +1,12 @@
|
||||
#version 330
|
||||
|
||||
// -----------------------------
|
||||
// Inputs
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
in vec2 fragWorldPos;
|
||||
|
||||
// -----------------------------
|
||||
// Outputs
|
||||
out vec4 finalColor;
|
||||
|
||||
// -----------------------------
|
||||
// Uniforms
|
||||
uniform sampler2D texture0; // main texture
|
||||
uniform sampler2D texture0;
|
||||
uniform sampler2D waterDepthGradient;
|
||||
uniform sampler2D causticTexture;
|
||||
uniform sampler2D causticHighlightTexture;
|
||||
@@ -24,6 +19,7 @@ uniform sampler2D foamTexture;
|
||||
|
||||
uniform float aspectRatio = 1.0;
|
||||
uniform float pixelization = 2048.0;
|
||||
uniform float noiseCoordinateScale = 2048.0;
|
||||
|
||||
uniform vec4 causticColor = vec4(0.455, 0.773, 0.765, 1.0);
|
||||
uniform vec4 causticHighlightColor = vec4(0.741, 0.894, 0.898, 1.0);
|
||||
@@ -46,9 +42,6 @@ uniform float generalTransparency = 1.0;
|
||||
|
||||
uniform float time;
|
||||
|
||||
// -----------------------------
|
||||
// Helper functions
|
||||
|
||||
vec2 blendSubtract_vec2(vec2 base, vec2 blend, float opacity)
|
||||
{
|
||||
vec2 result = base - blend;
|
||||
@@ -80,9 +73,6 @@ vec2 applyAspectRatio(vec2 coordinates)
|
||||
return vec2(coordinates.x, coordinates.y * aspectRatio);
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// Shader layers
|
||||
|
||||
vec4 caustics(vec2 pixelizedCoordinates)
|
||||
{
|
||||
vec4 causticNoise = texture(causticNoiseTexture, time * causticSpeed + pixelizedCoordinates);
|
||||
@@ -111,27 +101,23 @@ vec4 foam(vec2 pixelizedCoordinates, vec4 mainTexColor)
|
||||
return vec4(colorizedFoam.rgb, colorizedFoam.a * intensity);
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// Main fragment
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pixelizedCoordinates = pixelizeCoordinates(applyAspectRatio(fragTexCoord));
|
||||
vec2 pixelizedCoordinates = pixelizeCoordinates(fragWorldPos / noiseCoordinateScale);
|
||||
vec4 mainTex = texture(texture0, fragTexCoord);
|
||||
vec4 depthBasedWaterColor = texture(waterDepthGradient, vec2(1.0 - mainTex.b, 1.0));
|
||||
|
||||
vec4 finalCaustics = caustics(pixelizedCoordinates);
|
||||
|
||||
vec4 finalCaustics = caustics(pixelizedCoordinates);
|
||||
vec4 finalSpecular = specular(pixelizedCoordinates);
|
||||
vec4 finalFoam = foam(pixelizedCoordinates, mainTex);
|
||||
|
||||
|
||||
vec4 waterWithCausticLayer = mix(depthBasedWaterColor, finalCaustics, finalCaustics.a);
|
||||
vec4 waterWithCausticAndSpecularLayer = mix(waterWithCausticLayer, finalSpecular, ceil(finalCaustics.a) * finalSpecular.a);
|
||||
vec4 waterWithCausticAndSpecularAndFoamLayer = mix(waterWithCausticAndSpecularLayer, finalFoam, finalFoam.a);
|
||||
|
||||
|
||||
float outline = mainTex.a * mainTex.r;
|
||||
vec4 finalOutlineColor = outline * outlineColor;
|
||||
|
||||
|
||||
vec4 finalRGBColor = mix(waterWithCausticAndSpecularAndFoamLayer, finalOutlineColor, outline);
|
||||
finalColor = vec4(finalRGBColor.rgb, mainTex.b * generalTransparency);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user