implement brush presets save and restore from file, fix stencil nullptr, limit preview stroke max size

This commit is contained in:
2019-01-23 16:53:58 +01:00
parent e26fcf1163
commit 879be9d4fe
17 changed files with 282 additions and 65 deletions

View File

@@ -68,6 +68,7 @@ void NodeStrokePreview::draw_stroke()
glm::mat4 proj = glm::ortho<float>(0, (float)m_rtt.getWidth(), 0, (float)m_rtt.getHeight(), -1, 1);
const auto& b = m_brush;
m_stroke.m_max_size = 0.1f;
m_stroke.m_camera.fov = Canvas::I->m_cam_fov;
m_stroke.m_camera.rot = Canvas::I->m_cam_rot;
m_stroke.reset();
@@ -80,9 +81,11 @@ void NodeStrokePreview::draw_stroke()
tex.bind();
m_sampler_brush.bind(0);
auto& stencil = *b->m_stencil_texture;
glActiveTexture(GL_TEXTURE1);
stencil.bind();
if (b->m_stencil_texture)
b->m_stencil_texture->bind();
else
glBindTexture(GL_TEXTURE_2D, 0);
m_sampler.bind(1);
if (true)
@@ -138,6 +141,9 @@ void NodeStrokePreview::draw()
void NodeStrokePreview::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
{
if (old_size == new_size)
return;
float pad = 30.f;
new_size *= root()->m_zoom;
float w = new_size.x;