rename texture to pattern and implement initial pattern settings

This commit is contained in:
2019-02-17 23:41:17 +01:00
parent 49d9b17719
commit e4ee87e4c6
16 changed files with 379 additions and 232 deletions

View File

@@ -291,7 +291,7 @@ void Stroke::start(const std::shared_ptr<Brush>& brush)
prng.seed(0);
}
bool Brush::load_texture(const std::string& path, const std::string& thumb)
bool Brush::load_tip(const std::string& path, const std::string& thumb)
{
m_tip_texture = std::make_shared<Texture2D>();
if (!m_tip_texture->load(path))
@@ -315,15 +315,15 @@ bool Brush::load_dual(const std::string& path, const std::string& thumb)
return true;
}
bool Brush::load_stencil(const std::string& path, const std::string& thumb)
bool Brush::load_pattern(const std::string& path, const std::string& thumb)
{
m_stencil_texture = std::make_shared<Texture2D>();
if (!m_stencil_texture->load(path))
m_pattern_texture = std::make_shared<Texture2D>();
if (!m_pattern_texture->load(path))
return false;
m_stencil_texture->create_mipmaps();
m_stencil_texture->auto_destroy = true;
m_stencil_path = path;
m_stencil_thumb_path = thumb;
m_pattern_texture->create_mipmaps();
m_pattern_texture->auto_destroy = true;
m_pattern_path = path;
m_texture_thumb_path = thumb;
return true;
}
@@ -354,19 +354,19 @@ bool Brush::load()
m_dual_texture->create_mipmaps();
m_dual_texture->auto_destroy = true;
}
if (!m_stencil_path.empty())
if (!m_pattern_path.empty())
{
m_stencil_texture = std::make_shared<Texture2D>();
if (!m_stencil_texture->load(m_stencil_path))
m_pattern_texture = std::make_shared<Texture2D>();
if (!m_pattern_texture->load(m_pattern_path))
{
LOG("failed to load %s", m_stencil_path.c_str());
LOG("failed to load %s", m_pattern_path.c_str());
m_tip_texture = nullptr;
m_dual_texture = nullptr;
m_stencil_texture = nullptr;
m_pattern_texture = nullptr;
return false;
}
m_stencil_texture->create_mipmaps();
m_stencil_texture->auto_destroy = true;
m_pattern_texture->create_mipmaps();
m_pattern_texture->auto_destroy = true;
}
return true;
}