implement multithreaded rendering with context switch, gl state save/restore, add progress bar ui node, implement stencil texture for brush, implement multithreaded canvas load/save/export pano. Missing multithread in windows.
This commit is contained in:
@@ -116,6 +116,7 @@ void CanvasModePen::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
||||
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_cur_pos = loc;
|
||||
break;
|
||||
case kEventType::MouseCancel:
|
||||
if (m_dragging)
|
||||
@@ -134,6 +135,35 @@ void CanvasModePen::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
||||
}
|
||||
}
|
||||
|
||||
void CanvasModePen::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const glm::mat4& camera)
|
||||
{
|
||||
#ifndef __IOS__
|
||||
if (!m_dragging && !m_picking)
|
||||
{
|
||||
ui::ShaderManager::use(ui::kShader::StrokePreview);
|
||||
ui::ShaderManager::u_int(ui::kShaderUniform::Tex, 0);
|
||||
ui::ShaderManager::u_float(ui::kShaderUniform::Alpha, node->m_brush.m_tip_flow);
|
||||
auto tip_color = glm::vec4(glm::vec3(node->m_brush.m_tip_color), 1);
|
||||
ui::ShaderManager::u_vec4(ui::kShaderUniform::Col, tip_color);
|
||||
ui::ShaderManager::u_int(ui::kShaderUniform::Highlight, 0);
|
||||
float tip_scale = 1.f / glm::tan(glm::radians(ui::Canvas::I->m_cam_fov * 0.5f));
|
||||
ui::ShaderManager::u_mat4(ui::kShaderUniform::MVP,
|
||||
glm::scale(glm::vec3(1, -1, 1)) *
|
||||
ortho *
|
||||
glm::translate(glm::vec3(m_cur_pos, 0)) *
|
||||
glm::scale(glm::vec3(node->m_brush.m_tip_size * 800.f * tip_scale))
|
||||
);
|
||||
glEnable(GL_BLEND);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
auto& tex = TextureManager::get(node->m_brush.m_tex_id);
|
||||
tex.bind();
|
||||
canvas->m_sampler_brush.bind(0);
|
||||
canvas->m_plane.draw_fill();
|
||||
tex.unbind();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CanvasModePen::leave()
|
||||
{
|
||||
m_brush = node->m_brush;
|
||||
|
||||
Reference in New Issue
Block a user