aboutsummaryrefslogtreecommitdiffstats
path: root/assets/shaders/glsl330/instancing.vs
blob: f537278dfd1d8f75b58c10435280bdb372dc1bb8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#version 330 core

// Input vertex attributes
in vec3 vertexPosition;
in vec2 vertexTexCoord;

layout (location = 12) in mat4 instance;

// Input uniform values
uniform mat4 mvp;
uniform mat4 projection;
uniform mat4 view;

// Output vertex attributes (to fragment shader)
out vec2 fragTexCoord;
out vec4 fragColor;
out vec3 fragNormal;

// NOTE: Add here your custom variables

void main()
{
    // Send vertex attributes to fragment shader
    fragTexCoord = vertexTexCoord;

    // Calculate final vertex position
    mat4 mvpi = mvp * instance;
    gl_Position = mvpi * vec4(vertexPosition, 1.0);
}