summaryrefslogtreecommitdiff
path: root/data/shaders/pbr-vert.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'data/shaders/pbr-vert.glsl')
-rw-r--r--data/shaders/pbr-vert.glsl9
1 files changed, 3 insertions, 6 deletions
diff --git a/data/shaders/pbr-vert.glsl b/data/shaders/pbr-vert.glsl
index 530c564..bf43e81 100644
--- a/data/shaders/pbr-vert.glsl
+++ b/data/shaders/pbr-vert.glsl
@@ -21,14 +21,12 @@ attribute vec4 color0;
#ifdef GLSL120
varying vec3 fragWorldPos;
-varying vec3 fragCamPos;
varying vec3 fragNormal;
varying vec2 fragTexcoord0;
varying vec2 fragTexcoord1;
varying vec4 fragColor0;
#else
out vec3 fragWorldPos;
-out vec3 fragCamPos;
out vec3 fragNormal;
out vec2 fragTexcoord0;
out vec2 fragTexcoord1;
@@ -40,11 +38,10 @@ uniform mat4 view;
uniform mat4 projection;
void main(void) {
- fragWorldPos = (model * vec4(position.xyz, 1.0)).xyz;
- fragCamPos = (view * vec4(0.0, 0.0, 0.0, 1.0)).xyz;
- fragNormal = normal;
+ fragWorldPos = vec3(model * vec4(position, 1.0));
+ fragNormal = mat3(model) * normal;
fragTexcoord0 = texcoord0;
fragTexcoord1 = texcoord1;
fragColor0 = color0;
- gl_Position = projection * view * model * vec4(position.xyz, 1.0);
+ gl_Position = projection * view * vec4(fragWorldPos, 1.0);
}