implement motion controllers and vr drawing with brush preview
This commit is contained in:
@@ -9,7 +9,7 @@ void ui::BrushMesh::draw(const std::vector<StrokeSample>& samples, const glm::ma
|
||||
for (const auto& s : samples)
|
||||
{
|
||||
auto mvp = proj *
|
||||
glm::translate(glm::vec3(s.pos, 0)) *
|
||||
glm::translate(s.pos) *
|
||||
glm::scale(glm::vec3(s.size, s.size, 1)) *
|
||||
glm::eulerAngleZ(s.angle);
|
||||
attributes.emplace_back(instance_t{ mvp, s.flow });
|
||||
@@ -126,12 +126,12 @@ bool ui::BrushMesh::create()
|
||||
|
||||
return true;
|
||||
}
|
||||
ui::StrokeSample ui::Stroke::randomize_sample(const glm::vec2& pos, float pressure, float curve_angle)
|
||||
ui::StrokeSample ui::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]
|
||||
auto rnd_rad = [&] { return float((double)prng() / (double)prng.max() * M_PI * 2.0); }; // normalized [0, 2pi]
|
||||
auto rnd_vec = [&] { float rad = rnd_rad(); return glm::vec2(cosf(rad), sinf(rad)); }; // normalized direction vector
|
||||
auto rnd_vec = [&] { float rad = rnd_rad(); return glm::vec3(cosf(rad), sinf(rad), 0); }; // normalized direction vector
|
||||
|
||||
float size_dyn = m_brush.m_tip_size_pressure ? pressure : 1.f;
|
||||
float flow_dyn = m_brush.m_tip_flow_pressure ? pressure : 1.f;
|
||||
@@ -200,7 +200,7 @@ void ui::Stroke::reset(bool clear_keypoints /*= false*/)
|
||||
if (clear_keypoints)
|
||||
m_keypoints.clear();
|
||||
}
|
||||
void ui::Stroke::add_point(glm::vec2 pos, float pressure)
|
||||
void ui::Stroke::add_point(glm::vec3 pos, float pressure)
|
||||
{
|
||||
#ifdef __IOS__
|
||||
m_curve = glm::min(m_curve + 0.1f, 1.f);
|
||||
|
||||
Reference in New Issue
Block a user