24 return c.r +
c.g +
c.b;
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);
37 for (
uint i = 0; i < 16; i++) {
44 for (
uint i = 0; i < 16; i++) {
68 for (
uint i = 0; i < 4; i++) {
69 const int by = i % bh;
72 const int bx =
e % bw;
73 const uint idx = (
y + by) *
w +
x + bx;
89 uint srcPlane =
w * h;
91 for (
uint i = 0; i < 4; i++) {
92 const uint by = i % bh;
95 const uint bx =
e % bw;
96 const uint idx = ((
y + by) *
w +
x + bx);
143 for (
int i = 1; i < 16; i++) {
144 if (u != (m_color[i].u &
mask.u)) {
154 bool ColorBlock::isSingleColorNoAlpha()
const
158 for (i = 0; i < 16; i++) {
159 if (m_color[i].
a != 0) {
167 for (; i < 16; i++) {
168 if (u != (m_color[i].u &
mask.u)) {
179 uint ColorBlock::countUniqueColors()
const
184 for (
int i = 0; i < 16; i++) {
186 for (
int j = 0; j < i; j++) {
187 if (m_color[i] != m_color[j]) {
203 Color32 ColorBlock::averageColor()
const
208 for (
uint i = 0; i < 16; i++) {
221 for (
const auto &i : m_color) {
232 void ColorBlock::diameterRange(
Color32 *start,
Color32 *end)
const
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) {
253 void ColorBlock::luminanceRange(
Color32 *start,
Color32 *end)
const
256 uint minLuminance, maxLuminance;
258 maxLuminance = minLuminance = colorLuminance(m_color[0]);
260 for (
uint i = 1; i < 16; i++) {
261 uint luminance = colorLuminance(m_color[i]);
263 if (luminance > maxLuminance) {
264 maxLuminance = luminance;
265 maxColor = m_color[i];
267 else if (luminance < minLuminance) {
268 minLuminance = luminance;
269 minColor = m_color[i];
280 Color32 minColor(255, 255, 255);
283 for (
uint i = 0; i < 16; i++) {
284 if (m_color[i].
r < minColor.
r) {
285 minColor.
r = m_color[i].
r;
287 if (m_color[i].
g < minColor.
g) {
288 minColor.
g = m_color[i].
g;
290 if (m_color[i].
b < minColor.
b) {
291 minColor.
b = m_color[i].
b;
293 if (m_color[i].
r > maxColor.
r) {
294 maxColor.
r = m_color[i].
r;
296 if (m_color[i].
g > maxColor.
g) {
297 maxColor.
g = m_color[i].
g;
299 if (m_color[i].
b > maxColor.
b) {
300 maxColor.
b = m_color[i].
b;
306 inset.
r = (maxColor.
r - minColor.
r) >> 4;
307 inset.
g = (maxColor.
g - minColor.
g) >> 4;
308 inset.
b = (maxColor.
b - minColor.
b) >> 4;
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;
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;
323 void ColorBlock::boundsRangeAlpha(
Color32 *start,
Color32 *end)
const
325 Color32 minColor(255, 255, 255, 255);
328 for (
uint i = 0; i < 16; i++) {
329 if (m_color[i].
r < minColor.
r) {
330 minColor.
r = m_color[i].
r;
332 if (m_color[i].
g < minColor.
g) {
333 minColor.
g = m_color[i].
g;
335 if (m_color[i].
b < minColor.
b) {
336 minColor.
b = m_color[i].
b;
338 if (m_color[i].
a < minColor.
a) {
339 minColor.
a = m_color[i].
a;
341 if (m_color[i].
r > maxColor.
r) {
342 maxColor.
r = m_color[i].
r;
344 if (m_color[i].
g > maxColor.
g) {
345 maxColor.
g = m_color[i].
g;
347 if (m_color[i].
b > maxColor.
b) {
348 maxColor.
b = m_color[i].
b;
350 if (m_color[i].
a > maxColor.
a) {
351 maxColor.
a = m_color[i].
a;
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;
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;
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;
379 void ColorBlock::sortColorsByAbsoluteValue()
382 for (
uint a = 0;
a < 16;
a++) {
401 void ColorBlock::computeRange(Vector3::Arg axis,
Color32 *start,
Color32 *end)
const
410 for (
uint i = 1; i < 16; i++) {
411 const Vector3 vec(m_color[i].
r, m_color[i].
g, m_color[i].
b);
413 float val =
dot(vec, axis);
418 else if (val >
max) {
424 *start = m_color[
mini];
425 *end = m_color[
maxi];
431 void ColorBlock::sortColors(
const Vector3 &axis)
433 float luma_array[16];
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);
441 for (
uint a = 0;
a < 16;
a++) {
444 if (luma_array[
b] < luma_array[
min]) {
448 swap(luma_array[
a], luma_array[
min]);
456 float ColorBlock::volume()
const
461 for (
int i = 0; i < 16; i++) {
static uint8 component(Color32 c, uint i)
_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)
__forceinline avxf mini(const avxf &a, const avxf &b)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
const Color32 * pixels() const
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
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)
Color32 color(uint i) const
void init(const Image *img, uint x, uint y)
bool isSingleColor(Color32 mask=Color32(0xFF, 0xFF, 0xFF, 0x00)) const
void swizzle(uint x, uint y, uint z, uint w)