Basicallly POC, but still somethign wrong with u_FontQuadParts
This commit is contained in:
@ -40,7 +40,8 @@ void FontShader::compile() {
|
||||
"gl_Position = u_Projection * u_View * u_Model * vec4(aPos.xy, 0, 1.0);\n"
|
||||
"o_TextCoord = vec2(aTexCoord.x, aTexCoord.y);\n"
|
||||
"int quadIndex = gl_VertexID / " MACRO_STRINGIFY(QUAD_VERTICE_COUNT) ";\n"
|
||||
"int partIndex = u_FontQuadParts[quadIndex];\n"
|
||||
"int partIndex = quadIndex < 5 ? 0 : 1;\n"
|
||||
// "int partIndex = u_FontQuadParts[0];\n"
|
||||
"o_VertColor = u_FontParts[partIndex].color;\n"
|
||||
"o_TextIndex = u_FontParts[partIndex].texture;\n"
|
||||
"}",
|
||||
@ -57,12 +58,12 @@ void FontShader::compile() {
|
||||
"void main() {\n"
|
||||
"o_Color = o_VertColor;\n"
|
||||
"vec4 textColor;\n"
|
||||
"if(o_TextIndex == 0) {\n"
|
||||
"textColor = texture(u_Text0, o_TextCoord);"
|
||||
"if(o_TextIndex == 0) \n{"
|
||||
"textColor = texture(u_Text0, o_TextCoord);\n"
|
||||
"} else {\n"
|
||||
"textColor = texture(u_Text1, o_TextCoord);"
|
||||
"textColor = texture(u_Text1, o_TextCoord);\n"
|
||||
"}\n"
|
||||
"o_Color.a *= textColor.r;\n"
|
||||
"o_Color.a = textColor.r;\n"
|
||||
"}\n"
|
||||
);
|
||||
#else
|
||||
|
@ -12,15 +12,19 @@
|
||||
#define FONT_SHADER_TEXTURE_MAX 8
|
||||
|
||||
namespace Dawn {
|
||||
#pragma pack(push, 1)
|
||||
struct FontShaderPart {
|
||||
struct Color color;
|
||||
int32_t texture;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct FontShaderBufferData {
|
||||
struct FontShaderPart fontParts[FONT_SHADER_PARTS_MAX];
|
||||
int32_t fontQuadParts[FONT_SHADER_QUADS_MAX];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
class FontShaderBuffer : public ShaderParameterBuffer<struct FontShaderBufferData> {
|
||||
|
||||
|
Reference in New Issue
Block a user