2023-07-28 21:04:54 +02:00
|
|
|
#version 100
|
|
|
|
precision mediump float;
|
|
|
|
|
|
|
|
attribute vec3 pos;
|
|
|
|
attribute vec2 uv;
|
|
|
|
attribute vec3 normal;
|
|
|
|
uniform vec3 wpos;
|
|
|
|
|
|
|
|
varying vec2 texcoord;
|
|
|
|
varying vec3 v_normal;
|
|
|
|
varying float v_position;
|
2023-07-30 14:17:54 +02:00
|
|
|
varying vec3 v_cam_normal;
|
2023-07-28 21:04:54 +02:00
|
|
|
|
|
|
|
uniform mat4 view;
|
|
|
|
uniform mat4 proj;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
mat4 drawProj = mat4(
|
|
|
|
vec4(-1.0, 0.0, 0.0, 0.0),
|
|
|
|
vec4(0.0, 1.0, 0.0, 0.0),
|
|
|
|
vec4(0.0, 0.0, -1.0, 0.0),
|
|
|
|
vec4(-wpos.x, wpos.y, -wpos.z, 1.0)
|
|
|
|
);
|
|
|
|
texcoord = uv;
|
|
|
|
|
|
|
|
v_normal = normal;
|
2023-07-30 14:17:54 +02:00
|
|
|
|
2023-07-28 21:04:54 +02:00
|
|
|
|
2023-07-30 14:17:54 +02:00
|
|
|
vec4 space_pos = view * drawProj * vec4(pos, 1.0);
|
2023-07-28 21:04:54 +02:00
|
|
|
|
2023-07-30 14:17:54 +02:00
|
|
|
gl_Position = proj * space_pos;//* view * drawProj * vec4(pos, 1.0);
|
|
|
|
|
|
|
|
v_position = length(space_pos.xyz);
|
|
|
|
v_cam_normal = mat3(view * drawProj) * normal;
|
2023-07-28 21:04:54 +02:00
|
|
|
}
|