Blender  V3.3
ColorBlock.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 /*
8  * This file is based on a similar file from the NVIDIA texture tools
9  * (http://nvidia-texture-tools.googlecode.com/)
10  *
11  * Original license from NVIDIA follows.
12  */
13 
14 /* This code is in the public domain - <castanyo@yahoo.es> */
15 
16 #include <ColorBlock.h>
17 #include <Common.h>
18 #include <Image.h>
19 
20 #if 0
21 /* Get approximate luminance. */
22 inline static uint colorLuminance(Color32 c)
23 {
24  return c.r + c.g + c.b;
25 }
26 
27 /* Get the euclidean distance between the given colors. */
28 inline static uint colorDistance(Color32 c0, Color32 c1)
29 {
30  return (c0.r - c1.r) * (c0.r - c1.r) + (c0.g - c1.g) * (c0.g - c1.g) +
31  (c0.b - c1.b) * (c0.b - c1.b);
32 }
33 #endif
34 
35 ColorBlock::ColorBlock(const uint *linearImage)
36 {
37  for (uint i = 0; i < 16; i++) {
38  color(i) = Color32(linearImage[i]);
39  }
40 }
41 
43 {
44  for (uint i = 0; i < 16; i++) {
45  color(i) = block.color(i);
46  }
47 }
48 
50 {
51  init(img, x, y);
52 }
53 
54 void ColorBlock::init(const Image *img, uint x, uint y)
55 {
56  init(img->width(), img->height(), (const uint *)img->pixels(), x, y);
57 }
58 
60 {
61  const uint bw = MIN(w - x, 4U);
62  const uint bh = MIN(h - y, 4U);
63 
64  /* Blocks that are smaller than 4x4 are handled by repeating the pixels.
65  * @@ That's only correct when block size is 1, 2 or 4, but not with 3. :(
66  * @@ Ideally we should zero the weights of the pixels out of range. */
67 
68  for (uint i = 0; i < 4; i++) {
69  const int by = i % bh;
70 
71  for (uint e = 0; e < 4; e++) {
72  const int bx = e % bw;
73  const uint idx = (y + by) * w + x + bx;
74 
75  color(e, i).u = data[idx];
76  }
77  }
78 }
79 
80 void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y)
81 {
82  const uint bw = MIN(w - x, 4U);
83  const uint bh = MIN(h - y, 4U);
84 
85  /* Blocks that are smaller than 4x4 are handled by repeating the pixels.
86  * @@ That's only correct when block size is 1, 2 or 4, but not with 3. :(
87  * @@ Ideally we should zero the weights of the pixels out of range. */
88 
89  uint srcPlane = w * h;
90 
91  for (uint i = 0; i < 4; i++) {
92  const uint by = i % bh;
93 
94  for (uint e = 0; e < 4; e++) {
95  const uint bx = e % bw;
96  const uint idx = ((y + by) * w + x + bx);
97 
98  Color32 &c = color(e, i);
99  /* @@ Is this the right way to quantize floats to bytes? */
100  c.r = uint8(255 * CLAMP(data[idx + 0 * srcPlane], 0.0f, 1.0f));
101  c.g = uint8(255 * CLAMP(data[idx + 1 * srcPlane], 0.0f, 1.0f));
102  c.b = uint8(255 * CLAMP(data[idx + 2 * srcPlane], 0.0f, 1.0f));
103  c.a = uint8(255 * CLAMP(data[idx + 3 * srcPlane], 0.0f, 1.0f));
104  }
105  }
106 }
107 
108 static inline uint8 component(Color32 c, uint i)
109 {
110  if (i == 0) {
111  return c.r;
112  }
113  if (i == 1) {
114  return c.g;
115  }
116  if (i == 2) {
117  return c.b;
118  }
119  if (i == 3) {
120  return c.a;
121  }
122  if (i == 4) {
123  return 0xFF;
124  }
125  return 0;
126 }
127 
129 {
130  for (Color32 &color : m_color) {
131  const Color32 c = color;
132  color.r = component(c, x);
133  color.g = component(c, y);
134  color.b = component(c, z);
135  color.a = component(c, w);
136  }
137 }
138 
139 bool ColorBlock::isSingleColor(Color32 mask /*= Color32(0xFF, 0xFF, 0xFF, 0x00) */) const
140 {
141  uint u = m_color[0].u & mask.u;
142 
143  for (int i = 1; i < 16; i++) {
144  if (u != (m_color[i].u & mask.u)) {
145  return false;
146  }
147  }
148 
149  return true;
150 }
151 
152 #if 0
154 bool ColorBlock::isSingleColorNoAlpha() const
155 {
156  Color32 c;
157  int i;
158  for (i = 0; i < 16; i++) {
159  if (m_color[i].a != 0) {
160  c = m_color[i];
161  }
162  }
163 
164  Color32 mask(0xFF, 0xFF, 0xFF, 0x00);
165  uint u = c.u & mask.u;
166 
167  for (; i < 16; i++) {
168  if (u != (m_color[i].u & mask.u)) {
169  return false;
170  }
171  }
172 
173  return true;
174 }
175 #endif
176 
177 #if 0
179 uint ColorBlock::countUniqueColors() const
180 {
181  uint count = 0;
182 
183  /* @@ This does not have to be o(n^2) */
184  for (int i = 0; i < 16; i++) {
185  bool unique = true;
186  for (int j = 0; j < i; j++) {
187  if (m_color[i] != m_color[j]) {
188  unique = false;
189  }
190  }
191 
192  if (unique) {
193  count++;
194  }
195  }
196 
197  return count;
198 }
199 #endif
200 
201 #if 0
203 Color32 ColorBlock::averageColor() const
204 {
205  uint r, g, b, a;
206  r = g = b = a = 0;
207 
208  for (uint i = 0; i < 16; i++) {
209  r += m_color[i].r;
210  g += m_color[i].g;
211  b += m_color[i].b;
212  a += m_color[i].a;
213  }
214 
215  return Color32(uint8(r / 16), uint8(g / 16), uint8(b / 16), uint8(a / 16));
216 }
217 #endif
218 
220 {
221  for (const auto &i : m_color) {
222  if (i.a != 255) {
223  return true;
224  }
225  }
226  return false;
227 }
228 
229 #if 0
230 
232 void ColorBlock::diameterRange(Color32 *start, Color32 *end) const
233 {
234  Color32 c0, c1;
235  uint best_dist = 0;
236 
237  for (int i = 0; i < 16; i++) {
238  for (int j = i + 1; j < 16; j++) {
239  uint dist = colorDistance(m_color[i], m_color[j]);
240  if (dist > best_dist) {
241  best_dist = dist;
242  c0 = m_color[i];
243  c1 = m_color[j];
244  }
245  }
246  }
247 
248  *start = c0;
249  *end = c1;
250 }
251 
253 void ColorBlock::luminanceRange(Color32 *start, Color32 *end) const
254 {
255  Color32 minColor, maxColor;
256  uint minLuminance, maxLuminance;
257 
258  maxLuminance = minLuminance = colorLuminance(m_color[0]);
259 
260  for (uint i = 1; i < 16; i++) {
261  uint luminance = colorLuminance(m_color[i]);
262 
263  if (luminance > maxLuminance) {
264  maxLuminance = luminance;
265  maxColor = m_color[i];
266  }
267  else if (luminance < minLuminance) {
268  minLuminance = luminance;
269  minColor = m_color[i];
270  }
271  }
272 
273  *start = minColor;
274  *end = maxColor;
275 }
276 
278 void ColorBlock::boundsRange(Color32 *start, Color32 *end) const
279 {
280  Color32 minColor(255, 255, 255);
281  Color32 maxColor(0, 0, 0);
282 
283  for (uint i = 0; i < 16; i++) {
284  if (m_color[i].r < minColor.r) {
285  minColor.r = m_color[i].r;
286  }
287  if (m_color[i].g < minColor.g) {
288  minColor.g = m_color[i].g;
289  }
290  if (m_color[i].b < minColor.b) {
291  minColor.b = m_color[i].b;
292  }
293  if (m_color[i].r > maxColor.r) {
294  maxColor.r = m_color[i].r;
295  }
296  if (m_color[i].g > maxColor.g) {
297  maxColor.g = m_color[i].g;
298  }
299  if (m_color[i].b > maxColor.b) {
300  maxColor.b = m_color[i].b;
301  }
302  }
303 
304  /* Offset range by 1/16 of the extents */
305  Color32 inset;
306  inset.r = (maxColor.r - minColor.r) >> 4;
307  inset.g = (maxColor.g - minColor.g) >> 4;
308  inset.b = (maxColor.b - minColor.b) >> 4;
309 
310  minColor.r = (minColor.r + inset.r <= 255) ? minColor.r + inset.r : 255;
311  minColor.g = (minColor.g + inset.g <= 255) ? minColor.g + inset.g : 255;
312  minColor.b = (minColor.b + inset.b <= 255) ? minColor.b + inset.b : 255;
313 
314  maxColor.r = (maxColor.r >= inset.r) ? maxColor.r - inset.r : 0;
315  maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0;
316  maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0;
317 
318  *start = minColor;
319  *end = maxColor;
320 }
321 
323 void ColorBlock::boundsRangeAlpha(Color32 *start, Color32 *end) const
324 {
325  Color32 minColor(255, 255, 255, 255);
326  Color32 maxColor(0, 0, 0, 0);
327 
328  for (uint i = 0; i < 16; i++) {
329  if (m_color[i].r < minColor.r) {
330  minColor.r = m_color[i].r;
331  }
332  if (m_color[i].g < minColor.g) {
333  minColor.g = m_color[i].g;
334  }
335  if (m_color[i].b < minColor.b) {
336  minColor.b = m_color[i].b;
337  }
338  if (m_color[i].a < minColor.a) {
339  minColor.a = m_color[i].a;
340  }
341  if (m_color[i].r > maxColor.r) {
342  maxColor.r = m_color[i].r;
343  }
344  if (m_color[i].g > maxColor.g) {
345  maxColor.g = m_color[i].g;
346  }
347  if (m_color[i].b > maxColor.b) {
348  maxColor.b = m_color[i].b;
349  }
350  if (m_color[i].a > maxColor.a) {
351  maxColor.a = m_color[i].a;
352  }
353  }
354 
355  /* Offset range by 1/16 of the extents */
356  Color32 inset;
357  inset.r = (maxColor.r - minColor.r) >> 4;
358  inset.g = (maxColor.g - minColor.g) >> 4;
359  inset.b = (maxColor.b - minColor.b) >> 4;
360  inset.a = (maxColor.a - minColor.a) >> 4;
361 
362  minColor.r = (minColor.r + inset.r <= 255) ? minColor.r + inset.r : 255;
363  minColor.g = (minColor.g + inset.g <= 255) ? minColor.g + inset.g : 255;
364  minColor.b = (minColor.b + inset.b <= 255) ? minColor.b + inset.b : 255;
365  minColor.a = (minColor.a + inset.a <= 255) ? minColor.a + inset.a : 255;
366 
367  maxColor.r = (maxColor.r >= inset.r) ? maxColor.r - inset.r : 0;
368  maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0;
369  maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0;
370  maxColor.a = (maxColor.a >= inset.a) ? maxColor.a - inset.a : 0;
371 
372  *start = minColor;
373  *end = maxColor;
374 }
375 #endif
376 
377 #if 0
379 void ColorBlock::sortColorsByAbsoluteValue()
380 {
381  /* Dummy selection sort. */
382  for (uint a = 0; a < 16; a++) {
383  uint max = a;
384  Color16 cmax(m_color[a]);
385 
386  for (uint b = a + 1; b < 16; b++) {
387  Color16 cb(m_color[b]);
388 
389  if (cb.u > cmax.u) {
390  max = b;
391  cmax = cb;
392  }
393  }
394  swap(m_color[a], m_color[max]);
395  }
396 }
397 #endif
398 
399 #if 0
401 void ColorBlock::computeRange(Vector3::Arg axis, Color32 *start, Color32 *end) const
402 {
403 
404  int mini, maxi;
405  mini = maxi = 0;
406 
407  float min, max;
408  min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis);
409 
410  for (uint i = 1; i < 16; i++) {
411  const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
412 
413  float val = dot(vec, axis);
414  if (val < min) {
415  mini = i;
416  min = val;
417  }
418  else if (val > max) {
419  maxi = i;
420  max = val;
421  }
422  }
423 
424  *start = m_color[mini];
425  *end = m_color[maxi];
426 }
427 #endif
428 
429 #if 0
431 void ColorBlock::sortColors(const Vector3 &axis)
432 {
433  float luma_array[16];
434 
435  for (uint i = 0; i < 16; i++) {
436  const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
437  luma_array[i] = dot(vec, axis);
438  }
439 
440  /* Dummy selection sort. */
441  for (uint a = 0; a < 16; a++) {
442  uint min = a;
443  for (uint b = a + 1; b < 16; b++) {
444  if (luma_array[b] < luma_array[min]) {
445  min = b;
446  }
447  }
448  swap(luma_array[a], luma_array[min]);
449  swap(m_color[a], m_color[min]);
450  }
451 }
452 #endif
453 
454 #if 0
456 float ColorBlock::volume() const
457 {
458  Box bounds;
459  bounds.clearBounds();
460 
461  for (int i = 0; i < 16; i++) {
462  const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b);
463  bounds.addPointToBounds(point);
464  }
465 
466  return bounds.volume();
467 }
468 #endif
unsigned int uint
Definition: BLI_sys_types.h:67
static uint8 component(Color32 c, uint i)
Definition: ColorBlock.cpp:108
#define MIN(a, b)
Definition: Common.h:10
void swap(T &a, T &b)
Definition: Common.h:19
unsigned char uint8
Definition: Common.h:26
_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 z
_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 GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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 y
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
__forceinline avxf maxi(const avxf &a, const avxf &b)
Definition: avxf.h:305
__forceinline avxf mini(const avxf &a, const avxf &b)
Definition: avxf.h:311
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition: btDbvt.cpp:299
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
Definition: Color.h:82
Definition: Color.h:19
unsigned char g
Definition: Color.h:75
unsigned char b
Definition: Color.h:75
unsigned int u
Definition: Color.h:77
unsigned char r
Definition: Color.h:75
unsigned char a
Definition: Color.h:75
const Color32 * pixels() const
Definition: Image.cpp:72
uint height() const
Definition: Image.cpp:49
uint width() const
Definition: Image.cpp:44
int count
float[3] Vector3
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static unsigned c
Definition: RandGen.cpp:83
static unsigned a[3]
Definition: RandGen.cpp:78
T dot(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
#define min(a, b)
Definition: sort.c:35
Color32 color(uint i) const
Definition: ColorBlock.h:62
ColorBlock()=default
void init(const Image *img, uint x, uint y)
Definition: ColorBlock.cpp:54
bool isSingleColor(Color32 mask=Color32(0xFF, 0xFF, 0xFF, 0x00)) const
Definition: ColorBlock.cpp:139
bool hasAlpha() const
Definition: ColorBlock.cpp:219
void swizzle(uint x, uint y, uint z, uint w)
Definition: ColorBlock.cpp:128
float max