fix pressure spacing, blend mode preview
This commit is contained in:
@@ -291,7 +291,7 @@ void Stroke::add_point(glm::vec3 pos, float pressure)
|
||||
float aspect_width = glm::min(1.f, glm::clamp(m_brush->m_tip_aspect, .1f, .9f) * 2.f);
|
||||
float raw_size = glm::clamp(m_brush->m_tip_size / glm::tan(glm::radians(m_camera.fov * 0.5f)), 1.f, m_max_size);
|
||||
float size = aspect_width * glm::min(m_brush->m_tip_scale.x, m_brush->m_tip_scale.y) * raw_size;
|
||||
m_step = glm::max(0.5f, m_brush->m_tip_spacing * size * App::I.zoom);
|
||||
m_step = glm::max(0.5f, m_brush->m_tip_spacing * size * App::I.zoom * pressure);
|
||||
}
|
||||
|
||||
float dist = m_keypoints.empty() ? m_step :
|
||||
|
||||
@@ -20,6 +20,8 @@ void NodeCanvas::init()
|
||||
m_sampler.create();
|
||||
m_sampler.set_filter(GL_LINEAR, GL_NEAREST);
|
||||
|
||||
m_sampler_nearest.create(GL_NEAREST);
|
||||
|
||||
m_sampler_linear.create(GL_LINEAR);
|
||||
m_sampler_stencil.create(GL_LINEAR, GL_REPEAT);
|
||||
m_face_plane.create<1>(2, 2);
|
||||
@@ -493,7 +495,7 @@ void NodeCanvas::draw()
|
||||
glViewport(c.x + App::I.off_x, c.y + App::I.off_y, c.z, c.w);
|
||||
|
||||
// draw the canvas
|
||||
m_sampler_linear.bind(0);
|
||||
m_sampler_nearest.bind(0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
m_rtt.bindTexture();
|
||||
ShaderManager::use(kShader::Texture);
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
Texture2D m_blender_bg;
|
||||
Sampler m_sampler;
|
||||
Sampler m_sampler_linear;
|
||||
Sampler m_sampler_nearest;
|
||||
Sampler m_sampler_stencil;
|
||||
Plane m_face_plane;
|
||||
LineSegment m_line;
|
||||
|
||||
@@ -415,7 +415,10 @@ void NodeStrokePreview::draw_stroke_immediate()
|
||||
}
|
||||
|
||||
ShaderManager::use(kShader::Stroke);
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, { 0, 0, 0, 1 } /*f.col*/);
|
||||
if (b->m_blend_mode != 0)
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, { .7, .4, .1, 1 } /*f.col*/);
|
||||
else
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, { 0, 0, 0, 1 } /*f.col*/);
|
||||
ShaderManager::u_float(kShaderUniform::Alpha, glm::max(f.flow, m_min_flow));
|
||||
ShaderManager::u_float(kShaderUniform::Opacity, f.opacity);
|
||||
/*auto rect =*/ stroke_draw_samples(f.shapes, m_tex);
|
||||
@@ -505,6 +508,10 @@ void NodeStrokePreview::draw_stroke()
|
||||
s_renderer = std::thread([] {
|
||||
BT_SetTerminate();
|
||||
#if __OSX__
|
||||
// There's some weird multithread bug at startup
|
||||
// This random wait is a temp fix
|
||||
// Today is 25/05/2019
|
||||
// Good luck, future Omar
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
#endif
|
||||
App::I.async_start();
|
||||
|
||||
Reference in New Issue
Block a user