Use vec2 for glyph model scale

This commit is contained in:
bloeys
2022-07-03 22:18:37 +04:00
parent afb5453a3a
commit 115310cff7
3 changed files with 14 additions and 13 deletions

View File

@ -3,29 +3,31 @@
//aVertPos must be in the range [0,1]
layout(location=0) in vec3 aVertPos;
//Instanced
layout(location=1) in vec2 aUV0;
layout(location=2) in vec4 aVertColor;
layout(location=3) in vec3 aModelPos;
layout(location=4) in vec3 aModelScale;
layout(location=4) in vec2 aModelScale;
out vec2 v2fUV0;
out vec4 v2fColor;
out vec3 v2fFragPos;
//MVP = Model View Projection
uniform mat4 projViewMat;
uniform vec2 modelSize;
uniform vec2 sizeUV;
void main()
{
mat4 modelMat = mat4(
aModelScale.x, 0.0, 0.0, 0.0,
0.0, aModelScale.y, 0.0, 0.0,
0.0, 0.0, aModelScale.z, 0.0,
aModelPos.x, aModelPos.y, aModelPos.z, 1.0
aModelScale.x, 0.0, 0.0, 0.0,
0.0, aModelScale.y, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
aModelPos.x, aModelPos.y, aModelPos.z, 1.0
);
v2fUV0 = aUV0 + sizeUV*aVertPos.xy;
v2fUV0 = aUV0 + aVertPos.xy * sizeUV;
v2fColor = aVertColor;
v2fFragPos = vec3(modelMat * vec4(aVertPos, 1.0));