diff options
Diffstat (limited to 'data/shaders/pbr-vert.glsl')
-rw-r--r-- | data/shaders/pbr-vert.glsl | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/data/shaders/pbr-vert.glsl b/data/shaders/pbr-vert.glsl index f622988..530c564 100644 --- a/data/shaders/pbr-vert.glsl +++ b/data/shaders/pbr-vert.glsl @@ -2,11 +2,13 @@ #ifdef GLSL330 layout (location = 0) in vec3 position; -layout (location = 1) in vec2 texcoord0; -layout (location = 2) in vec2 texcoord1; -layout (location = 3) in vec4 color0; +layout (location = 1) in vec3 normal; +layout (location = 2) in vec2 texcoord0; +layout (location = 3) in vec2 texcoord1; +layout (location = 4) in vec4 color0; #elif defined(GLSL130) in vec3 position; +in vec3 normal; in vec2 texcoord0; in vec2 texcoord1; in vec4 color0; @@ -18,10 +20,16 @@ attribute vec4 color0; #endif #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; out vec4 fragColor0; @@ -32,6 +40,9 @@ 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; fragTexcoord0 = texcoord0; fragTexcoord1 = texcoord1; fragColor0 = color0; |