add support for high res brush textures, implement mipmaps on brush
This commit is contained in:
@@ -30,6 +30,7 @@ void NodeStrokePreview::init_controls()
|
||||
{
|
||||
m_mesh.create();
|
||||
m_sampler.create();
|
||||
m_sampler_brush.create(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
|
||||
TextureManager::load("data/Icons/Round-Hard.png");
|
||||
m_brush.m_tex_id = const_hash("data/Icons/Round-Hard.png");
|
||||
}
|
||||
@@ -66,7 +67,7 @@ void NodeStrokePreview::draw_stroke()
|
||||
glm::mat4 proj = glm::ortho<float>(0, (float)m_rtt.getWidth(), 0, (float)m_rtt.getHeight(), -1, 1);
|
||||
|
||||
auto b = m_brush;
|
||||
b.m_tip_size *= .7f; // reduce the size in the preview
|
||||
//b.m_tip_size *= .7f; // reduce the size in the preview
|
||||
m_stroke.reset();
|
||||
m_stroke.start(b);
|
||||
if (!m_stroke.m_keypoints.empty())
|
||||
@@ -74,7 +75,7 @@ void NodeStrokePreview::draw_stroke()
|
||||
auto samples = m_stroke.compute_samples();
|
||||
auto& tex = TextureManager::get(m_brush.m_tex_id);
|
||||
tex.bind();
|
||||
m_sampler.bind(0);
|
||||
m_sampler_brush.bind(0);
|
||||
|
||||
if (true)
|
||||
{
|
||||
@@ -100,7 +101,7 @@ void NodeStrokePreview::draw_stroke()
|
||||
// }
|
||||
//}
|
||||
|
||||
m_sampler.unbind();
|
||||
m_sampler_brush.unbind();
|
||||
tex.unbind();
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
@@ -126,6 +127,7 @@ void NodeStrokePreview::draw()
|
||||
void NodeStrokePreview::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
|
||||
{
|
||||
float pad = 30.f;
|
||||
new_size *= root()->m_zoom;
|
||||
float w = new_size.x;
|
||||
float h = new_size.y;
|
||||
std::vector<glm::vec2> kp = { { pad, pad },{ pad, h - pad },{ w - pad, pad },{ w - pad, h - pad } };
|
||||
|
||||
Reference in New Issue
Block a user