add abr color dynamics

This commit is contained in:
2019-03-07 00:53:45 +01:00
parent 3296de98cc
commit 5329147d58
14 changed files with 78 additions and 31 deletions

View File

@@ -54,6 +54,7 @@ public:
float m_jitter_hue = 0;
float m_jitter_sat = 0;
float m_jitter_val = 0;
bool m_jitter_hsv_eachsample = false;
float m_jitter_aspect = 0;
bool m_jitter_aspect_bothaxis = false;
int m_blend_mode = 0;
@@ -172,6 +173,7 @@ public:
float m_step = 0;
float m_max_size = FLT_MAX;
bool m_filter_points = true;
glm::vec3 m_tip_color;
Camera m_camera;
std::shared_ptr<Brush> m_brush;
cbuffer<float> m_direction{ 1 };
@@ -182,11 +184,18 @@ public:
std::vector<std::pair<glm::vec3, float>> m_hold_points;
std::vector<StrokeSample> m_samples;
int m_last_kp;
std::minstd_rand prng;
std::mt19937 prng;
void start(const std::shared_ptr<Brush>& brush);
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::vec3& pos, float pressure, float curve_angle);
void randomize_prng();
float rnd_nor() { return float((double)prng() / (double)prng.max()); }; // normalized [0, +1]
float rnd_neg() { return float((double)prng() / (double)prng.max() * 2.0 - 1.0); }; // normalized [-1, +1]
float rnd_rad() { return float((double)prng() / (double)prng.max() * M_PI * 2.0); }; // normalized [0, 2pi]
glm::vec3 rnd_vec() { float rad = rnd_rad(); return glm::vec3(cosf(rad), sinf(rad), 0); }; // normalized direction vector
float rnd_bneg() { return prng() % 2 == 0 ? -1.f : 1.f; }; // -1 or 1
};