Hello friend

This commit is contained in:
bloeys
2022-06-30 12:36:04 +04:00
parent a20894a76e
commit bdf1250b3a
6 changed files with 220 additions and 26 deletions

15
res/models/quad.obj Executable file
View File

@ -0,0 +1,15 @@
# Blender v2.92.0 OBJ File: ''
# www.blender.org
o Plane
v -0.500000 -0.500000 0.000000
v 0.500000 -0.500000 0.000000
v -0.500000 0.500000 0.000000
v 0.500000 0.500000 0.000000
vt 1.000000 0.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 1.000000
vn 0.0000 0.0000 1.0000
s off
f 2/1/1 3/2/1 1/3/1
f 2/1/1 4/4/1 3/2/1

28
res/shaders/glyph.frag.glsl Executable file
View File

@ -0,0 +1,28 @@
#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;
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);
}

26
res/shaders/glyph.vert.glsl Executable file
View File

@ -0,0 +1,26 @@
#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;
// 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;
void main()
{
// vertNormal = mat3(transpose(inverse(modelMat))) * vertNormalIn;
vertUV0 = vertUV0In;
vertColor = vertColorIn;
fragPos = vec3(modelMat * vec4(vertPosIn, 1.0));
gl_Position = projMat * viewMat * modelMat * vec4(vertPosIn, 1.0);
}

View File

@ -2,7 +2,8 @@
uniform mat4 ProjMtx;
in vec2 Position;
in vec3 Position;
in vec3 Normal;
in vec2 UV;
in vec4 Color;
@ -12,6 +13,7 @@ out vec4 Frag_Color;
void main()
{
Frag_UV = UV;
Frag_Color = vec4(1,1,1,1);
Frag_Color = Color;
gl_Position = ProjMtx * vec4(Position.xy, 0, 1);
}