57 float value = inputValue[0];
59 value *= inputColor2[3];
61 float valuem = 1.0f - value;
62 output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
63 output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
64 output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
65 output[3] = inputColor1[3];
69 unsigned int preferredResolution[2])
72 unsigned int tempPreferredResolution[2] = {0, 0};
73 unsigned int tempResolution[2];
77 if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
83 if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
104 float inputColor1[4];
105 float inputColor2[4];
112 float value = inputValue[0];
114 value *= inputColor2[3];
116 output[0] = inputColor1[0] + value * inputColor2[0];
117 output[1] = inputColor1[1] + value * inputColor2[1];
118 output[2] = inputColor1[2] + value * inputColor2[2];
119 output[3] = inputColor1[3];
131 float inputColor1[4];
132 float inputColor2[4];
139 value = inputValue[0];
142 value *= inputColor2[3];
144 float valuem = 1.0f - value;
145 output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
146 output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
147 output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
148 output[3] = inputColor1[3];
160 float inputColor1[4];
161 float inputColor2[4];
169 float value = inputValue[0];
171 value *= inputColor2[3];
173 float valuem = 1.0f - value;
175 tmp = valuem + value * inputColor2[0];
180 tmp = 1.0f - (1.0f - inputColor1[0]) / tmp;
184 else if (tmp > 1.0f) {
192 tmp = valuem + value * inputColor2[1];
197 tmp = 1.0f - (1.0f - inputColor1[1]) / tmp;
201 else if (tmp > 1.0f) {
209 tmp = valuem + value * inputColor2[2];
214 tmp = 1.0f - (1.0f - inputColor1[2]) / tmp;
218 else if (tmp > 1.0f) {
226 output[3] = inputColor1[3];
238 float inputColor1[4];
239 float inputColor2[4];
246 float value = inputValue[0];
248 value *= inputColor2[3];
250 float valuem = 1.0f - value;
252 float colH, colS, colV;
253 rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
256 float tmpr, tmpg, tmpb;
257 rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
258 hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb);
259 output[0] = (valuem * inputColor1[0]) + (value * tmpr);
260 output[1] = (valuem * inputColor1[1]) + (value * tmpg);
261 output[2] = (valuem * inputColor1[2]) + (value * tmpb);
266 output[3] = inputColor1[3];
278 float inputColor1[4];
279 float inputColor2[4];
286 float value = inputValue[0];
288 value *= inputColor2[3];
290 float valuem = 1.0f - value;
291 output[0] =
min_ff(inputColor1[0], inputColor2[0]) * value + inputColor1[0] * valuem;
292 output[1] =
min_ff(inputColor1[1], inputColor2[1]) * value + inputColor1[1] * valuem;
293 output[2] =
min_ff(inputColor1[2], inputColor2[2]) * value + inputColor1[2] * valuem;
294 output[3] = inputColor1[3];
306 float inputColor1[4];
307 float inputColor2[4];
314 float value = inputValue[0];
316 value *= inputColor2[3];
318 float valuem = 1.0f - value;
319 output[0] = valuem * inputColor1[0] + value *
fabsf(inputColor1[0] - inputColor2[0]);
320 output[1] = valuem * inputColor1[1] + value *
fabsf(inputColor1[1] - inputColor2[1]);
321 output[2] = valuem * inputColor1[2] + value *
fabsf(inputColor1[2] - inputColor2[2]);
322 output[3] = inputColor1[3];
334 float inputColor1[4];
335 float inputColor2[4];
342 float value = inputValue[0];
344 value *= inputColor2[3];
346 float valuem = 1.0f - value;
348 if (inputColor2[0] != 0.0f) {
349 output[0] = valuem * (inputColor1[0]) + value * (inputColor1[0]) / inputColor2[0];
354 if (inputColor2[1] != 0.0f) {
355 output[1] = valuem * (inputColor1[1]) + value * (inputColor1[1]) / inputColor2[1];
360 if (inputColor2[2] != 0.0f) {
361 output[2] = valuem * (inputColor1[2]) + value * (inputColor1[2]) / inputColor2[2];
367 output[3] = inputColor1[3];
379 float inputColor1[4];
380 float inputColor2[4];
388 float value = inputValue[0];
390 value *= inputColor2[3];
393 if (inputColor1[0] != 0.0f) {
394 tmp = 1.0f - value * inputColor2[0];
399 tmp = inputColor1[0] / tmp;
412 if (inputColor1[1] != 0.0f) {
413 tmp = 1.0f - value * inputColor2[1];
418 tmp = inputColor1[1] / tmp;
431 if (inputColor1[2] != 0.0f) {
432 tmp = 1.0f - value * inputColor2[2];
437 tmp = inputColor1[2] / tmp;
450 output[3] = inputColor1[3];
462 float inputColor1[4];
463 float inputColor2[4];
465 float value, input_weight, glare_weight;
470 value = inputValue[0];
476 glare_weight = 1.0f + value;
479 input_weight = 1.0f - value;
482 output[0] = input_weight *
MAX2(inputColor1[0], 0.0f) + glare_weight * inputColor2[0];
483 output[1] = input_weight *
MAX2(inputColor1[1], 0.0f) + glare_weight * inputColor2[1];
484 output[2] = input_weight *
MAX2(inputColor1[2], 0.0f) + glare_weight * inputColor2[2];
485 output[3] = inputColor1[3];
494 float inputColor1[4];
495 float inputColor2[4];
502 float value = inputValue[0];
504 value *= inputColor2[3];
506 float valuem = 1.0f - value;
508 float colH, colS, colV;
509 rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
512 float tmpr, tmpg, tmpb;
513 rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
514 hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb);
515 output[0] = valuem * (inputColor1[0]) + value * tmpr;
516 output[1] = valuem * (inputColor1[1]) + value * tmpg;
517 output[2] = valuem * (inputColor1[2]) + value * tmpb;
522 output[3] = inputColor1[3];
534 float inputColor1[4];
535 float inputColor2[4];
542 float value = inputValue[0];
544 value *= inputColor2[3];
547 tmp = value * inputColor2[0];
548 if (tmp > inputColor1[0]) {
552 output[0] = inputColor1[0];
554 tmp = value * inputColor2[1];
555 if (tmp > inputColor1[1]) {
559 output[1] = inputColor1[1];
561 tmp = value * inputColor2[2];
562 if (tmp > inputColor1[2]) {
566 output[2] = inputColor1[2];
568 output[3] = inputColor1[3];
580 float inputColor1[4];
581 float inputColor2[4];
588 float value = inputValue[0];
590 value *= inputColor2[3];
592 if (inputColor2[0] > 0.5f) {
593 output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0] - 0.5f));
596 output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0]) - 1.0f);
598 if (inputColor2[1] > 0.5f) {
599 output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1] - 0.5f));
602 output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1]) - 1.0f);
604 if (inputColor2[2] > 0.5f) {
605 output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2] - 0.5f));
608 output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f);
611 output[3] = inputColor1[3];
623 float inputColor1[4];
624 float inputColor2[4];
631 float value = inputValue[0];
633 value *= inputColor2[3];
635 float valuem = 1.0f - value;
636 output[0] = inputColor1[0] * (valuem + value * inputColor2[0]);
637 output[1] = inputColor1[1] * (valuem + value * inputColor2[1]);
638 output[2] = inputColor1[2] * (valuem + value * inputColor2[2]);
639 output[3] = inputColor1[3];
651 float inputColor1[4];
652 float inputColor2[4];
659 float value = inputValue[0];
661 value *= inputColor2[3];
664 float valuem = 1.0f - value;
666 if (inputColor1[0] < 0.5f) {
667 output[0] = inputColor1[0] * (valuem + 2.0f * value * inputColor2[0]);
670 output[0] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
672 if (inputColor1[1] < 0.5f) {
673 output[1] = inputColor1[1] * (valuem + 2.0f * value * inputColor2[1]);
676 output[1] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
678 if (inputColor1[2] < 0.5f) {
679 output[2] = inputColor1[2] * (valuem + 2.0f * value * inputColor2[2]);
682 output[2] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
684 output[3] = inputColor1[3];
696 float inputColor1[4];
697 float inputColor2[4];
704 float value = inputValue[0];
706 value *= inputColor2[3];
708 float valuem = 1.0f - value;
711 rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
713 float colH, colS, colV;
714 rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
721 output[3] = inputColor1[3];
733 float inputColor1[4];
734 float inputColor2[4];
741 float value = inputValue[0];
743 value *= inputColor2[3];
745 float valuem = 1.0f - value;
747 output[0] = 1.0f - (valuem + value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
748 output[1] = 1.0f - (valuem + value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
749 output[2] = 1.0f - (valuem + value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
750 output[3] = inputColor1[3];
762 float inputColor1[4];
763 float inputColor2[4];
770 float value = inputValue[0];
772 value *= inputColor2[3];
774 float valuem = 1.0f - value;
778 scr = 1.0f - (1.0f - inputColor2[0]) * (1.0f - inputColor1[0]);
779 scg = 1.0f - (1.0f - inputColor2[1]) * (1.0f - inputColor1[1]);
780 scb = 1.0f - (1.0f - inputColor2[2]) * (1.0f - inputColor1[2]);
782 output[0] = valuem * (inputColor1[0]) +
783 value * (((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) +
784 (inputColor1[0] * scr));
785 output[1] = valuem * (inputColor1[1]) +
786 value * (((1.0f - inputColor1[1]) * inputColor2[1] * (inputColor1[1])) +
787 (inputColor1[1] * scg));
788 output[2] = valuem * (inputColor1[2]) +
789 value * (((1.0f - inputColor1[2]) * inputColor2[2] * (inputColor1[2])) +
790 (inputColor1[2] * scb));
791 output[3] = inputColor1[3];
803 float inputColor1[4];
804 float inputColor2[4];
811 float value = inputValue[0];
813 value *= inputColor2[3];
815 output[0] = inputColor1[0] - value * (inputColor2[0]);
816 output[1] = inputColor1[1] - value * (inputColor2[1]);
817 output[2] = inputColor1[2] - value * (inputColor2[2]);
818 output[3] = inputColor1[3];
830 float inputColor1[4];
831 float inputColor2[4];
838 float value = inputValue[0];
840 value *= inputColor2[3];
842 float valuem = 1.0f - value;
845 float colH, colS, colV;
846 rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
847 rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
849 output[3] = inputColor1[3];
MINLINE float min_ff(float a, float b)
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
MINLINE void copy_v3_v3(float r[3], const float a[3])
_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
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void clampIfNeeded(float color[4])
bool useValueAlphaMultiply()
void deinitExecution() override
void setUseValueAlphaMultiply(const bool value)
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) override
determine the resolution of this node
SocketReader * m_inputColor1Operation
SocketReader * m_inputValueOperation
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
SocketReader * m_inputColor2Operation
void initExecution() override
void setUseClamp(bool value)
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void readSampled(float result[4], float x, float y, PixelSampler sampler)
NodeOperationInput * getInputSocket(unsigned int index)
void addInputSocket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void addOutputSocket(DataType datatype)
void setResolutionInputSocketIndex(unsigned int index)
set the index of the input socket that will determine the resolution of this operation
virtual void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
determine the resolution of this node
SocketReader * getInputSocketReader(unsigned int inputSocketindex)