remove opacity (use color instead)
This commit is contained in:
@@ -13,15 +13,12 @@ public:
|
||||
|
||||
void setColor(float r, float g, float b, float a);
|
||||
void setColor(const std::array<float, 4>& color);
|
||||
void setOpacity(float opacity);
|
||||
|
||||
private:
|
||||
int32_t a_pos = -1;
|
||||
|
||||
std::array<float, 4> color = {{}};
|
||||
int32_t u_color = -1;
|
||||
float opacity = 0.0f;
|
||||
float u_opacity = 0.0f;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -130,8 +130,13 @@ void Painter::drawClippingMask(const mat4& matrix, uint8_t clip_id) {
|
||||
gl::group group("mask");
|
||||
plainShader->setMatrix(matrix);
|
||||
|
||||
plainShader->setColor(style.computed.background.color);
|
||||
plainShader->setOpacity(style.computed.background.opacity);
|
||||
Color background = style.computed.background.color;
|
||||
background[0] *= style.computed.background.opacity;
|
||||
background[1] *= style.computed.background.opacity;
|
||||
background[2] *= style.computed.background.opacity;
|
||||
background[3] *= style.computed.background.opacity;
|
||||
|
||||
plainShader->setColor(background);
|
||||
|
||||
glStencilFunc(GL_ALWAYS, clip_id, 0xFF);
|
||||
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)tileStencilBuffer.index());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
uniform vec4 u_color;
|
||||
uniform float u_opacity;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = u_color * u_opacity;
|
||||
gl_FragColor = u_color;
|
||||
}
|
||||
|
||||
@@ -20,13 +20,11 @@ PlainShader::PlainShader()
|
||||
|
||||
u_matrix = glGetUniformLocation(program, "u_matrix");
|
||||
u_color = glGetUniformLocation(program, "u_color");
|
||||
u_opacity = glGetUniformLocation(program, "u_opacity");
|
||||
|
||||
// fprintf(stderr, "PlainShader:\n");
|
||||
// fprintf(stderr, " - a_pos: %d\n", a_pos);
|
||||
// fprintf(stderr, " - u_matrix: %d\n", u_matrix);
|
||||
// fprintf(stderr, " - u_color: %d\n", u_color);
|
||||
// fprintf(stderr, " - u_opacity: %f\n", u_opacity);
|
||||
}
|
||||
|
||||
void PlainShader::bind(char *offset) {
|
||||
@@ -44,10 +42,3 @@ void PlainShader::setColor(const std::array<float, 4>& new_color) {
|
||||
void PlainShader::setColor(float r, float g, float b, float a) {
|
||||
setColor({{ r, g, b, a }});
|
||||
}
|
||||
|
||||
void PlainShader::setOpacity(float new_opacity) {
|
||||
if (opacity != new_opacity) {
|
||||
glUniform1f(u_opacity, new_opacity);
|
||||
opacity = new_opacity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ const shader_source llmr::shaders[SHADER_COUNT] = {
|
||||
},
|
||||
{
|
||||
"#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n",
|
||||
"#version 120\nuniform vec4 u_color;\nuniform float u_opacity;\nvoid main ()\n{\n gl_FragColor = (u_color * u_opacity);\n}\n\n",
|
||||
"#version 120\nuniform vec4 u_color;\nvoid main ()\n{\n gl_FragColor = u_color;\n}\n\n",
|
||||
},
|
||||
{
|
||||
"#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform float u_size;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n}\n\n",
|
||||
|
||||
@@ -24,7 +24,7 @@ const shader_source llmr::shaders[SHADER_COUNT] = {
|
||||
},
|
||||
{
|
||||
"precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n",
|
||||
"precision highp float;\nuniform vec4 u_color;\nuniform float u_opacity;\nvoid main ()\n{\n gl_FragColor = (u_color * u_opacity);\n}\n\n",
|
||||
"precision highp float;\nuniform vec4 u_color;\nvoid main ()\n{\n gl_FragColor = u_color;\n}\n\n",
|
||||
},
|
||||
{
|
||||
"precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform float u_size;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n}\n\n",
|
||||
|
||||
Reference in New Issue
Block a user