implement the complete stroke shader with custom blending mode

This commit is contained in:
2017-04-05 15:55:11 +01:00
parent dc693b2232
commit 9a4fd5e5c9
13 changed files with 265 additions and 46 deletions

View File

@@ -7,25 +7,13 @@ enum class kShaderUniform : uint16_t
{
MVP = const_hash("mvp"),
Tex = const_hash("tex"),
TexFG = const_hash("tex_fg"),
TexBG = const_hash("tex_bg"),
Col = const_hash("col"),
Tof = const_hash("tof"),
Tsz = const_hash("tsz"),
Alpha = const_hash("alpha"),
};
class Shader
{
std::map<kShaderUniform, GLuint> m_umap;
GLuint prog;
public:
bool create(const char* vertex, const char* fragment);
void use();
void u_vec4(kShaderUniform id, const glm::vec4& v);
void u_vec2(kShaderUniform id, const glm::vec2& v);
void u_mat4(kShaderUniform id, const glm::mat4& m);
void u_int(kShaderUniform id, int i);
void u_float(kShaderUniform id, float f);
GLint GetAttribLocation(const char* name);
Resolution = const_hash("resolution"),
};
enum class kShader : uint16_t
@@ -38,6 +26,23 @@ enum class kShader : uint16_t
Font = const_hash("font"),
Atlas = const_hash("atlas"),
Stroke = const_hash("stroke"),
StrokeLayer = const_hash("stroke-layer"),
};
class Shader
{
std::map<kShaderUniform, GLuint> m_umap;
GLuint prog;
public:
kShader name;
bool create(const char* vertex, const char* fragment);
void use();
void u_vec4(kShaderUniform id, const glm::vec4& v);
void u_vec2(kShaderUniform id, const glm::vec2& v);
void u_mat4(kShaderUniform id, const glm::mat4& m);
void u_int(kShaderUniform id, int i);
void u_float(kShaderUniform id, float f);
GLint GetAttribLocation(const char* name);
};
class ShaderManager