implement motion controllers and vr drawing with brush preview

This commit is contained in:
2018-11-02 13:49:15 +01:00
parent 3b73e84fe9
commit 3ee10bb88d
13 changed files with 202 additions and 46 deletions

View File

@@ -42,8 +42,8 @@ public:
struct StrokeSample
{
glm::vec3 col = { 0, 0, 0 };
glm::vec2 pos = { 0, 0 };
glm::vec2 origin = { 0,0 };
glm::vec3 pos = { 0, 0, 0 };
glm::vec3 origin = { 0, 0, 0 };
float size = 0;
float flow = 0;
float angle = 0;
@@ -76,7 +76,7 @@ class Stroke
public:
struct Keypoint
{
glm::vec2 pos = { 0, 0 };
glm::vec3 pos = { 0, 0, 0 };
float pressure = 0;
float dist = 0;
};
@@ -96,16 +96,16 @@ public:
cbuffer<glm::vec3, 3> m_hsv_jitter;
StrokeSample m_prev_sample;
std::vector<Keypoint> m_keypoints;
std::vector<std::pair<glm::vec2, float>> m_hold_points;
std::vector<std::pair<glm::vec3, float>> m_hold_points;
std::vector<StrokeSample> m_samples;
int m_last_kp;
std::minstd_rand prng;
void start(const ui::Brush& brush);
void add_point(glm::vec2 pos, float pressure);
void add_point(glm::vec3 pos, float pressure);
void reset(bool clear_keypoints = false);
bool has_sample();
std::vector<StrokeSample> compute_samples();
StrokeSample randomize_sample(const glm::vec2& pos, float pressure, float curve_angle);
StrokeSample randomize_sample(const glm::vec3& pos, float pressure, float curve_angle);
};
NS_END