remove ui namespace which is not really used, move CameraData in camera_modes.h to avoid the inclusion of canva.h
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#include "log.h"
|
||||
#include "brush.h"
|
||||
|
||||
void ui::BrushMesh::draw(const std::vector<StrokeSample>& samples, const glm::mat4& proj)
|
||||
void BrushMesh::draw(const std::vector<StrokeSample>& samples, const glm::mat4& proj)
|
||||
{
|
||||
std::vector<instance_t> attributes;
|
||||
attributes.reserve(samples.size());
|
||||
@@ -65,7 +65,7 @@ void ui::BrushMesh::draw(const std::vector<StrokeSample>& samples, const glm::ma
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
#endif // USE_VBO
|
||||
}
|
||||
bool ui::BrushMesh::create()
|
||||
bool BrushMesh::create()
|
||||
{
|
||||
static GLushort idx[6]{ 0, 1, 2, 0, 2, 3 };
|
||||
static vertex_t vertices[4]{
|
||||
@@ -126,7 +126,7 @@ bool ui::BrushMesh::create()
|
||||
|
||||
return true;
|
||||
}
|
||||
ui::StrokeSample ui::Stroke::randomize_sample(const glm::vec3& pos, float pressure, float curve_angle)
|
||||
StrokeSample Stroke::randomize_sample(const glm::vec3& pos, float pressure, float curve_angle)
|
||||
{
|
||||
auto rnd_nor = [&] { return float((double)prng() / (double)prng.max()); }; // normalized [0, +1]
|
||||
//auto rnd_neg = [&] { return float((double)prng() / (double)prng.max() * 2.0 - 1.0); }; // normalized [-1, +1]
|
||||
@@ -150,7 +150,7 @@ ui::StrokeSample ui::Stroke::randomize_sample(const glm::vec3& pos, float pressu
|
||||
s.col = convert_hsv2rgb(m_hsv_jitter.average());
|
||||
return s;
|
||||
}
|
||||
std::vector<ui::StrokeSample> ui::Stroke::compute_samples()
|
||||
std::vector<StrokeSample> Stroke::compute_samples()
|
||||
{
|
||||
if (m_keypoints.empty()) return {};
|
||||
int nsamples = (int)glm::floor((m_keypoints.back().dist - m_dist) / m_step);
|
||||
@@ -188,19 +188,19 @@ std::vector<ui::StrokeSample> ui::Stroke::compute_samples()
|
||||
}
|
||||
return samples;
|
||||
}
|
||||
bool ui::Stroke::has_sample()
|
||||
bool Stroke::has_sample()
|
||||
{
|
||||
return m_keypoints.empty() ? false : // no keypoints
|
||||
(m_keypoints.back().dist > (m_dist + m_step)); // check if next kp is closer than spacing
|
||||
}
|
||||
void ui::Stroke::reset(bool clear_keypoints /*= false*/)
|
||||
void Stroke::reset(bool clear_keypoints /*= false*/)
|
||||
{
|
||||
m_last_kp = 0;
|
||||
m_dist = 0.f;
|
||||
if (clear_keypoints)
|
||||
m_keypoints.clear();
|
||||
}
|
||||
void ui::Stroke::add_point(glm::vec3 pos, float pressure)
|
||||
void Stroke::add_point(glm::vec3 pos, float pressure)
|
||||
{
|
||||
#ifdef __IOS__
|
||||
m_curve = glm::min(m_curve + 0.1f, 1.f);
|
||||
@@ -229,7 +229,7 @@ void ui::Stroke::add_point(glm::vec3 pos, float pressure)
|
||||
kp.dist = dist;
|
||||
m_keypoints.push_back(kp);
|
||||
}
|
||||
void ui::Stroke::start(const ui::Brush& brush)
|
||||
void Stroke::start(const Brush& brush)
|
||||
{
|
||||
m_hold_points.clear();
|
||||
m_curve = 0.f;
|
||||
|
||||
Reference in New Issue
Block a user