46 coba->
data[0].
r = 0.0;
47 coba->
data[0].
g = 0.0;
48 coba->
data[0].
b = 0.0;
49 coba->
data[0].
a = 0.0;
51 coba->
data[1].
r = 1.0;
52 coba->
data[1].
g = 1.0;
53 coba->
data[1].
b = 1.0;
54 coba->
data[1].
a = 1.0;
57 coba->
data[0].
r = 0.0;
58 coba->
data[0].
g = 0.0;
59 coba->
data[0].
b = 0.0;
60 coba->
data[0].
a = 1.0;
62 coba->
data[1].
r = 1.0;
63 coba->
data[1].
g = 1.0;
64 coba->
data[1].
b = 1.0;
65 coba->
data[1].
a = 1.0;
83 const float (*
array)[4],
87 const float eps = (1.0f / 255.0f) + 1e-6f;
91 const float step_size = 1.0f / (
float)
max_ii(stops - 1, 1);
93 for (
int i_step = 0; i_step < stops; i_step++) {
99 coba->
data[i_curr].
pos = i_step * step_size;
100 coba->
data[i_curr].
cur = i_curr;
102 coba->
tot = i_curr + 1;
108 coba->
data[0].
a = 1.0f;
140 float xy_prev[2], xy_curr[2], xy_next[2];
141 xy_prev[0] =
c->prev->pos;
143 xy_next[0] =
c->next->pos;
144 for (
int i = 0; i < 4; i++) {
145 xy_prev[1] =
c->prev->rgba[i];
146 xy_curr[1] =
c->rgba[i];
147 xy_next[1] =
c->next->rgba[i];
152 const float xpc =
c->prev->pos -
c->pos;
153 const float xnc =
c->next->pos -
c->pos;
154 for (
int i = 0; i < 4; i++) {
155 const float ycn =
c->rgba[i] -
c->next->rgba[i];
156 const float ypc =
c->prev->rgba[i] -
c->rgba[i];
157 area +=
fabsf((xpc * ycn) + (ypc * xnc));
166 const float gaussfac = 1.6f;
167 const float two_gaussfac2 = 2.0f * gaussfac * gaussfac;
168 x *= 3.0f * gaussfac;
169 return 1.0f /
sqrtf((
float)
M_PI * two_gaussfac2) *
expf(-
x *
x / two_gaussfac2);
173 const float (*
array)[4],
178 const float eps_2x = ((1.0f / 255.0f) + 1e-6f);
180 int carr_len = array_len;
183 const float step_size = 1.0f / (
float)(array_len - 1);
184 for (
int i = 0; i < array_len; i++,
c++) {
188 c->pos = i * step_size;
197 for (
int i = 0; i < array_len; i++,
c++) {
211 c_prev->next = c_next;
212 c_next->
prev = c_prev;
218 for (
int i = 0; i < 2; i++) {
238 if (filter_samples ==
false) {
239 for (
c = carr;
c !=
NULL;
c =
c->next, i++) {
246 for (
c = carr;
c !=
NULL;
c =
c->next, i++) {
247 const int steps_prev =
c->prev ? (
c -
c->prev) - 1 : 0;
248 const int steps_next =
c->next ? (
c->next -
c) - 1 : 0;
249 if (steps_prev == 0 && steps_next == 0) {
254 float rgba_accum = 1;
258 const float step_size = 1.0 / (
float)(steps_prev + 1);
261 const float step_pos = (
float)j * step_size;
262 BLI_assert(step_pos > 0.0f && step_pos < 1.0f);
269 const float step_size = 1.0 / (
float)(steps_next + 1);
272 const float step_pos = (
float)j * step_size;
273 BLI_assert(step_pos > 0.0f && step_pos < 1.0f);
294 const float (*
array)[4],
325 const int ipotype_hue,
const float mfac,
const float fac,
float h1,
float h2)
330 #define HUE_INTERP(h_a, h_b) ((mfac * (h_a)) + (fac * (h_b)))
331 #define HUE_MOD(h) (((h) < 1.0f) ? (h) : (h)-1.0f)
339 switch (ipotype_hue) {
341 if ((h1 < h2) && (h2 - h1) > +0.5f) {
344 else if ((h1 > h2) && (h2 - h1) < -0.5f) {
357 else if ((h1 < h2) && (h2 - h1) < +0.5f) {
360 else if ((h1 > h2) && (h2 - h1) > -0.5f) {
402 BLI_assert(h_interp >= 0.0f && h_interp < 1.0f);
412 const CBData *cbd1, *cbd2, *cbd0, *cbd3;
417 if (coba ==
NULL || coba->
tot == 0) {
428 if (coba->
tot == 1) {
434 else if ((in <= cbd1->
pos) &&
446 for (
a = 0;
a < coba->
tot;
a++, cbd1++) {
447 if (cbd1->
pos > in) {
452 if (
a == coba->
tot) {
467 if ((
a == coba->
tot) &&
483 if (cbd2->
pos != cbd1->
pos) {
484 fac = (in - cbd1->
pos) / (cbd2->
pos - cbd1->
pos);
489 fac = (
a != coba->
tot) ? 0.0f : 1.0f;
496 if (
a >= coba->
tot - 1) {
509 CLAMP(fac, 0.0f, 1.0f);
518 out[0] =
t[3] * cbd3->
r +
t[2] * cbd2->
r +
t[1] * cbd1->
r +
t[0] * cbd0->
r;
519 out[1] =
t[3] * cbd3->
g +
t[2] * cbd2->
g +
t[1] * cbd1->
g +
t[0] * cbd0->
g;
520 out[2] =
t[3] * cbd3->
b +
t[2] * cbd2->
b +
t[1] * cbd1->
b +
t[0] * cbd0->
b;
521 out[3] =
t[3] * cbd3->
a +
t[2] * cbd2->
a +
t[1] * cbd1->
a +
t[0] * cbd0->
a;
526 const float fac2 = fac * fac;
527 fac = 3.0f * fac2 - 2.0f * fac2 * fac;
529 const float mfac = 1.0f - fac;
532 float col1[3], col2[3];
538 out[1] = mfac * col1[1] + fac * col2[1];
539 out[2] = mfac * col1[2] + fac * col2[2];
540 out[3] = mfac * cbd1->
a + fac * cbd2->
a;
545 float col1[3], col2[3];
551 out[1] = mfac * col1[1] + fac * col2[1];
552 out[2] = mfac * col1[2] + fac * col2[2];
553 out[3] = mfac * cbd1->
a + fac * cbd2->
a;
559 out[0] = mfac * cbd1->
r + fac * cbd2->
r;
560 out[1] = mfac * cbd1->
g + fac * cbd2->
g;
561 out[2] = mfac * cbd1->
b + fac * cbd2->
b;
562 out[3] = mfac * cbd1->
a + fac * cbd2->
a;
587 if (x1->
pos >
x2->pos) {
590 if (x1->
pos <
x2->pos) {
604 for (
a = 0;
a < coba->
tot;
a++) {
610 for (
a = 0;
a < coba->
tot;
a++) {
627 xnew->
pos = position;
629 if (coba->
tot != 0) {
637 coba->
cur = coba->
tot - 1;
650 if (index < 0 || index >= coba->
tot) {
655 for (
int a = index;
a < coba->
tot;
a++) {
typedef float(TangentPoint)[2]
void key_curve_position_weights(float t, float data[4], int type)
General operations, lookup, etc. for materials.
A min-heap / priority queue ADT.
void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
Heap * BLI_heap_new_ex(unsigned int tot_reserve) ATTR_WARN_UNUSED_RESULT
void void bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1)
void * BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1)
float BLI_heap_top_value(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_heap_node_value_update(Heap *heap, HeapNode *node, float value) ATTR_NONNULL(1
HeapNode * BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1)
void void BLI_heap_remove(Heap *heap, HeapNode *node) ATTR_NONNULL(1
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
void hsl_to_rgb_v(const float hsl[3], float r_rgb[3])
void rgb_to_hsl_v(const float rgb[3], float r_hsl[3])
MINLINE float cross_tri_v2(const float v1[2], const float v2[2], const float v3[2])
MINLINE void mul_v4_v4fl(float r[3], const float a[4], float f)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void zero_v4(float r[4])
MINLINE void clamp_v4(float vec[4], const float min, const float max)
MINLINE bool compare_v4v4(const float a[4], const float b[4], const float limit) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f)
MINLINE void zero_v3(float r[3])
@ COLBAND_INTERP_CONSTANT
@ COLBAND_INTERP_B_SPLINE
@ COLBAND_INTERP_CARDINAL
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
bool BKE_colorband_element_remove(struct ColorBand *coba, int index)
void BKE_colorband_evaluate_table_rgba(const ColorBand *coba, float **array, int *size)
ColorBand * BKE_colorband_add(bool rangetype)
void BKE_colorband_init_from_table_rgba(ColorBand *coba, const float(*array)[4], const int array_len, bool filter_samples)
static float colorband_hue_interp(const int ipotype_hue, const float mfac, const float fac, float h1, float h2)
static void colorband_init_from_table_rgba_resample(ColorBand *coba, const float(*array)[4], const int array_len, bool filter_samples)
void BKE_colorband_update_sort(ColorBand *coba)
bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
#define HUE_INTERP(h_a, h_b)
static float color_sample_remove_cost(const struct ColorResampleElem *c)
static float filter_gauss(float x)
void BKE_colorband_init(ColorBand *coba, bool rangetype)
static int vergcband(const void *a1, const void *a2)
static void colorband_init_from_table_rgba_simple(ColorBand *coba, const float(*array)[4], const int array_len)
CBData * BKE_colorband_element_add(struct ColorBand *coba, float position)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
struct ColorResampleElem * next
struct ColorResampleElem * prev