enable rtt dtor, default values for <text> node, dual-brush wip, more brush options
This commit is contained in:
@@ -124,7 +124,7 @@ void CanvasModePen::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
||||
}
|
||||
else
|
||||
{
|
||||
Canvas::I->stroke_start({ loc, 0 }, me->m_pressure, Canvas::I->m_current_brush);
|
||||
Canvas::I->stroke_start({ loc, 0 }, me->m_pressure);
|
||||
}
|
||||
m_dragging = true;
|
||||
node->mouse_capture();
|
||||
@@ -203,22 +203,26 @@ void CanvasModePen::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const
|
||||
{
|
||||
if (m_draw_tip)
|
||||
{
|
||||
const auto& brush = Canvas::I->m_current_brush;
|
||||
auto pos = m_resizing ? m_size_pos_start : m_cur_pos;
|
||||
if (App::I.keys[(int)kKey::KeyAlt] && !m_resizing)
|
||||
pos.x = pos.x - Canvas::I->m_current_brush->m_tip_size * 500.f;
|
||||
pos.x = pos.x - brush->m_tip_size * 500.f;
|
||||
ShaderManager::use(kShader::StrokePreview);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
float tip_scale_fix = 1.f / glm::tan(glm::radians(Canvas::I->m_cam_fov * 0.5f));
|
||||
float tip_scale = Canvas::I->m_current_brush->m_tip_size * 800.f * tip_scale_fix;
|
||||
float tip_angle = Canvas::I->m_current_brush->m_tip_angle * (float)(M_PI * 2.0);
|
||||
float tip_angle = brush->m_tip_angle * (float)(M_PI * 2.0);
|
||||
glm::vec2 tip_scale = glm::vec2(brush->m_tip_size * 800.f * tip_scale_fix) *
|
||||
glm::vec2(brush->m_tip_flipx ? -1 : 1, brush->m_tip_flipy ? -1.f : 1.f) *
|
||||
glm::vec2((brush->m_tip_aspect <= 0.5 ? brush->m_tip_aspect * 2.f : 1.f),
|
||||
(brush->m_tip_aspect > 0.5 ? 1.f - (brush->m_tip_aspect - .5f) * 2.f : 1.f));
|
||||
glm::vec2 tip_offset = glm::vec2(0);
|
||||
auto tip_color = glm::vec4(glm::vec3(Canvas::I->m_current_brush->m_tip_color), 1);
|
||||
auto tip_color = glm::vec4(glm::vec3(brush->m_tip_color), 1.f);
|
||||
if (Canvas::I->m_current_stroke)
|
||||
{
|
||||
const auto& s = Canvas::I->m_current_stroke->m_prev_sample;
|
||||
if (s.size > 0.f)
|
||||
{
|
||||
tip_scale = s.size;
|
||||
tip_scale = (brush->m_tip_size * 800.f * tip_scale_fix) * s.scale;
|
||||
tip_angle = s.angle;
|
||||
tip_offset = s.pos - s.origin;
|
||||
tip_color = glm::vec4(s.col, s.flow);
|
||||
@@ -229,13 +233,13 @@ void CanvasModePen::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const
|
||||
glm::scale(glm::vec3(1, -1, 1)) *
|
||||
ortho *
|
||||
glm::translate(glm::vec3(pos + tip_offset, 0)) *
|
||||
glm::scale(glm::vec3(tip_scale)) *
|
||||
glm::eulerAngleZ(tip_angle)
|
||||
glm::eulerAngleZ(tip_angle) *
|
||||
glm::scale(glm::vec3(tip_scale, 1))
|
||||
);
|
||||
bool blend = glIsEnabled(GL_BLEND);
|
||||
glEnable(GL_BLEND);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
auto& tex = *Canvas::I->m_current_brush->m_tip_texture;
|
||||
auto& tex = *brush->m_tip_texture;
|
||||
tex.bind();
|
||||
Canvas::I->m_sampler_brush.bind(0);
|
||||
Canvas::I->m_plane.draw_fill();
|
||||
@@ -281,7 +285,7 @@ void CanvasModeLine::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
||||
node->mouse_release();
|
||||
if (m_dragging)
|
||||
{
|
||||
Canvas::I->stroke_start({ m_drag_start, 0 }, 1.f, Canvas::I->m_current_brush);
|
||||
Canvas::I->stroke_start({ m_drag_start, 0 }, 1.f);
|
||||
Canvas::I->stroke_update({ m_drag_pos, 0 }, 1.f);
|
||||
Canvas::I->stroke_end();
|
||||
}
|
||||
@@ -1156,6 +1160,7 @@ void CanvasModeTransform::leave()
|
||||
ShaderManager::u_int(kShaderUniform::UseFragCoordUV2, true);
|
||||
ShaderManager::u_vec2(kShaderUniform::Resolution, Canvas::I->m_size);
|
||||
ShaderManager::u_int(kShaderUniform::BlendMode, 0);
|
||||
ShaderManager::u_int(kShaderUniform::UseDual, false);
|
||||
|
||||
Canvas::I->m_sampler_bg.bind(1);
|
||||
Canvas::I->m_sampler_bg.bind(0);
|
||||
|
||||
Reference in New Issue
Block a user