remove direct use of rtt and dirty area from the layer

This commit is contained in:
2019-10-15 11:57:39 +02:00
parent 9e93fe48d6
commit 9ccd6ed2f4
12 changed files with 404 additions and 334 deletions

View File

@@ -164,9 +164,9 @@ void NodeCanvas::draw()
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp_z);
glActiveTexture(GL_TEXTURE0);
m_canvas->m_layers_merge.m_rtt[plane_index].bindTexture();
m_canvas->m_layers_merge.rtt(plane_index).bindTexture();
m_face_plane.draw_fill();
m_canvas->m_layers_merge.m_rtt[plane_index].unbindTexture();
m_canvas->m_layers_merge.rtt(plane_index).unbindTexture();
}
}
else
@@ -217,7 +217,7 @@ void NodeCanvas::draw()
if (!(m_canvas->m_show_tmp && m_canvas->m_current_layer_idx == layer_index) &&
(!m_canvas->m_layers[layer_index]->m_visible ||
m_canvas->m_layers[layer_index]->m_opacity == .0f ||
!m_canvas->m_layers[layer_index]->m_dirty_face[plane_index]))
!m_canvas->m_layers[layer_index]->face(plane_index)))
continue;
if (use_blend)
@@ -249,17 +249,17 @@ void NodeCanvas::draw()
ShaderManager::u_int(kShaderUniform::Mask, m_canvas->m_smask_active);
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp_z);
glActiveTexture(GL_TEXTURE0);
m_canvas->m_layers[layer_index]->m_rtt[plane_index].bindTexture();
m_canvas->m_layers[layer_index]->rtt(plane_index).bindTexture();
glActiveTexture(GL_TEXTURE1);
m_canvas->m_tmp[plane_index].bindTexture();
glActiveTexture(GL_TEXTURE2);
m_canvas->m_smask.m_rtt[plane_index].bindTexture();
m_canvas->m_smask.rtt(plane_index).bindTexture();
m_face_plane.draw_fill();
m_canvas->m_smask.m_rtt[plane_index].unbindTexture();
m_canvas->m_smask.rtt(plane_index).unbindTexture();
glActiveTexture(GL_TEXTURE1);
m_canvas->m_tmp[plane_index].unbindTexture();
glActiveTexture(GL_TEXTURE0);
m_canvas->m_layers[layer_index]->m_rtt[plane_index].unbindTexture();
m_canvas->m_layers[layer_index]->rtt(plane_index).unbindTexture();
}
else if(m_canvas->m_current_stroke && m_canvas->m_show_tmp && m_canvas->m_current_layer_idx == layer_index)
{
@@ -299,11 +299,11 @@ void NodeCanvas::draw()
ShaderManager::u_vec2(kShaderUniform::PatternOffset, Canvas::I->m_pattern_offset);
glActiveTexture(GL_TEXTURE0);
m_canvas->m_layers[layer_index]->m_rtt[plane_index].bindTexture();
m_canvas->m_layers[layer_index]->rtt(plane_index).bindTexture();
glActiveTexture(GL_TEXTURE1);
m_canvas->m_tmp[plane_index].bindTexture();
glActiveTexture(GL_TEXTURE2);
m_canvas->m_smask.m_rtt[plane_index].bindTexture();
m_canvas->m_smask.rtt(plane_index).bindTexture();
glActiveTexture(GL_TEXTURE3);
if (b->m_dual_enabled)
m_canvas->m_tmp_dual[plane_index].bindTexture();
@@ -316,11 +316,11 @@ void NodeCanvas::draw()
if (b->m_dual_enabled)
m_canvas->m_tmp_dual[plane_index].unbindTexture();
glActiveTexture(GL_TEXTURE2);
m_canvas->m_smask.m_rtt[plane_index].unbindTexture();
m_canvas->m_smask.rtt(plane_index).unbindTexture();
glActiveTexture(GL_TEXTURE1);
m_canvas->m_tmp[plane_index].unbindTexture();
glActiveTexture(GL_TEXTURE0);
m_canvas->m_layers[layer_index]->m_rtt[plane_index].unbindTexture();
m_canvas->m_layers[layer_index]->rtt(plane_index).unbindTexture();
}
else
{
@@ -332,9 +332,9 @@ void NodeCanvas::draw()
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp_z);
glActiveTexture(GL_TEXTURE0);
m_canvas->m_layers[layer_index]->m_rtt[plane_index].bindTexture();
m_canvas->m_layers[layer_index]->rtt(plane_index).bindTexture();
m_face_plane.draw_fill();
m_canvas->m_layers[layer_index]->m_rtt[plane_index].unbindTexture();
m_canvas->m_layers[layer_index]->rtt(plane_index).unbindTexture();
}
if (use_blend)
@@ -380,7 +380,7 @@ void NodeCanvas::draw()
#ifdef _DEBUG
// draw dirty area
{
auto bb = m_canvas->m_layers[layer_index]->m_dirty_box[plane_index] / (float)m_canvas->m_layers[layer_index]->w;
auto bb = m_canvas->m_layers[layer_index]->box(plane_index) / (float)m_canvas->m_layers[layer_index]->w;
glm::vec2 bbmin = xy(bb);
glm::vec2 bbsz = zw(bb) - xy(bb);
ShaderManager::use(kShader::Color);
@@ -463,9 +463,9 @@ void NodeCanvas::draw()
glm::translate(glm::vec3(0, 0, -1.f));
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp);
m_canvas->m_smask.m_rtt[plane_index].bindTexture();
m_canvas->m_smask.rtt(plane_index).bindTexture();
m_face_plane.draw_fill();
m_canvas->m_smask.m_rtt[plane_index].unbindTexture();
m_canvas->m_smask.rtt(plane_index).unbindTexture();
}