picking works on iOS, now cleanup the code
This commit is contained in:
@@ -104,7 +104,6 @@ void ui::Canvas::pick_update(int plane)
|
||||
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());
|
||||
LOG("read plane %d", plane);
|
||||
m_tmp[i].unbindFramebuffer();
|
||||
}
|
||||
|
||||
|
||||
@@ -98,41 +98,6 @@ void CanvasModePen::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
||||
auto hsv = convert_rgb2hsv(glm::vec3(pix[0], pix[1], pix[2]));
|
||||
App::I.color->m_hue->set_value(hsv.x);
|
||||
App::I.color->m_quad->set_value(1.f - hsv.y, 1.f - hsv.z);
|
||||
|
||||
/*
|
||||
glm::vec3 ray_origin;
|
||||
glm::vec3 ray_dir;
|
||||
glm::vec3 hit_pos;
|
||||
glm::vec3 hit_normal;
|
||||
int plane_id;
|
||||
if (canvas->point_trace(loc, ray_origin, ray_dir, hit_pos, hit_normal, plane_id))
|
||||
{
|
||||
canvas->m_layers[canvas->m_current_layer_idx].m_rtt[plane_id].bindFramebuffer();
|
||||
glm::vec2 fbpos = (hit_pos.xy() * 0.5f + 0.5f) * glm::vec2(canvas->m_width, canvas->m_height);
|
||||
int x = fbpos.x;
|
||||
int y = fbpos.y;
|
||||
glm::u8vec4 sample;
|
||||
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &sample);
|
||||
glm::vec3 pix = glm::vec3(sample) / 255.f;
|
||||
auto hsv = convert_rgb2hsv(glm::vec3(pix[0], pix[1], pix[2]));
|
||||
App::I.color->m_hue->set_value(hsv.x);
|
||||
App::I.color->m_quad->set_value(1.f - hsv.y, 1.f - hsv.z);
|
||||
canvas->m_layers[canvas->m_current_layer_idx].m_rtt[plane_id].unbindFramebuffer();
|
||||
}
|
||||
*/
|
||||
/*
|
||||
glm::vec2 fbpos = me->m_pos * node->root()->m_zoom;
|
||||
int x = fbpos.x;
|
||||
int y = App::I.height - fbpos.y - 1;
|
||||
glm::i8vec4 sample;
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glReadBuffer(GL_FRONT);
|
||||
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &sample);
|
||||
glm::vec3 pix = glm::vec3(sample) / 255.f;
|
||||
auto hsv = convert_rgb2hsv(glm::vec3(pix[0], pix[1], pix[2]));
|
||||
App::I.color->m_hue->set_value(hsv.x);
|
||||
App::I.color->m_quad->set_value(1.f - hsv.y, 1.f - hsv.z);
|
||||
*/
|
||||
}
|
||||
m_dragging = false;
|
||||
m_picking = false;
|
||||
|
||||
Reference in New Issue
Block a user