diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2012-11-12 16:30:02 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2012-11-12 16:30:02 +0400 |
commit | 6b65102c20e9bdafd90f55f60c2a2084d873e809 (patch) | |
tree | a0f5554702501d2da1073b22ff55f740aff135f9 /source/blender/nodes/texture | |
parent | 053710fcbc78ff83b9617be87558876e381f85a6 (diff) | |
parent | 83de5cb30831328548502126dff84ffdb72544f2 (diff) |
Merge w/ trunk: r51141-52085 (Important Note: gameengine and blenderplayer were not merged due to complex differences)
Diffstat (limited to 'source/blender/nodes/texture')
26 files changed, 122 insertions, 245 deletions
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 9656d93f1b0..ba94531c259 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -4,7 +4,7 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -134,7 +134,7 @@ bNodeTreeType ntreeType_Texture = { /* update */ update, /* update_node */ NULL, /* validate_link */ NULL, - /* internal_connect */ node_internal_connect_default + /* update_internal_links */ node_update_internal_links_default }; int ntreeTexTagAnimated(bNodeTree *ntree) @@ -240,19 +240,19 @@ void ntreeTexEndExecTree(bNodeTreeExec *exec, int use_tree_data) } int ntreeTexExecTree( - bNodeTree *nodes, - TexResult *texres, - float *co, - float *dxt, float *dyt, - int osatex, - short thread, - Tex *UNUSED(tex), - short which_output, - int cfra, - int preview, - ShadeInput *shi, - MTex *mtex -) { + bNodeTree *nodes, + TexResult *texres, + float co[3], + float dxt[3], float dyt[3], + int osatex, + const short thread, + Tex *UNUSED(tex), + short which_output, + int cfra, + int preview, + ShadeInput *shi, + MTex *mtex) +{ TexCallData data; float *nor = texres->nor; int retval = TEX_INT; diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c index 5e58b74ac3a..06473d800d0 100644 --- a/source/blender/nodes/texture/node_texture_util.c +++ b/source/blender/nodes/texture/node_texture_util.c @@ -4,7 +4,7 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,7 +29,7 @@ * \ingroup nodes */ - + /* * HOW TEXTURE NODES WORK * @@ -112,13 +112,13 @@ void params_from_cdata(TexParams *out, TexCallData *in) out->mtex = in->mtex; } -void tex_do_preview(bNode *node, float *co, float *col) +void tex_do_preview(bNode *node, const float coord[2], const float col[4]) { - bNodePreview *preview= node->preview; + bNodePreview *preview = node->preview; if (preview) { - int xs= ((co[0] + 1.0f)*0.5f)*preview->xsize; - int ys= ((co[1] + 1.0f)*0.5f)*preview->ysize; + int xs = ((coord[0] + 1.0f) * 0.5f) * preview->xsize; + int ys = ((coord[1] + 1.0f) * 0.5f) * preview->ysize; nodeAddToPreview(node, col, xs, ys, 0); /* 0 = no color management */ } @@ -132,19 +132,19 @@ void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexC dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate"); else dg = out->data; - - dg->cdata= cdata; + + dg->cdata = cdata; dg->fn = texfn; dg->node = node; - memcpy(dg->in, in, MAX_SOCKET * sizeof(bNodeStack*)); + memcpy(dg->in, in, MAX_SOCKET * sizeof(bNodeStack *)); dg->type = out->sockettype; } void ntreeTexCheckCyclics(struct bNodeTree *ntree) { bNode *node; - for (node= ntree->nodes.first; node; node= node->next) { - + for (node = ntree->nodes.first; node; node = node->next) { + if (node->type == TEX_NODE_TEXTURE && node->id) { /* custom2 stops the node from rendering */ if (node->custom1) { diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h index e938e6fc419..16dbc2f7bfb 100644 --- a/source/blender/nodes/texture/node_texture_util.h +++ b/source/blender/nodes/texture/node_texture_util.h @@ -79,8 +79,10 @@ typedef struct TexCallData { TexResult *target; + /* all float[3] */ float *co; float *dxt, *dyt; + int osatex; char do_preview; short thread; @@ -94,7 +96,7 @@ typedef struct TexCallData { typedef struct TexParams { float *co; float *dxt, *dyt; - float *previewco; + const float *previewco; int cfra; int osatex; @@ -119,7 +121,7 @@ void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread); float tex_input_value(bNodeStack *in, TexParams *params, short thread); void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *data); -void tex_do_preview(bNode *node, float *coord, float *col); +void tex_do_preview(bNode *node, const float coord[2], const float col[4]); void params_from_cdata(TexParams *out, TexCallData *in); diff --git a/source/blender/nodes/texture/nodes/node_texture_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c index 9e557705b3f..4c2d276b902 100644 --- a/source/blender/nodes/texture/nodes/node_texture_at.c +++ b/source/blender/nodes/texture/nodes/node_texture_at.c @@ -33,12 +33,12 @@ #include "node_texture_util.h" #include "NOD_texture.h" -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Texture"), 0.0f, 0.0f, 0.0f, 1.0f }, { SOCK_VECTOR, 1, N_("Coordinates"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Texture") }, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c index f6259962529..b4f81f08e43 100644 --- a/source/blender/nodes/texture/nodes/node_texture_bricks.c +++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c @@ -35,7 +35,7 @@ #include <math.h> -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Bricks 1"), 0.596f, 0.282f, 0.0f, 1.0f }, { SOCK_RGBA, 1, N_("Bricks 2"), 0.632f, 0.504f, 0.05f, 1.0f }, { SOCK_RGBA, 1, N_("Mortar"), 0.0f, 0.0f, 0.0f, 1.0f }, @@ -45,7 +45,7 @@ static bNodeSocketTemplate inputs[]= { { SOCK_FLOAT, 1, N_("Row Height"), 0.25f, 0.0f, 0.0f, 0.0f, 0.001f, 99.0f, PROP_UNSIGNED }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color")}, { -1, 0, "" } }; @@ -66,7 +66,7 @@ static float noise(int n) /* fast integer noise */ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) { - float *co = p->co; + const float *co = p->co; float x = co[0]; float y = co[1]; diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c index cd9c3170cf7..1f653d1f7b9 100644 --- a/source/blender/nodes/texture/nodes/node_texture_checker.c +++ b/source/blender/nodes/texture/nodes/node_texture_checker.c @@ -34,13 +34,13 @@ #include "NOD_texture.h" #include <math.h> -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color1"), 1.0f, 0.0f, 0.0f, 1.0f }, { SOCK_RGBA, 1, N_("Color2"), 1.0f, 1.0f, 1.0f, 1.0f }, { SOCK_FLOAT, 1, N_("Size"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f, PROP_UNSIGNED }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, { -1, 0, "" } }; @@ -62,7 +62,7 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** } else { tex_input_rgba(out, in[1], p, thread); - } + } } static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c index 1eaf9b2b0fe..41bfd0ae00a 100644 --- a/source/blender/nodes/texture/nodes/node_texture_common.c +++ b/source/blender/nodes/texture/nodes/node_texture_common.c @@ -148,128 +148,3 @@ void register_node_type_tex_group(bNodeTreeType *ttype) nodeRegisterType(ttype, &ntype); } - - -/**** FOR LOOP ****/ - -#if 0 /* XXX loop nodes don't work nicely with current trees */ -static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out) -{ - bNodeTreeExec *exec= (bNodeTreeExec*)nodedata; - bNodeThreadStack *nts; - int iterations= (int)in[0]->vec[0]; - bNodeSocket *sock; - bNodeStack *ns; - int iteration; - - /* XXX same behavior as trunk: all nodes inside group are executed. - * it's stupid, but just makes it work. compo redesign will do this better. - */ - { - bNode *inode; - for (inode=exec->nodetree->nodes.first; inode; inode=inode->next) - inode->need_exec = 1; - } - - nts = ntreeGetThreadStack(exec, thread); - - /* "Iteration" socket */ - sock = exec->nodetree->inputs.first; - ns = node_get_socket_stack(nts->stack, sock); - -// group_copy_inputs(node, in, nts->stack); - for (iteration=0; iteration < iterations; ++iteration) { - /* first input contains current iteration counter */ - ns->vec[0] = (float)iteration; - ns->vec[1]=ns->vec[2]=ns->vec[3] = 0.0f; - -// if (iteration > 0) -// loop_init_iteration(exec->nodetree, nts->stack); -// ntreeExecThreadNodes(exec, nts, data, thread); - } -// loop_copy_outputs(node, in, out, exec->stack); - - ntreeReleaseThreadStack(nts); -} - -void register_node_type_tex_forloop(bNodeTreeType *ttype) -{ - static bNodeType ntype; - - node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS); - node_type_socket_templates(&ntype, NULL, NULL); - node_type_size(&ntype, 120, 60, 200); - node_type_label(&ntype, node_group_label); - node_type_init(&ntype, node_forloop_init); - node_type_valid(&ntype, node_group_valid); - node_type_template(&ntype, node_forloop_template); - node_type_update(&ntype, NULL, node_group_verify); - node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree); - node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); - node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute); - - nodeRegisterType(ttype, &ntype); -} -#endif - -/**** WHILE LOOP ****/ - -#if 0 /* XXX loop nodes don't work nicely with current trees */ -static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out) -{ - bNodeTreeExec *exec= (bNodeTreeExec*)nodedata; - bNodeThreadStack *nts; - int condition= (in[0]->vec[0] > 0.0f); - bNodeSocket *sock; - bNodeStack *ns; - int iteration; - - /* XXX same behavior as trunk: all nodes inside group are executed. - * it's stupid, but just makes it work. compo redesign will do this better. - */ - { - bNode *inode; - for (inode=exec->nodetree->nodes.first; inode; inode=inode->next) - inode->need_exec = 1; - } - - nts = ntreeGetThreadStack(exec, thread); - - /* "Condition" socket */ - sock = exec->nodetree->outputs.first; - ns = node_get_socket_stack(nts->stack, sock); - - iteration = 0; -// group_copy_inputs(node, in, nts->stack); - while (condition && iteration < node->custom1) { -// if (iteration > 0) -// loop_init_iteration(exec->nodetree, nts->stack); -// ntreeExecThreadNodes(exec, nts, data, thread); - - condition = (ns->vec[0] > 0.0f); - ++iteration; - } -// loop_copy_outputs(node, in, out, exec->stack); - - ntreeReleaseThreadStack(nts); -} - -void register_node_type_tex_whileloop(bNodeTreeType *ttype) -{ - static bNodeType ntype; - - node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS); - node_type_socket_templates(&ntype, NULL, NULL); - node_type_size(&ntype, 120, 60, 200); - node_type_label(&ntype, node_group_label); - node_type_init(&ntype, node_whileloop_init); - node_type_valid(&ntype, node_group_valid); - node_type_template(&ntype, node_whileloop_template); - node_type_update(&ntype, NULL, node_group_verify); - node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree); - node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); - node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute); - - nodeRegisterType(ttype, &ntype); -} -#endif diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c index 77521190590..25da4f19e52 100644 --- a/source/blender/nodes/texture/nodes/node_texture_compose.c +++ b/source/blender/nodes/texture/nodes/node_texture_compose.c @@ -33,14 +33,14 @@ #include "node_texture_util.h" #include "NOD_texture.h" -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Red"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Green"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Blue"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c index 2add5c820eb..971520ebc38 100644 --- a/source/blender/nodes/texture/nodes/node_texture_coord.c +++ b/source/blender/nodes/texture/nodes/node_texture_coord.c @@ -33,7 +33,7 @@ #include "node_texture_util.h" #include "NOD_texture.h" -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_VECTOR, 0, N_("Coordinates") }, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c index 6ccb5e1e83f..5980f938938 100644 --- a/source/blender/nodes/texture/nodes/node_texture_curves.c +++ b/source/blender/nodes/texture/nodes/node_texture_curves.c @@ -36,7 +36,7 @@ /* **************** CURVE Time ******************** */ /* custom1 = sfra, custom2 = efra */ -static bNodeSocketTemplate time_outputs[]= { +static bNodeSocketTemplate time_outputs[] = { { SOCK_FLOAT, 0, N_("Value") }, { -1, 0, "" } }; @@ -83,12 +83,12 @@ void register_node_type_tex_curve_time(bNodeTreeType *ttype) } /* **************** CURVE RGB ******************** */ -static bNodeSocketTemplate rgb_inputs[]= { +static bNodeSocketTemplate rgb_inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { -1, 0, "" } }; -static bNodeSocketTemplate rgb_outputs[]= { +static bNodeSocketTemplate rgb_outputs[] = { { SOCK_RGBA, 0, N_("Color")}, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c index eae34e2ce47..a2875c31d9e 100644 --- a/source/blender/nodes/texture/nodes/node_texture_decompose.c +++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c @@ -34,11 +34,11 @@ #include "NOD_texture.h" #include <math.h> -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_FLOAT, 0, N_("Red") }, { SOCK_FLOAT, 0, N_("Green") }, { SOCK_FLOAT, 0, N_("Blue") }, diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c index 29f08a0ded0..8c3b1555d5d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_distance.c +++ b/source/blender/nodes/texture/nodes/node_texture_distance.c @@ -35,13 +35,13 @@ #include "node_texture_util.h" #include "NOD_texture.h" -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_VECTOR, 1, N_("Coordinate 1"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE }, { SOCK_VECTOR, 1, N_("Coordinate 2"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE }, - { -1, 0, "" } + { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_FLOAT, 0, N_("Value") }, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c index 6863eab9150..b5e9969a830 100644 --- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c +++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c @@ -34,7 +34,7 @@ #include "NOD_texture.h" -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Hue"), 0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.5f, PROP_NONE }, { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR }, { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR }, @@ -42,7 +42,7 @@ static bNodeSocketTemplate inputs[]= { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, { -1, 0, "" } }; @@ -56,14 +56,14 @@ static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat hsv[0]+= (hue - 0.5f); if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f; hsv[1]*= sat; - if (hsv[1]>1.0f) hsv[1]= 1.0f; else if (hsv[1]<0.0f) hsv[1]= 0.0f; + if (hsv[1]>1.0f) hsv[1] = 1.0f; else if (hsv[1]<0.0f) hsv[1] = 0.0f; hsv[2]*= val; - if (hsv[2]>1.0f) hsv[2]= 1.0f; else if (hsv[2]<0.0f) hsv[2]= 0.0f; + if (hsv[2]>1.0f) hsv[2] = 1.0f; else if (hsv[2]<0.0f) hsv[2] = 0.0f; hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); - out[0]= mfac*in[0] + fac*col[0]; - out[1]= mfac*in[1] + fac*col[1]; - out[2]= mfac*in[2] + fac*col[2]; + out[0] = mfac*in[0] + fac*col[0]; + out[1] = mfac*in[1] + fac*col[1]; + out[2] = mfac*in[2] + fac*col[2]; } else { copy_v4_v4(out, in); diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c index 7ce91c37295..f3fdaf0bb64 100644 --- a/source/blender/nodes/texture/nodes/node_texture_image.c +++ b/source/blender/nodes/texture/nodes/node_texture_image.c @@ -33,7 +33,7 @@ #include "node_texture_util.h" #include "NOD_texture.h" -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Image")}, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c index 0339c3f0cf2..9c2963d2dc2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_invert.c +++ b/source/blender/nodes/texture/nodes/node_texture_invert.c @@ -34,14 +34,14 @@ #include "NOD_texture.h" /* **************** INVERT ******************** */ -static bNodeSocketTemplate inputs[]= { - { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } +static bNodeSocketTemplate inputs[] = { + { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { - { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } +static bNodeSocketTemplate outputs[] = { + { SOCK_RGBA, 0, N_("Color")}, + { -1, 0, "" } }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 36e9cac0827..95d70ccc7d6 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -35,15 +35,15 @@ /* **************** SCALAR MATH ******************** */ -static bNodeSocketTemplate inputs[]= { - { SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, - { SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, - { -1, 0, "" } +static bNodeSocketTemplate inputs[] = { + { SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, + { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { - { SOCK_FLOAT, 0, N_("Value")}, - { -1, 0, "" } +static bNodeSocketTemplate outputs[] = { + { SOCK_FLOAT, 0, N_("Value")}, + { -1, 0, "" } }; static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) @@ -112,7 +112,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor { /* Only raise negative numbers by full integers */ if ( in0 >= 0 ) { - out[0]= pow(in0, in1); + out[0] = pow(in0, in1); } else { float y_mod_1 = fmod(in1, 1); @@ -178,7 +178,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor fprintf(stderr, "%s:%d: unhandeld value in switch statement: %d\n", __FILE__, __LINE__, node->custom1); - } + } } static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c index bf6cb7a3262..fe04854c734 100644 --- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c @@ -34,13 +34,13 @@ #include "NOD_texture.h" /* **************** MIX RGB ******************** */ -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Factor"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR }, { SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f }, { SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index ce22bc00a55..2f5efe8c45e 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -34,7 +34,7 @@ #include "NOD_texture.h" /* **************** COMPOSITE ******************** */ -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION}, { -1, 0, "" } @@ -65,7 +65,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o tex_input_rgba(&target->tr, in[0], ¶ms, cdata->thread); target->tin = (target->tr + target->tg + target->tb) / 3.0f; - target->talpha = 1; + target->talpha = TRUE; if (target->nor) { if (in[1] && in[1]->hasinput) @@ -170,7 +170,7 @@ void register_node_type_tex_output(bNodeTreeType *ttype) node_type_exec(&ntype, exec); /* Do not allow muting output. */ - node_type_internal_connect(&ntype, NULL); + node_type_internal_links(&ntype, NULL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c index 102f6e1c428..8876d98b9b2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_proc.c +++ b/source/blender/nodes/texture/nodes/node_texture_proc.c @@ -40,12 +40,12 @@ */ -static bNodeSocketTemplate outputs_both[]= { +static bNodeSocketTemplate outputs_both[] = { { SOCK_RGBA, 0, N_("Color"), 1.0f, 0.0f, 0.0f, 1.0f }, { SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs_color_only[]= { +static bNodeSocketTemplate outputs_color_only[] = { { SOCK_RGBA, 0, N_("Color") }, { -1, 0, "" } }; @@ -57,7 +57,7 @@ static bNodeSocketTemplate outputs_color_only[]= { { SOCK_RGBA, 1, "Color 2", 1.0f, 1.0f, 1.0f, 1.0f } /* Calls multitex and copies the result to the outputs. Called by xxx_exec, which handles inputs. */ -static void do_proc(float *result, TexParams *p, float *col1, float *col2, char is_normal, Tex *tex, short thread) +static void do_proc(float *result, TexParams *p, const float col1[4], const float col2[4], char is_normal, Tex *tex, const short thread) { TexResult texres; int textype; @@ -69,7 +69,7 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char texres.nor = NULL; textype = multitex_nodes(tex, p->co, p->dxt, p->dyt, p->osatex, - &texres, thread, 0, p->shi, p->mtex); + &texres, thread, 0, p->shi, p->mtex); if (is_normal) return; @@ -83,7 +83,7 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char } } -typedef void (*MapFn) (Tex *tex, bNodeStack **in, TexParams *p, short thread); +typedef void (*MapFn) (Tex *tex, bNodeStack **in, TexParams *p, const short thread); static void texfn( float *result, @@ -138,7 +138,7 @@ static int count_outputs(bNode *node) /* --- VORONOI -- */ -static bNodeSocketTemplate voronoi_inputs[]= { +static bNodeSocketTemplate voronoi_inputs[] = { COMMON_INPUTS, { SOCK_FLOAT, 1, N_("W1"), 1.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE }, { SOCK_FLOAT, 1, N_("W2"), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE }, @@ -163,7 +163,7 @@ static void voronoi_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short th ProcDef(voronoi) /* --- BLEND -- */ -static bNodeSocketTemplate blend_inputs[]= { +static bNodeSocketTemplate blend_inputs[] = { COMMON_INPUTS, { -1, 0, "" } }; @@ -171,7 +171,7 @@ ProcNoInputs(blend) ProcDef(blend) /* -- MAGIC -- */ -static bNodeSocketTemplate magic_inputs[]= { +static bNodeSocketTemplate magic_inputs[] = { COMMON_INPUTS, { SOCK_FLOAT, 1, N_("Turbulence"), 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED }, { -1, 0, "" } @@ -183,7 +183,7 @@ static void magic_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thre ProcDef(magic) /* --- MARBLE --- */ -static bNodeSocketTemplate marble_inputs[]= { +static bNodeSocketTemplate marble_inputs[] = { COMMON_INPUTS, { SOCK_FLOAT, 1, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Turbulence"), 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED }, @@ -197,7 +197,7 @@ static void marble_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thr ProcDef(marble) /* --- CLOUDS --- */ -static bNodeSocketTemplate clouds_inputs[]= { +static bNodeSocketTemplate clouds_inputs[] = { COMMON_INPUTS, { SOCK_FLOAT, 1, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED }, { -1, 0, "" } @@ -209,7 +209,7 @@ static void clouds_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thr ProcDef(clouds) /* --- DISTORTED NOISE --- */ -static bNodeSocketTemplate distnoise_inputs[]= { +static bNodeSocketTemplate distnoise_inputs[] = { COMMON_INPUTS, { SOCK_FLOAT, 1, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Distortion"), 1.00f, 0.0f, 0.0f, 0.0f, 0.0000f, 10.0f, PROP_UNSIGNED }, @@ -223,7 +223,7 @@ static void distnoise_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short ProcDef(distnoise) /* --- WOOD --- */ -static bNodeSocketTemplate wood_inputs[]= { +static bNodeSocketTemplate wood_inputs[] = { COMMON_INPUTS, { SOCK_FLOAT, 1, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Turbulence"), 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED }, @@ -237,7 +237,7 @@ static void wood_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short threa ProcDef(wood) /* --- MUSGRAVE --- */ -static bNodeSocketTemplate musgrave_inputs[]= { +static bNodeSocketTemplate musgrave_inputs[] = { COMMON_INPUTS, { SOCK_FLOAT, 1, N_("H"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Lacunarity"), 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6.0f, PROP_UNSIGNED }, @@ -258,7 +258,7 @@ static void musgrave_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short t ProcDef(musgrave) /* --- NOISE --- */ -static bNodeSocketTemplate noise_inputs[]= { +static bNodeSocketTemplate noise_inputs[] = { COMMON_INPUTS, { -1, 0, "" } }; @@ -266,7 +266,7 @@ ProcNoInputs(noise) ProcDef(noise) /* --- STUCCI --- */ -static bNodeSocketTemplate stucci_inputs[]= { +static bNodeSocketTemplate stucci_inputs[] = { COMMON_INPUTS, { SOCK_FLOAT, 1, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Turbulence"), 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED }, diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c index a7832c8c180..1b1d57044a3 100644 --- a/source/blender/nodes/texture/nodes/node_texture_rotate.c +++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c @@ -35,19 +35,19 @@ #include "node_texture_util.h" #include "NOD_texture.h" -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Turns"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE }, { SOCK_VECTOR, 1, N_("Axis"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION }, - { -1, 0, "" } + { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { - { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } +static bNodeSocketTemplate outputs[] = { + { SOCK_RGBA, 0, N_("Color")}, + { -1, 0, "" } }; -static void rotate(float new_co[3], float a, float ax[3], float co[3]) +static void rotate(float new_co[3], float a, float ax[3], const float co[3]) { float para[3]; float perp[3]; diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c index 130a21ba84d..56562724fb9 100644 --- a/source/blender/nodes/texture/nodes/node_texture_scale.c +++ b/source/blender/nodes/texture/nodes/node_texture_scale.c @@ -33,15 +33,15 @@ #include <math.h> #include "node_texture_util.h" -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f }, { SOCK_VECTOR, 1, N_("Scale"), 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f, PROP_XYZ }, - { -1, 0, "" } + { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { - { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } +static bNodeSocketTemplate outputs[] = { + { SOCK_RGBA, 0, N_("Color")}, + { -1, 0, "" } }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c index 4832f19f2c7..cc7367a7632 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.c +++ b/source/blender/nodes/texture/nodes/node_texture_texture.c @@ -35,13 +35,13 @@ #include "RE_shader_ext.h" -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color1"), 1.0f, 1.0f, 1.0f, 1.0f }, { SOCK_RGBA, 1, N_("Color2"), 0.0f, 0.0f, 0.0f, 1.0f }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c index 85f857ca2be..a95cb00a47d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_translate.c +++ b/source/blender/nodes/texture/nodes/node_texture_translate.c @@ -34,15 +34,15 @@ #include "node_texture_util.h" #include "NOD_texture.h" -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 1, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_TRANSLATION }, - { -1, 0, "" } + { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { - { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } +static bNodeSocketTemplate outputs[] = { + { SOCK_RGBA, 0, N_("Color")}, + { -1, 0, "" } }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c index 2d107b87578..bbfc1fa616b 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToNor.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c @@ -33,23 +33,23 @@ #include "node_texture_util.h" #include "NOD_texture.h" -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE }, { SOCK_FLOAT, 1, N_("Nabla"), 0.025f, 0.0f, 0.0f, 0.0f, 0.001f, 0.1f, PROP_UNSIGNED }, - { -1, 0, "" } + { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { - { SOCK_VECTOR, 0, N_("Normal") }, - { -1, 0, "" } +static bNodeSocketTemplate outputs[] = { + { SOCK_VECTOR, 0, N_("Normal") }, + { -1, 0, "" } }; static void normalfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float new_co[3]; - float *co = p->co; + const float *co = p->co; - float nabla = tex_input_value(in[1], p, thread); + float nabla = tex_input_value(in[1], p, thread); float val; float nor[3]; diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c index 515613509f6..78635453fc1 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c @@ -34,11 +34,11 @@ #include "NOD_texture.h" /* **************** VALTORGB ******************** */ -static bNodeSocketTemplate valtorgb_in[]= { +static bNodeSocketTemplate valtorgb_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { -1, 0, "" } }; -static bNodeSocketTemplate valtorgb_out[]= { +static bNodeSocketTemplate valtorgb_out[] = { { SOCK_RGBA, 0, N_("Color")}, { -1, 0, "" } }; @@ -77,11 +77,11 @@ void register_node_type_tex_valtorgb(bNodeTreeType *ttype) } /* **************** RGBTOBW ******************** */ -static bNodeSocketTemplate rgbtobw_in[]= { +static bNodeSocketTemplate rgbtobw_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f}, { -1, 0, "" } }; -static bNodeSocketTemplate rgbtobw_out[]= { +static bNodeSocketTemplate rgbtobw_out[] = { { SOCK_FLOAT, 0, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c index bc31bef59d8..5cb8d8c438c 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.c +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c @@ -66,7 +66,7 @@ void register_node_type_tex_viewer(bNodeTreeType *ttype) node_type_exec(&ntype, exec); /* Do not allow muting viewer node. */ - node_type_internal_connect(&ntype, NULL); + node_type_internal_links(&ntype, NULL); nodeRegisterType(ttype, &ntype); } |