20 lines
405 B
GLSL
20 lines
405 B
GLSL
#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);
|
|
}
|