Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/brush.c
| Show First 20 Lines • Show All 1,498 Lines • ▼ Show 20 Lines | void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2]) | ||||
| float spread; | float spread; | ||||
| int diameter; | int diameter; | ||||
| do { | do { | ||||
| rand_pos[0] = BLI_rng_get_float(brush_rng) - 0.5f; | rand_pos[0] = BLI_rng_get_float(brush_rng) - 0.5f; | ||||
| rand_pos[1] = BLI_rng_get_float(brush_rng) - 0.5f; | rand_pos[1] = BLI_rng_get_float(brush_rng) - 0.5f; | ||||
| } while (len_squared_v2(rand_pos) > SQUARE(0.5f)); | } while (len_squared_v2(rand_pos) > SQUARE(0.5f)); | ||||
| if (brush->flag & BRUSH_ABSOLUTE_JITTER) { | if (brush->jitter_unit == BRUSH_ABSOLUTE_JITTER) { | ||||
| diameter = 2 * brush->jitter_absolute; | diameter = 2 * brush->jitter_absolute; | ||||
| spread = 1.0; | spread = 1.0; | ||||
| } | } | ||||
| else { | else { | ||||
| diameter = 2 * BKE_brush_size_get(scene, brush); | diameter = 2 * BKE_brush_size_get(scene, brush); | ||||
| spread = brush->jitter; | spread = brush->jitter; | ||||
| } | } | ||||
| /* find random position within a circle of diameter 1 */ | /* find random position within a circle of diameter 1 */ | ||||
| ▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines | |||||