implement stencil from file

This commit is contained in:
2019-01-15 23:54:08 +01:00
parent f5c4aed4fd
commit 9c93747b17
9 changed files with 26 additions and 7 deletions

View File

@@ -290,7 +290,7 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
m_sampler.bind(0);
m_sampler.bind(1);
m_sampler.bind(2);
auto& paper = TextureManager::get(const_hash("data/paper.jpg"));
auto& paper = TextureManager::get(m_current_stroke->m_brush.m_tex_stencil_id);
ShaderManager::use(kShader::CompDraw);
ShaderManager::u_int(kShaderUniform::Tex, 0);
//ShaderManager::u_int(kShaderUniform::TexA, 0);
@@ -346,7 +346,7 @@ void Canvas::stroke_draw()
auto m_brush = m_current_stroke->m_brush;
auto samples = m_current_stroke->compute_samples();
auto& tex = TextureManager::get(m_brush.m_tex_id);
auto& stencil = TextureManager::get(const_hash("data/paper.jpg"));
auto& stencil = TextureManager::get(m_brush.m_tex_stencil_id);
auto ortho_proj = glm::ortho(0.f, (float)m_width, 0.f, (float)m_height, -1.f, 1.f);
std::vector<vertex_t> B{
@@ -832,7 +832,7 @@ void Canvas::stroke_commit()
}
else
{
auto& paper = TextureManager::get(const_hash("data/paper.jpg"));
auto& paper = TextureManager::get(m_current_stroke->m_brush.m_tex_stencil_id);
ShaderManager::use(kShader::CompDraw);
ShaderManager::u_int(kShaderUniform::Tex, 0);