fix color picker, add project delete button with message box
This commit is contained in:
@@ -69,46 +69,43 @@ void ui::Canvas::pick_update(int plane)
|
||||
|
||||
// prepare common states
|
||||
glViewport(0, 0, m_width, m_height);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
//for (int i = 0; i < 6; i++)
|
||||
int i = plane;
|
||||
m_tmp[i].bindFramebuffer();
|
||||
m_tmp[i].clear({ 1, 1, 1, 1 });
|
||||
|
||||
for (auto layer_index : m_order)
|
||||
{
|
||||
int i = plane;
|
||||
m_tmp[i].bindFramebuffer();
|
||||
m_tmp[i].clear({ 1, 1, 1, 1 });
|
||||
// copy to tmp2 for layer blending
|
||||
glActiveTexture(GL_TEXTURE0); // TODO: maybe remove this line
|
||||
// #ifndef __IOS__
|
||||
// m_tex2[i].bind();
|
||||
// glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, m_width, m_height);
|
||||
// m_tex2[i].unbind();
|
||||
// #endif
|
||||
|
||||
for (auto layer_index : m_order)
|
||||
{
|
||||
// copy to tmp2 for layer blending
|
||||
glActiveTexture(GL_TEXTURE0); // TODO: maybe remove this line
|
||||
// #ifndef __IOS__
|
||||
// m_tex2[i].bind();
|
||||
// glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, m_width, m_height);
|
||||
// m_tex2[i].unbind();
|
||||
// #endif
|
||||
|
||||
m_layers[layer_index].m_rtt[i].bindTexture();
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
m_tex2[i].bind();
|
||||
m_sampler.bind(0);
|
||||
m_sampler_bg.bind(1);
|
||||
ShaderManager::use(ui::kShader::TextureAlpha);
|
||||
ShaderManager::u_int(kShaderUniform::TexBG, 1);
|
||||
ShaderManager::u_float(kShaderUniform::Alpha, m_layers[layer_index].m_opacity);
|
||||
ShaderManager::u_int(kShaderUniform::Highlight, false);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
|
||||
m_plane.draw_fill();
|
||||
m_sampler.unbind();
|
||||
m_sampler_bg.unbind();
|
||||
m_tex2[i].unbind();
|
||||
m_layers[layer_index].m_rtt[i].unbindTexture();
|
||||
}
|
||||
if (!m_pick_data[plane])
|
||||
m_pick_data[plane] = std::make_unique<glm::u8vec4[]>(m_width*m_height);
|
||||
glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_pick_data[plane].get());
|
||||
m_tmp[i].unbindFramebuffer();
|
||||
m_layers[layer_index].m_rtt[i].bindTexture();
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
m_tex2[i].bind();
|
||||
m_sampler.bind(0);
|
||||
m_sampler_bg.bind(1);
|
||||
ShaderManager::use(ui::kShader::TextureAlpha);
|
||||
ShaderManager::u_int(kShaderUniform::TexBG, 1);
|
||||
ShaderManager::u_float(kShaderUniform::Alpha, m_layers[layer_index].m_opacity);
|
||||
ShaderManager::u_int(kShaderUniform::Highlight, false);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
|
||||
m_plane.draw_fill();
|
||||
m_sampler.unbind();
|
||||
m_sampler_bg.unbind();
|
||||
m_tex2[i].unbind();
|
||||
m_layers[layer_index].m_rtt[i].unbindTexture();
|
||||
}
|
||||
if (!m_pick_data[plane])
|
||||
m_pick_data[plane] = std::make_unique<glm::u8vec4[]>(m_width*m_height);
|
||||
glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_pick_data[plane].get());
|
||||
m_tmp[i].unbindFramebuffer();
|
||||
|
||||
// restore viewport and clear color states
|
||||
blend ? glEnable(GL_BLEND) : glDisable(GL_BLEND);
|
||||
|
||||
Reference in New Issue
Block a user