Files
rez_demo/resources/vertexShader_gourard.glsl

42 lines
1009 B
Plaintext
Raw Normal View History

#version 300 es
/*this will affect all the float guys (float, vecN, matN )*/
precision mediump float;
layout (location = 0) in vec3 vertPos; // Attributo Posizione
layout (location = 1) in vec2 coord_uv; // Attributo texture
layout (location = 2) in vec3 vertNor;
layout (location = 3) in vec3 vertTan;
layout (location = 4) in vec3 vertBitan;
uniform mat4 Model;
uniform mat4 ModelRot;
uniform mat4 Projection;
uniform mat4 View;
out vec3 fragPos;
out vec2 frag_uv;
out vec3 fragNormal;
out vec3 fragBaryc;
out vec3 T;
out vec3 B;
out vec3 N;
void main()
{
frag_uv = coord_uv;
vec3 normal = normalize(vertNor);
mat3 mv = mat3(View * Model);
T = normalize(mv * vertTan);
B = normalize(mv * vertBitan);
N = normalize(mv * vertNor);
fragNormal = mat3(ModelRot) * vec3(normal);
fragPos=(Model*vec4(vertPos,1)).xyz;
gl_Position=Projection*View*Model*vec4(vertPos,1);
fragBaryc = vec3(gl_VertexID % 3 == 0, gl_VertexID % 3 == 1, gl_VertexID % 3 == 2);
}