TkAstral3D/packages/sdk/public/resource/shaders/water/pool/vertex.glsl
2026-04-08 15:34:43 +08:00

20 lines
405 B
GLSL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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);
}