Made char rotate

This commit is contained in:
2024-11-25 22:12:03 -06:00
parent 4914ec6168
commit 91caebd385
11 changed files with 174 additions and 52 deletions

View File

@ -21,35 +21,39 @@ void SimpleTexturedShader::getStages(
switch(variant) {
case ShaderOpenGLVariant::GLSL_330_CORE:
vertex = std::make_shared<ShaderStage>(
ShaderStageType::VERTEX,
"#version 330 core\n"
"layout (location = 0) in vec3 aPos;\n"
"layout (location = 1) in vec2 aTexCoord;\n"
"uniform mat4 u_Projection;\n"
"uniform mat4 u_View;\n"
"uniform mat4 u_Model;\n"
"out vec2 o_TextCoord;\n"
"void main() {\n"
"gl_Position = u_Projection * u_View * u_Model * vec4(aPos, 1.0);\n"
"o_TextCoord = vec2(aTexCoord.x, aTexCoord.y);\n"
"}"
ShaderStageType::VERTEX,R"(
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
uniform mat4 u_Projection;
uniform mat4 u_View;
uniform mat4 u_Model;
out vec2 o_TextCoord;
void main() {
gl_Position = u_Projection * u_View * u_Model * vec4(aPos, 1.0);
o_TextCoord = vec2(aTexCoord.x, aTexCoord.y);
}
)"
);
fragment = std::make_shared<ShaderStage>(
ShaderStageType::FRAGMENT,
"#version 330 core\n"
"in vec2 o_TextCoord;\n"
"out vec4 o_Color;\n"
"uniform vec4 u_Color;\n"
"uniform bool u_HasTexture;\n"
"uniform sampler2D u_Texture;\n"
"void main() {\n"
"if(u_HasTexture) {\n"
"o_Color = texture(u_Texture, o_TextCoord);\n"
"} else {\n"
"o_Color = u_Color;"
"}\n"
"}\n"
ShaderStageType::FRAGMENT,R"(
#version 330 core
in vec2 o_TextCoord;
out vec4 o_Color;
uniform vec4 u_Color;
uniform bool u_HasTexture;
uniform sampler2D u_Texture;
void main() {
if(u_HasTexture) {
o_Color = texture(u_Texture, o_TextCoord);
} else {
o_Color = u_Color;
}
if(o_Color.a == 0) discard;
}
)"
);
break;