diff options
Diffstat (limited to 'source/blender/nodes/texture')
5 files changed, 29 insertions, 29 deletions
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 1b790f87faf..714665c303b 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -40,12 +40,10 @@ #include "BLI_threads.h" #include "BLI_utildefines.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_context.h" -#include "BKE_global.h" #include "BKE_linestyle.h" -#include "BKE_main.h" #include "BKE_node.h" #include "BKE_paint.h" @@ -57,7 +55,6 @@ #include "RNA_access.h" -#include "RE_pipeline.h" #include "RE_shader_ext.h" @@ -339,7 +336,7 @@ int ntreeTexExecTree( data.osatex = osatex; data.target = texres; data.do_preview = preview; - data.do_manage = (shi) ? shi->do_manage : 0; + data.do_manage = (shi) ? shi->do_manage : true; data.thread = thread; data.which_output = which_output; data.cfra = cfra; diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h index eb81bcd6949..0410a9d4b33 100644 --- a/source/blender/nodes/texture/node_texture_util.h +++ b/source/blender/nodes/texture/node_texture_util.h @@ -67,9 +67,7 @@ #include "node_util.h" #include "NOD_texture.h" -#include "NOD_texture.h" - -#include "BLF_translation.h" +#include "BLT_translation.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 94e778e10fb..19bc16fb82d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -53,16 +53,16 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor switch (node->custom1) { - case 0: /* Add */ + case NODE_MATH_ADD: *out = in0 + in1; break; - case 1: /* Subtract */ + case NODE_MATH_SUB: *out = in0 - in1; break; - case 2: /* Multiply */ + case NODE_MATH_MUL: *out = in0 * in1; break; - case 3: /* Divide */ + case NODE_MATH_DIVIDE: { if (in1 == 0) /* We don't want to divide by zero. */ *out = 0.0; @@ -70,22 +70,22 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor *out = in0 / in1; break; } - case 4: /* Sine */ + case NODE_MATH_SIN: { *out = sinf(in0); break; } - case 5: /* Cosine */ + case NODE_MATH_COS: { *out = cosf(in0); break; } - case 6: /* Tangent */ + case NODE_MATH_TAN: { *out = tanf(in0); break; } - case 7: /* Arc-Sine */ + case NODE_MATH_ASIN: { /* Can't do the impossible... */ if (in0 <= 1 && in0 >= -1) @@ -94,7 +94,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor *out = 0.0; break; } - case 8: /* Arc-Cosine */ + case NODE_MATH_ACOS: { /* Can't do the impossible... */ if (in0 <= 1 && in0 >= -1) @@ -103,12 +103,12 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor *out = 0.0; break; } - case 9: /* Arc-Tangent */ + case NODE_MATH_ATAN: { *out = atan(in0); break; } - case 10: /* Power */ + case NODE_MATH_POW: { /* Only raise negative numbers by full integers */ if (in0 >= 0) { @@ -125,7 +125,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor } break; } - case 11: /* Logarithm */ + case NODE_MATH_LOG: { /* Don't want any imaginary numbers... */ if (in0 > 0 && in1 > 0) @@ -134,7 +134,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor *out = 0.0; break; } - case 12: /* Minimum */ + case NODE_MATH_MIN: { if (in0 < in1) *out = in0; @@ -142,7 +142,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor *out = in1; break; } - case 13: /* Maximum */ + case NODE_MATH_MAX: { if (in0 > in1) *out = in0; @@ -150,13 +150,13 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor *out = in1; break; } - case 14: /* Round */ + case NODE_MATH_ROUND: { *out = (in0 < 0) ? (int)(in0 - 0.5f) : (int)(in0 + 0.5f); break; } - case 15: /* Less Than */ + case NODE_MATH_LESS: { if (in0 < in1) *out = 1.0f; @@ -165,7 +165,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; } - case 16: /* Greater Than */ + case NODE_MATH_GREATER: { if (in0 > in1) *out = 1.0f; @@ -174,7 +174,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; } - case 17: /* Modulo */ + case NODE_MATH_MOD: { if (in1 == 0.0f) *out = 0.0f; @@ -183,7 +183,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; } - case 18: /* Absolute */ + case NODE_MATH_ABS: { *out = fabsf(in0); break; @@ -195,6 +195,10 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; } } + + if (node->custom2 & SHD_MATH_CLAMP) { + CLAMP(*out, 0.0f, 1.0f); + } } static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c index b49ec1fd503..0be5f875a23 100644 --- a/source/blender/nodes/texture/nodes/node_texture_proc.c +++ b/source/blender/nodes/texture/nodes/node_texture_proc.c @@ -286,7 +286,7 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node) Tex *tex = MEM_callocN(sizeof(Tex), "Tex"); node->storage = tex; - default_tex(tex); + BKE_texture_default(tex); tex->type = node->type - TEX_NODE_PROC; if (tex->type == TEX_WOOD) diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c index 7f8adab2da5..a49d82d27a9 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c @@ -32,6 +32,7 @@ #include "node_texture_util.h" #include "NOD_texture.h" +#include "IMB_colormanagement.h" /* **************** VALTORGB ******************** */ static bNodeSocketTemplate valtorgb_in[] = { @@ -91,7 +92,7 @@ static void rgbtobw_valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNode { float cin[4]; tex_input_rgba(cin, in[0], p, thread); - *out = rgb_to_bw(cin); + *out = IMB_colormanagement_get_luminance(cin); } static void rgbtobw_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) |