mirror of
https://github.com/bloeys/nterm.git
synced 2025-12-29 06:28:20 +00:00
Instanced text drawing
This commit is contained in:
@ -1,15 +1,8 @@
|
||||
#version 410
|
||||
|
||||
// uniform float ambientStrength = 0.1;
|
||||
// uniform vec3 ambientLightColor = vec3(1, 1, 1);
|
||||
|
||||
// uniform vec3 lightPos1;
|
||||
// uniform vec3 lightColor1;
|
||||
|
||||
uniform sampler2D diffTex;
|
||||
|
||||
in vec4 vertColor;
|
||||
// in vec3 vertNormal;
|
||||
in vec2 vertUV0;
|
||||
in vec3 fragPos;
|
||||
|
||||
@ -17,12 +10,6 @@ out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
// vec3 lightDir = normalize(lightPos1 - fragPos);
|
||||
// float diffStrength = max(0.0, dot(normalize(vertNormal), lightDir));
|
||||
|
||||
// vec3 finalAmbientColor = ambientLightColor * ambientStrength;
|
||||
vec4 texColor = texture(diffTex, vertUV0);
|
||||
fragColor = vec4(vertColor.rgb, texColor.r*texColor.a);
|
||||
// fragColor = vec4(texColor.rgb * vertColor * (finalAmbientColor + diffStrength*lightColor1) , texColor.a);
|
||||
// Out_Color = vec4(Frag_Color.rgb, Frag_Color.a * texture(Texture, Frag_UV.st).r);
|
||||
}
|
||||
|
||||
@ -1,26 +1,31 @@
|
||||
#version 410
|
||||
|
||||
layout(location=0) in vec3 vertPosIn;
|
||||
// layout(location=1) in vec3 vertNormalIn;
|
||||
layout(location=1) in vec2 vertUV0In;
|
||||
layout(location=2) in vec4 vertColorIn;
|
||||
layout(location=1) in vec2[4] vertUV0STIn; //[(u,v), (u+sizeU,v), (u,v+sizeV), (u+sizeU,v+sizeV)]
|
||||
layout(location=5) in vec4 vertColorIn;
|
||||
layout(location=6) in vec3 modelPos;
|
||||
layout(location=7) in vec3 modelScale;
|
||||
|
||||
|
||||
// out vec3 vertNormal;
|
||||
out vec2 vertUV0;
|
||||
out vec4 vertColor;
|
||||
out vec3 fragPos;
|
||||
|
||||
//MVP = Model View Projection
|
||||
uniform mat4 modelMat;
|
||||
uniform mat4 viewMat;
|
||||
uniform mat4 projMat;
|
||||
uniform mat4 projViewMat;
|
||||
|
||||
void main()
|
||||
{
|
||||
// vertNormal = mat3(transpose(inverse(modelMat))) * vertNormalIn;
|
||||
vertUV0 = vertUV0In;
|
||||
mat4 modelMat = mat4(
|
||||
modelScale.x, 0.0, 0.0, 0.0,
|
||||
0.0, modelScale.y, 0.0, 0.0,
|
||||
0.0, 0.0, modelScale.z, 0.0,
|
||||
modelPos.x, modelPos.y, modelPos.z, 1.0
|
||||
);
|
||||
|
||||
vertUV0 = vertUV0STIn[gl_VertexID];
|
||||
vertColor = vertColorIn;
|
||||
fragPos = vec3(modelMat * vec4(vertPosIn, 1.0));
|
||||
|
||||
gl_Position = projMat * viewMat * modelMat * vec4(vertPosIn, 1.0);
|
||||
gl_Position = projViewMat * modelMat * vec4(vertPosIn, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user