38 return c.r +
c.g +
c.b;
44 return (c0.
r - c1.
r) * (c0.
r - c1.
r) + (c0.
g - c1.
g) * (c0.
g - c1.
g) +
45 (c0.
b - c1.
b) * (c0.
b - c1.
b);
52 for (
uint i = 0; i < 16; i++) {
60 for (
uint i = 0; i < 16; i++) {
85 for (
uint i = 0; i < 4; i++) {
86 const int by = i % bh;
89 const int bx =
e % bw;
90 const uint idx = (
y + by) *
w +
x + bx;
106 uint srcPlane =
w * h;
108 for (
uint i = 0; i < 4; i++) {
109 const uint by = i % bh;
112 const uint bx =
e % bw;
113 const uint idx = ((
y + by) *
w +
x + bx);
162 for (
int i = 1; i < 16; i++) {
163 if (u != (m_color[i].u &
mask.u)) {
173 bool ColorBlock::isSingleColorNoAlpha()
const
177 for (i = 0; i < 16; i++) {
178 if (m_color[i].
a != 0) {
186 for (; i < 16; i++) {
187 if (u != (m_color[i].u &
mask.u)) {
198 uint ColorBlock::countUniqueColors()
const
203 for (
int i = 0; i < 16; i++) {
205 for (
int j = 0; j < i; j++) {
206 if (m_color[i] != m_color[j]) {
222 Color32 ColorBlock::averageColor()
const
227 for (
uint i = 0; i < 16; i++) {
241 for (
const auto &i : m_color) {
252 void ColorBlock::diameterRange(
Color32 *start,
Color32 *end)
const
257 for (
int i = 0; i < 16; i++) {
258 for (
int j = i + 1; j < 16; j++) {
259 uint dist = colorDistance(m_color[i], m_color[j]);
260 if (dist > best_dist) {
273 void ColorBlock::luminanceRange(
Color32 *start,
Color32 *end)
const
276 uint minLuminance, maxLuminance;
278 maxLuminance = minLuminance = colorLuminance(m_color[0]);
280 for (
uint i = 1; i < 16; i++) {
281 uint luminance = colorLuminance(m_color[i]);
283 if (luminance > maxLuminance) {
284 maxLuminance = luminance;
285 maxColor = m_color[i];
287 else if (luminance < minLuminance) {
288 minLuminance = luminance;
289 minColor = m_color[i];
300 Color32 minColor(255, 255, 255);
303 for (
uint i = 0; i < 16; i++) {
304 if (m_color[i].
r < minColor.
r) {
305 minColor.
r = m_color[i].
r;
307 if (m_color[i].g < minColor.
g) {
308 minColor.
g = m_color[i].
g;
310 if (m_color[i].b < minColor.
b) {
311 minColor.
b = m_color[i].
b;
313 if (m_color[i].
r > maxColor.
r) {
314 maxColor.
r = m_color[i].
r;
316 if (m_color[i].g > maxColor.
g) {
317 maxColor.
g = m_color[i].
g;
319 if (m_color[i].b > maxColor.
b) {
320 maxColor.
b = m_color[i].
b;
326 inset.
r = (maxColor.
r - minColor.
r) >> 4;
327 inset.
g = (maxColor.
g - minColor.
g) >> 4;
328 inset.
b = (maxColor.
b - minColor.
b) >> 4;
330 minColor.
r = (minColor.
r + inset.
r <= 255) ? minColor.
r + inset.
r : 255;
331 minColor.
g = (minColor.
g + inset.
g <= 255) ? minColor.
g + inset.
g : 255;
332 minColor.
b = (minColor.
b + inset.
b <= 255) ? minColor.
b + inset.
b : 255;
334 maxColor.
r = (maxColor.
r >= inset.
r) ? maxColor.
r - inset.
r : 0;
335 maxColor.
g = (maxColor.
g >= inset.
g) ? maxColor.
g - inset.
g : 0;
336 maxColor.
b = (maxColor.
b >= inset.
b) ? maxColor.
b - inset.
b : 0;
343 void ColorBlock::boundsRangeAlpha(
Color32 *start,
Color32 *end)
const
345 Color32 minColor(255, 255, 255, 255);
348 for (
uint i = 0; i < 16; i++) {
349 if (m_color[i].
r < minColor.
r) {
350 minColor.
r = m_color[i].
r;
352 if (m_color[i].g < minColor.
g) {
353 minColor.
g = m_color[i].
g;
355 if (m_color[i].b < minColor.
b) {
356 minColor.
b = m_color[i].
b;
358 if (m_color[i].
a < minColor.
a) {
359 minColor.
a = m_color[i].
a;
361 if (m_color[i].
r > maxColor.
r) {
362 maxColor.
r = m_color[i].
r;
364 if (m_color[i].g > maxColor.
g) {
365 maxColor.
g = m_color[i].
g;
367 if (m_color[i].b > maxColor.
b) {
368 maxColor.
b = m_color[i].
b;
370 if (m_color[i].
a > maxColor.
a) {
371 maxColor.
a = m_color[i].
a;
377 inset.
r = (maxColor.
r - minColor.
r) >> 4;
378 inset.
g = (maxColor.
g - minColor.
g) >> 4;
379 inset.
b = (maxColor.
b - minColor.
b) >> 4;
380 inset.
a = (maxColor.
a - minColor.
a) >> 4;
382 minColor.
r = (minColor.
r + inset.
r <= 255) ? minColor.
r + inset.
r : 255;
383 minColor.
g = (minColor.
g + inset.
g <= 255) ? minColor.
g + inset.
g : 255;
384 minColor.
b = (minColor.
b + inset.
b <= 255) ? minColor.
b + inset.
b : 255;
385 minColor.
a = (minColor.
a + inset.
a <= 255) ? minColor.
a + inset.
a : 255;
387 maxColor.
r = (maxColor.
r >= inset.
r) ? maxColor.
r - inset.
r : 0;
388 maxColor.
g = (maxColor.
g >= inset.
g) ? maxColor.
g - inset.
g : 0;
389 maxColor.
b = (maxColor.
b >= inset.
b) ? maxColor.
b - inset.
b : 0;
390 maxColor.
a = (maxColor.
a >= inset.
a) ? maxColor.
a - inset.
a : 0;
399 void ColorBlock::sortColorsByAbsoluteValue()
402 for (
uint a = 0;
a < 16;
a++) {
406 for (
uint b =
a + 1; b < 16; b++) {
421 void ColorBlock::computeRange(Vector3::Arg axis,
Color32 *start,
Color32 *end)
const
430 for (
uint i = 1; i < 16; i++) {
431 const Vector3 vec(m_color[i].
r, m_color[i].g, m_color[i].b);
433 float val =
dot(vec, axis);
438 else if (val >
max) {
444 *start = m_color[
mini];
445 *end = m_color[
maxi];
451 void ColorBlock::sortColors(
const Vector3 &axis)
453 float luma_array[16];
455 for (
uint i = 0; i < 16; i++) {
456 const Vector3 vec(m_color[i].
r, m_color[i].g, m_color[i].b);
457 luma_array[i] =
dot(vec, axis);
461 for (
uint a = 0;
a < 16;
a++) {
463 for (
uint b =
a + 1; b < 16; b++) {
464 if (luma_array[b] < luma_array[
min]) {
468 swap(luma_array[
a], luma_array[
min]);
476 float ColorBlock::volume()
const
481 for (
int i = 0; i < 16; i++) {
482 const Vector3 point(m_color[i].
r, m_color[i].g, m_color[i].b);
483 bounds.addPointToBounds(point);
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 RGB to Bright Vector Camera CLAMP
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
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)
__forceinline avxf maxi(const avxf &a, const avxf &b)
__forceinline avxf mini(const avxf &a, const avxf &b)
ccl_device_inline float dot(const float2 &a, const float2 &b)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)