I CAN SEE
This commit is contained in:
parent
0151eb65ef
commit
75ee5a6da8
5 changed files with 344 additions and 106 deletions
31
game/terrain.vs
Normal file
31
game/terrain.vs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes
|
||||
in vec3 vertexPosition;
|
||||
in vec3 vertexNormal;
|
||||
in vec2 vertexTexCoord;
|
||||
|
||||
// Uniforms
|
||||
uniform mat4 mvp;
|
||||
uniform mat4 matModel;
|
||||
uniform mat4 matNormal;
|
||||
|
||||
// Output to fragment shader
|
||||
out vec3 fragPosition;
|
||||
out vec3 fragNormal;
|
||||
out vec2 fragTexCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Transform vertex position to world space
|
||||
fragPosition = vec3(matModel * vec4(vertexPosition, 1.0));
|
||||
|
||||
// Transform normal to world space
|
||||
fragNormal = normalize(vec3(matNormal * vec4(vertexNormal, 0.0)));
|
||||
|
||||
// Pass texture coordinates
|
||||
fragTexCoord = vertexTexCoord;
|
||||
|
||||
// Transform to clip space
|
||||
gl_Position = mvp * vec4(vertexPosition, 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue