update color at picking and cleanup code from some warnings

This commit is contained in:
2019-03-11 15:35:59 +01:00
parent 373e7ad0e9
commit fda399f7dd
16 changed files with 56 additions and 63 deletions

View File

@@ -230,7 +230,7 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
!m_layers[layer_index]->m_dirty_face[plane_index])
continue;
glm::mat4 proj = glm::perspective(glm::radians(m_cam_fov), (float)m_mixer.getWidth() / m_mixer.getHeight(), 0.1f, 1000.f);
//glm::mat4 proj = glm::perspective(glm::radians(m_cam_fov), (float)m_mixer.getWidth() / m_mixer.getHeight(), 0.1f, 1000.f);
auto plane_mvp_z =
glm::scale(glm::vec3(1, -1, 1)) *
m_proj * m_mv *
@@ -379,12 +379,12 @@ glm::vec4 Canvas::stroke_draw_samples(int i, std::vector<vertex_t>& P)
}
else if (P.size() == 3)
{
m_brush_shape.update_vertices(P.data(), P.size());
m_brush_shape.update_vertices(P.data(), (int)P.size());
}
else
{
P = triangulate_simple(P);
m_brush_shape.update_vertices(P.data(), P.size());
m_brush_shape.update_vertices(P.data(), (int)P.size());
}
m_brush_shape.draw_fill();
@@ -643,18 +643,8 @@ bool Canvas::point_trace_plane(glm::vec2 loc, glm::vec3& hit_pos, glm::vec2& hit
bool Canvas::point_trace_plane(glm::vec2 loc, glm::vec3& ray_origin, glm::vec3& ray_dir,
glm::vec3& hit_pos, glm::vec3& hit_normal, glm::vec2& hit_fb_pos, int plane_id)
{
/*
auto ln = (loc / zw(m_box)) * 2.f - 1.f;
auto p = m_plane_unproject[plane_id] * glm::vec4(ln, 1, 1);
if (p.w <= 0)
{
return true;
}
*/
point_unproject(loc, { 0, 0, zw(m_box) }, m_mv, m_proj, ray_origin, ray_dir);
glm::vec3 hit;
glm::vec2 fb_pos;
float hit_t;
if (ray_intersect(ray_origin, ray_dir, m_plane_origin[plane_id],
m_plane_normal[plane_id], m_plane_tangent[plane_id], hit, hit_t))
@@ -1590,7 +1580,7 @@ void Canvas::export_layers_thread(std::string file_name)
App::I.async_update();
}
int progress = 0;
int total = (m_order.size() + 1) * 6;
int total = (int)(m_order.size() + 1) * 6;
// prepare common states
glViewport(0, 0, m_width, m_height);