feat(all): 迁移扩展相关功能

This commit is contained in:
plum
2026-04-08 15:34:43 +08:00
parent ad2dd979eb
commit d7c0dba569
278 changed files with 25207 additions and 62 deletions
@@ -0,0 +1,47 @@
precision highp float;
precision highp int;
#include <utils>
uniform float wallOpacity;
uniform float wallMode;
uniform vec3 volumeColor;
uniform sampler2D sceneTexture;
uniform vec2 resolution;
uniform float useSceneRefraction;
uniform float surfaceTransmittance;
uniform float normalStrength;
uniform float refractionStrength;
in vec3 pos;
out vec4 fragColor;
void main() {
vec3 baseColor = wallMode > 0.5 ? volumeColor : getWallColor(pos) * volumeColor;
vec4 info = texture(water, pos.xz * 0.5 + 0.5);
vec2 screenUV = gl_FragCoord.xy / resolution;
vec2 offset = info.ba * normalStrength * refractionStrength;
vec3 mixedColor = baseColor;
if (useSceneRefraction > 0.5) {
vec2 refractedUV = clamp(screenUV + offset, 0.0, 1.0);
vec3 sceneColor = texture(sceneTexture, refractedUV).rgb;
mixedColor = mix(baseColor, sceneColor, surfaceTransmittance);
}
float depth = 0.0;
if (pos.y < info.r) {
depth = clamp((info.r - pos.y) / max(poolHeight, 0.0001), 0.0, 1.0);
float atten = wallMode > 0.5 ? mix(0.95, 0.35, depth) : mix(0.98, 0.6, depth);
mixedColor *= atten;
}
float alpha = wallOpacity;
if (wallMode > 0.5 && pos.y < info.r) {
alpha = mix(wallOpacity * 0.6, min(1.0, wallOpacity + 0.5), depth);
}
fragColor = vec4(mixedColor, alpha);
}
@@ -0,0 +1,19 @@
#include <utils>
uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
in vec3 position;
out vec3 pos;
void main() {
pos = position.xyz;
pos.x *= poolHalfSize.x;
pos.z *= poolHalfSize.y;
// 墙体高度与水面齐平:y ∈ [-1, 1] 映射到 [-poolHeight, 0]
pos.y = ((1.0 - pos.y) * 0.5 - 1.0) * poolHeight;
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
}