jucraft/assets/shader/default.vsh.glsl

26 lines
533 B
Text
Raw Permalink Normal View History

2023-04-18 14:17:53 +02:00
#version 100
precision mediump float;
attribute vec3 pos;
attribute vec2 uv;
attribute vec3 wpos;
varying vec2 texcoord;
varying float v_position;
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;
gl_Position = proj * view * drawProj * vec4(pos, 1.0);
v_position = length((view * drawProj * vec4(pos, 1.0)).xyz);
}