smrendererv3/SMCode/SM2D/Shader/ShaderFiles/default.vert
Michel Fedde 2aa12f8d25 27.09.2020
~ Moved Default-Shader to 2D to provied 2D-specific feature
~ Fixed UVs in Polygon
2020-09-27 11:58:14 +02:00

23 lines
No EOL
578 B
GLSL

#version 330
#define maxInstances 32
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec2 aTex;
layout(location = 3) in vec4 aColor;
uniform mat4 MVP;
uniform bool HasVColor;
uniform mat4 ModelMatrix[maxInstances];
uniform vec2 TextureOffset[maxInstances];
uniform vec2 TextureScale[maxInstances];
out vec2 vTexture;
out vec4 vColor;
void main() {
vTexture = aTex * TextureScale[gl_InstanceID] + TextureOffset[gl_InstanceID];
if (HasVColor) vColor = aColor;
else vColor = vec4(1);
gl_Position = MVP * ModelMatrix[gl_InstanceID] * vec4(aPos, 1);
}