Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/shader')
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c40
-rw-r--r--source/blender/nodes/shader/node_shader_util.c64
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_camera.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_dynamic.c6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_geom.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hueSatVal.c4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mapping.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_material.c64
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.c40
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output.c8
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_checker.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.c4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_gradient.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.c4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_magic.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_noise.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_sky.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_wave.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_texture.c18
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_valToRgb.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vectMath.c16
24 files changed, 162 insertions, 160 deletions
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index e12ac4dee49..c028ca83664 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -65,16 +65,16 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
Lamp *la;
World *wo;
- for(ma= main->mat.first; ma; ma= ma->id.next)
- if(ma->nodetree)
+ for (ma= main->mat.first; ma; ma= ma->id.next)
+ if (ma->nodetree)
func(calldata, &ma->id, ma->nodetree);
- for(la= main->lamp.first; la; la= la->id.next)
- if(la->nodetree)
+ for (la= main->lamp.first; la; la= la->id.next)
+ if (la->nodetree)
func(calldata, &la->id, la->nodetree);
- for(wo= main->world.first; wo; wo= wo->id.next)
- if(wo->nodetree)
+ for (wo= main->world.first; wo; wo= wo->id.next)
+ if (wo->nodetree)
func(calldata, &wo->id, wo->nodetree);
}
@@ -83,7 +83,7 @@ static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback f
func(calldata, NODE_CLASS_INPUT, IFACE_("Input"));
func(calldata, NODE_CLASS_OUTPUT, IFACE_("Output"));
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
func(calldata, NODE_CLASS_SHADER, IFACE_("Shader"));
func(calldata, NODE_CLASS_TEXTURE, IFACE_("Texture"));
}
@@ -115,12 +115,12 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
bNode *lnode;
/* copy over contents of previews */
- for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
- if(ntreeNodeExists(ntree, lnode->new_node)) {
+ for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if (ntreeNodeExists(ntree, lnode->new_node)) {
bNode *node= lnode->new_node;
- if(node->preview && node->preview->rect) {
- if(lnode->preview && lnode->preview->rect) {
+ if (node->preview && node->preview->rect) {
+ if (lnode->preview && lnode->preview->rect) {
int xsize= node->preview->xsize;
int ysize= node->preview->ysize;
memcpy(node->preview->rect, lnode->preview->rect, 4*xsize + xsize*ysize*sizeof(char)*4);
@@ -202,7 +202,7 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree, int use_tree_data)
/* allocate the thread stack listbase array */
exec->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array");
- for(node= exec->nodetree->nodes.first; node; node= node->next)
+ for (node= exec->nodetree->nodes.first; node; node= node->next)
node->need_exec= 1;
if (use_tree_data) {
@@ -220,14 +220,14 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree, int use_tree_data)
*/
void ntreeShaderEndExecTree(bNodeTreeExec *exec, int use_tree_data)
{
- if(exec) {
+ if (exec) {
bNodeTree *ntree= exec->nodetree;
bNodeThreadStack *nts;
int a;
- if(exec->threadstack) {
- for(a=0; a<BLENDER_MAX_THREADS; a++) {
- for(nts=exec->threadstack[a].first; nts; nts=nts->next)
+ if (exec->threadstack) {
+ for (a=0; a<BLENDER_MAX_THREADS; a++) {
+ for (nts=exec->threadstack[a].first; nts; nts=nts->next)
if (nts->stack) MEM_freeN(nts->stack);
BLI_freelistN(&exec->threadstack[a]);
}
@@ -266,7 +266,7 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
/* ensure execdata is only initialized once */
if (!exec) {
BLI_lock_thread(LOCK_NODES);
- if(!ntree->execdata)
+ if (!ntree->execdata)
ntree->execdata = ntreeShaderBeginExecTree(ntree, 1);
BLI_unlock_thread(LOCK_NODES);
@@ -280,7 +280,7 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
// \note: set material back to preserved material
shi->mat = mat;
/* better not allow negative for now */
- if(shr->combined[0]<0.0f) shr->combined[0]= 0.0f;
- if(shr->combined[1]<0.0f) shr->combined[1]= 0.0f;
- if(shr->combined[2]<0.0f) shr->combined[2]= 0.0f;
+ if (shr->combined[0]<0.0f) shr->combined[0]= 0.0f;
+ if (shr->combined[1]<0.0f) shr->combined[1]= 0.0f;
+ if (shr->combined[2]<0.0f) shr->combined[2]= 0.0f;
}
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 606ba98762c..df2f7879231 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -42,14 +42,14 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
{
float *from= ns->vec;
- if(type_in==SOCK_FLOAT) {
- if(ns->sockettype==SOCK_FLOAT)
+ if (type_in==SOCK_FLOAT) {
+ if (ns->sockettype==SOCK_FLOAT)
*in= *from;
else
*in= 0.333333f*(from[0]+from[1]+from[2]);
}
- else if(type_in==SOCK_VECTOR) {
- if(ns->sockettype==SOCK_FLOAT) {
+ else if (type_in==SOCK_VECTOR) {
+ if (ns->sockettype==SOCK_FLOAT) {
in[0]= from[0];
in[1]= from[0];
in[2]= from[0];
@@ -59,10 +59,10 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
}
}
else { /* type_in==SOCK_RGBA */
- if(ns->sockettype==SOCK_RGBA) {
+ if (ns->sockettype==SOCK_RGBA) {
copy_v4_v4(in, from);
}
- else if(ns->sockettype==SOCK_FLOAT) {
+ else if (ns->sockettype==SOCK_FLOAT) {
in[0]= from[0];
in[1]= from[0];
in[2]= from[0];
@@ -84,22 +84,22 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
bNodeSocket *sock;
int a;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==SH_NODE_TEXTURE) {
- if((r_mode & R_OSA) && node->id) {
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==SH_NODE_TEXTURE) {
+ if ((r_mode & R_OSA) && node->id) {
Tex *tex= (Tex *)node->id;
if ELEM3(tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)
*texco |= TEXCO_OSA|NEED_UV;
}
/* usability exception... without input we still give the node orcos */
sock= node->inputs.first;
- if(sock==NULL || sock->link==NULL)
+ if (sock==NULL || sock->link==NULL)
*texco |= TEXCO_ORCO|NEED_UV;
}
- else if(node->type==SH_NODE_GEOMETRY) {
+ else if (node->type==SH_NODE_GEOMETRY) {
/* note; sockets always exist for the given type! */
- for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
- if(sock->flag & SOCK_IN_USE) {
+ for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+ if (sock->flag & SOCK_IN_USE) {
switch(a) {
case GEOM_OUT_GLOB:
*texco |= TEXCO_GLOB|NEED_UV; break;
@@ -125,17 +125,17 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
/* nodes that use ID data get synced with local data */
void nodeShaderSynchronizeID(bNode *node, int copyto)
{
- if(node->id==NULL) return;
+ if (node->id==NULL) return;
- if(ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
+ if (ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
bNodeSocket *sock;
Material *ma= (Material *)node->id;
int a;
/* hrmf, case in loop isn't super fast, but we don't edit 100s of material at same time either! */
- for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
- if(!nodeSocketIsHidden(sock)) {
- if(copyto) {
+ for (a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
+ if (!nodeSocketIsHidden(sock)) {
+ if (copyto) {
switch(a) {
case MAT_IN_COLOR:
copy_v3_v3(&ma->r, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
@@ -249,19 +249,19 @@ bNode *nodeGetActiveTexture(bNodeTree *ntree)
/* this is the node we texture paint and draw in textured draw */
bNode *node;
- if(!ntree)
+ if (!ntree)
return NULL;
/* check for group edit */
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & NODE_GROUP_EDIT)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->flag & NODE_GROUP_EDIT)
break;
- if(node)
+ if (node)
ntree= (bNodeTree*)node->id;
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & NODE_ACTIVE_TEXTURE)
+ for (node= ntree->nodes.first; node; node= node->next)
+ if (node->flag & NODE_ACTIVE_TEXTURE)
return node;
return NULL;
@@ -280,31 +280,31 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
stack= exec->stack;
- for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
node = nodeexec->node;
doit = 0;
/* for groups, only execute outputs for edited group */
- if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
- if(do_outputs && (node->flag & NODE_DO_OUTPUT))
+ if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+ if (do_outputs && (node->flag & NODE_DO_OUTPUT))
doit = 1;
}
else
doit = 1;
if (doit) {
- if(node->typeinfo->gpufunc) {
+ if (node->typeinfo->gpufunc) {
node_get_stack(node, stack, nsin, nsout);
gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
- if(node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
+ if (node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
}
- else if(node->typeinfo->gpuextfunc) {
+ else if (node->typeinfo->gpuextfunc) {
node_get_stack(node, stack, nsin, nsout);
gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
- if(node->typeinfo->gpuextfunc(mat, node, nodeexec->data, gpuin, gpuout))
+ if (node->typeinfo->gpuextfunc(mat, node, nodeexec->data, gpuin, gpuout))
data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
}
}
@@ -318,7 +318,7 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in
float domin= (texmap->flag & TEXMAP_CLIP_MIN) != 0;
float domax= (texmap->flag & TEXMAP_CLIP_MAX) != 0;
- if(domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) {
+ if (domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) {
GPUNodeLink *tmat = GPU_uniform((float*)texmap->mat);
GPUNodeLink *tmin = GPU_uniform(texmap->min);
GPUNodeLink *tmax = GPU_uniform(texmap->max);
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c
index 3ec75dfa4fd..69a6a5c04a9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_camera.c
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.c
@@ -43,7 +43,7 @@ static bNodeSocketTemplate sh_node_camera_out[]= {
static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **out)
{
- if(data) {
+ if (data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi; /* Data we need for shading. */
copy_v3_v3(out[0]->vec, shi->co); /* get view vector */
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index d30434f4e32..50bf4c58e4d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -106,7 +106,7 @@ static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeSta
/* stack order output: vec */
nodestack_get_vec(vec, SOCK_VECTOR, in[1]);
curvemapping_evaluateRGBF(node->storage, out[0]->vec, vec);
- if(in[0]->vec[0] != 1.0f) {
+ if (in[0]->vec[0] != 1.0f) {
interp_v3_v3v3(out[0]->vec, vec, out[0]->vec, *in[0]->vec);
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_dynamic.c b/source/blender/nodes/shader/nodes/node_shader_dynamic.c
index 0c6c53b38e4..805a7e54f04 100644
--- a/source/blender/nodes/shader/nodes/node_shader_dynamic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_dynamic.c
@@ -459,7 +459,8 @@ static int node_dynamic_parse(struct bNode *node)
if (!pyresult) {
if (BTST(node->custom1, NODE_DYNAMIC_LOADED)) {
node_dynamic_disable(node);
- } else {
+ }
+ else {
node_dynamic_disable_all_by_id(node->id);
}
node_dynamic_pyerror_print(node);
@@ -574,7 +575,8 @@ static void node_dynamic_setup(bNode *node)
}
else { nodeMakeDynamicType(node); }
- } else {
+ }
+ else {
node_dynamic_rem_all_links(node->typeinfo);
node_dynamic_free_typeinfo_sockets(node->typeinfo);
node_dynamic_update_socket_links(node, NULL);
diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c
index cf6f400ee2a..37ab8ac3f5b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geom.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geom.c
@@ -53,17 +53,17 @@ static bNodeSocketTemplate sh_node_geom_out[]= {
/* node execute callback */
static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
- if(data) {
+ if (data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi;
NodeGeometry *ngeo= (NodeGeometry*)node->storage;
ShadeInputUV *suv= &shi->uv[shi->actuv];
static float defaultvcol[4] = {1.0f, 1.0f, 1.0f, 1.0f};
int i;
- if(ngeo->uvname[0]) {
+ if (ngeo->uvname[0]) {
/* find uv map by name */
- for(i = 0; i < shi->totuv; i++) {
- if(strcmp(shi->uv[i].name, ngeo->uvname)==0) {
+ for (i = 0; i < shi->totuv; i++) {
+ if (strcmp(shi->uv[i].name, ngeo->uvname)==0) {
suv= &shi->uv[i];
break;
}
@@ -82,9 +82,9 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
/* find vertex color layer by name */
ShadeInputCol *scol= &shi->col[0];
- if(ngeo->colname[0]) {
- for(i = 0; i < shi->totcol; i++) {
- if(strcmp(shi->col[i].name, ngeo->colname)==0) {
+ if (ngeo->colname[0]) {
+ for (i = 0; i < shi->totcol; i++) {
+ if (strcmp(shi->col[i].name, ngeo->colname)==0) {
scol= &shi->col[i];
break;
}
@@ -100,7 +100,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
out[GEOM_OUT_VCOL_ALPHA]->vec[0]= 1.0f;
}
- if(shi->osatex) {
+ if (shi->osatex) {
out[GEOM_OUT_GLOB]->data= shi->dxgl;
out[GEOM_OUT_GLOB]->datatype= NS_OSA_VECTORS;
out[GEOM_OUT_LOCAL]->data= shi->dxco;
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
index 0f85196a45d..12b97e65be8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
@@ -50,12 +50,12 @@ static bNodeSocketTemplate sh_node_hue_sat_out[]= {
/* note: it would be possible to use CMP version for both nodes */
static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac)
{
- if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) {
+ if (*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) {
float col[3], hsv[3], mfac= 1.0f - *fac;
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
hsv[0]+= (*hue - 0.5f);
- if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f;
+ if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f;
hsv[1]*= *sat;
hsv[2]*= *val;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index c2a58d49161..b7b080fa2df 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -54,15 +54,15 @@ static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
mul_m4_v3(texmap->mat, vec);
- if(texmap->flag & TEXMAP_CLIP_MIN) {
- if(vec[0]<texmap->min[0]) vec[0]= texmap->min[0];
- if(vec[1]<texmap->min[1]) vec[1]= texmap->min[1];
- if(vec[2]<texmap->min[2]) vec[2]= texmap->min[2];
+ if (texmap->flag & TEXMAP_CLIP_MIN) {
+ if (vec[0]<texmap->min[0]) vec[0]= texmap->min[0];
+ if (vec[1]<texmap->min[1]) vec[1]= texmap->min[1];
+ if (vec[2]<texmap->min[2]) vec[2]= texmap->min[2];
}
- if(texmap->flag & TEXMAP_CLIP_MAX) {
- if(vec[0]>texmap->max[0]) vec[0]= texmap->max[0];
- if(vec[1]>texmap->max[1]) vec[1]= texmap->max[1];
- if(vec[2]>texmap->max[2]) vec[2]= texmap->max[2];
+ if (texmap->flag & TEXMAP_CLIP_MAX) {
+ if (vec[0]>texmap->max[0]) vec[0]= texmap->max[0];
+ if (vec[1]>texmap->max[1]) vec[1]= texmap->max[1];
+ if (vec[2]>texmap->max[2]) vec[2]= texmap->max[2];
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c
index decd3bb225f..279bbfa8d1b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_material.c
@@ -78,7 +78,7 @@ static bNodeSocketTemplate sh_node_material_ext_out[]= {
static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(data && node->id) {
+ if (data && node->id) {
ShadeResult shrnode;
ShadeInput *shi;
ShaderCallData *shcd= data;
@@ -103,17 +103,17 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
shi->har= shi->mat->har;
/* write values */
- if(hasinput[MAT_IN_COLOR])
+ if (hasinput[MAT_IN_COLOR])
nodestack_get_vec(&shi->r, SOCK_VECTOR, in[MAT_IN_COLOR]);
- if(hasinput[MAT_IN_SPEC])
+ if (hasinput[MAT_IN_SPEC])
nodestack_get_vec(&shi->specr, SOCK_VECTOR, in[MAT_IN_SPEC]);
- if(hasinput[MAT_IN_REFL])
+ if (hasinput[MAT_IN_REFL])
nodestack_get_vec(&shi->refl, SOCK_FLOAT, in[MAT_IN_REFL]);
/* retrieve normal */
- if(hasinput[MAT_IN_NORMAL]) {
+ if (hasinput[MAT_IN_NORMAL]) {
nodestack_get_vec(shi->vn, SOCK_VECTOR, in[MAT_IN_NORMAL]);
normalize_v3(shi->vn);
}
@@ -121,24 +121,24 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
copy_v3_v3(shi->vn, shi->vno);
/* custom option to flip normal */
- if(node->custom1 & SH_NODE_MAT_NEG) {
+ if (node->custom1 & SH_NODE_MAT_NEG) {
negate_v3(shi->vn);
}
if (node->type == SH_NODE_MATERIAL_EXT) {
- if(hasinput[MAT_IN_MIR])
+ if (hasinput[MAT_IN_MIR])
nodestack_get_vec(&shi->mirr, SOCK_VECTOR, in[MAT_IN_MIR]);
- if(hasinput[MAT_IN_AMB])
+ if (hasinput[MAT_IN_AMB])
nodestack_get_vec(&shi->amb, SOCK_FLOAT, in[MAT_IN_AMB]);
- if(hasinput[MAT_IN_EMIT])
+ if (hasinput[MAT_IN_EMIT])
nodestack_get_vec(&shi->emit, SOCK_FLOAT, in[MAT_IN_EMIT]);
- if(hasinput[MAT_IN_SPECTRA])
+ if (hasinput[MAT_IN_SPECTRA])
nodestack_get_vec(&shi->spectra, SOCK_FLOAT, in[MAT_IN_SPECTRA]);
- if(hasinput[MAT_IN_RAY_MIRROR])
+ if (hasinput[MAT_IN_RAY_MIRROR])
nodestack_get_vec(&shi->ray_mirror, SOCK_FLOAT, in[MAT_IN_RAY_MIRROR]);
- if(hasinput[MAT_IN_ALPHA])
+ if (hasinput[MAT_IN_ALPHA])
nodestack_get_vec(&shi->alpha, SOCK_FLOAT, in[MAT_IN_ALPHA]);
- if(hasinput[MAT_IN_TRANSLUCENCY])
+ if (hasinput[MAT_IN_TRANSLUCENCY])
nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]);
}
@@ -147,13 +147,13 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
shi->nodes= 0;
/* write to outputs */
- if(node->custom1 & SH_NODE_MAT_DIFF) {
+ if (node->custom1 & SH_NODE_MAT_DIFF) {
copy_v3_v3(col, shrnode.combined);
- if(!(node->custom1 & SH_NODE_MAT_SPEC)) {
+ if (!(node->custom1 & SH_NODE_MAT_SPEC)) {
sub_v3_v3(col, shrnode.spec);
}
}
- else if(node->custom1 & SH_NODE_MAT_SPEC) {
+ else if (node->custom1 & SH_NODE_MAT_SPEC) {
copy_v3_v3(col, shrnode.spec);
}
else
@@ -161,13 +161,13 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
col[3]= shrnode.alpha;
- if(shi->do_preview)
+ if (shi->do_preview)
nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage);
copy_v3_v3(out[MAT_OUT_COLOR]->vec, col);
out[MAT_OUT_ALPHA]->vec[0]= shrnode.alpha;
- if(node->custom1 & SH_NODE_MAT_NEG) {
+ if (node->custom1 & SH_NODE_MAT_NEG) {
shi->vn[0]= -shi->vn[0];
shi->vn[1]= -shi->vn[1];
shi->vn[2]= -shi->vn[2];
@@ -185,7 +185,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
}
/* copy passes, now just active node */
- if(node->flag & NODE_ACTIVE_ID) {
+ if (node->flag & NODE_ACTIVE_ID) {
float combined[4], alpha;
copy_v4_v4(combined, shcd->shr->combined);
@@ -218,7 +218,7 @@ static GPUNodeLink *gpu_get_input_link(GPUNodeStack *in)
static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(node->id) {
+ if (node->id) {
GPUShadeInput shi;
GPUShadeResult shr;
bNodeSocket *sock;
@@ -235,47 +235,47 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
GPU_shadeinput_set(mat, (Material*)node->id, &shi);
/* write values */
- if(hasinput[MAT_IN_COLOR])
+ if (hasinput[MAT_IN_COLOR])
shi.rgb = gpu_get_input_link(&in[MAT_IN_COLOR]);
- if(hasinput[MAT_IN_SPEC])
+ if (hasinput[MAT_IN_SPEC])
shi.specrgb = gpu_get_input_link(&in[MAT_IN_SPEC]);
- if(hasinput[MAT_IN_REFL])
+ if (hasinput[MAT_IN_REFL])
shi.refl = gpu_get_input_link(&in[MAT_IN_REFL]);
/* retrieve normal */
- if(hasinput[MAT_IN_NORMAL]) {
+ if (hasinput[MAT_IN_NORMAL]) {
GPUNodeLink *tmp;
shi.vn = gpu_get_input_link(&in[MAT_IN_NORMAL]);
GPU_link(mat, "vec_math_normalize", shi.vn, &shi.vn, &tmp);
}
/* custom option to flip normal */
- if(node->custom1 & SH_NODE_MAT_NEG)
+ if (node->custom1 & SH_NODE_MAT_NEG)
GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn);
if (node->type == SH_NODE_MATERIAL_EXT) {
- if(hasinput[MAT_IN_AMB])
+ if (hasinput[MAT_IN_AMB])
shi.amb= gpu_get_input_link(&in[MAT_IN_AMB]);
- if(hasinput[MAT_IN_EMIT])
+ if (hasinput[MAT_IN_EMIT])
shi.emit= gpu_get_input_link(&in[MAT_IN_EMIT]);
- if(hasinput[MAT_IN_ALPHA])
+ if (hasinput[MAT_IN_ALPHA])
shi.alpha= gpu_get_input_link(&in[MAT_IN_ALPHA]);
}
GPU_shaderesult_set(&shi, &shr); /* clears shr */
/* write to outputs */
- if(node->custom1 & SH_NODE_MAT_DIFF) {
+ if (node->custom1 & SH_NODE_MAT_DIFF) {
out[MAT_OUT_COLOR].link= shr.combined;
- if(!(node->custom1 & SH_NODE_MAT_SPEC)) {
+ if (!(node->custom1 & SH_NODE_MAT_SPEC)) {
GPUNodeLink *link;
GPU_link(mat, "vec_math_sub", shr.combined, shr.spec, &out[MAT_OUT_COLOR].link, &link);
}
}
- else if(node->custom1 & SH_NODE_MAT_SPEC) {
+ else if (node->custom1 & SH_NODE_MAT_SPEC) {
out[MAT_OUT_COLOR].link= shr.spec;
}
else
@@ -285,7 +285,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
out[MAT_OUT_ALPHA].link = shr.alpha; //
- if(node->custom1 & SH_NODE_MAT_NEG)
+ if (node->custom1 & SH_NODE_MAT_NEG)
GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn);
out[MAT_OUT_NORMAL].link = shi.vn;
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index c9234c626aa..045fef1b010 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.c
+++ b/source/blender/nodes/shader/nodes/node_shader_math.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate sh_node_math_out[]= {
static void node_shader_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in,
bNodeStack **out)
{
- switch(node->custom1){
+ switch(node->custom1) {
case 0: /* Add */
out[0]->vec[0]= in[0]->vec[0] + in[1]->vec[0];
@@ -61,7 +61,7 @@ bNodeStack **out)
break;
case 3: /* Divide */
{
- if(in[1]->vec[0]==0) /* We don't want to divide by zero. */
+ if (in[1]->vec[0]==0) /* We don't want to divide by zero. */
out[0]->vec[0]= 0.0;
else
out[0]->vec[0]= in[0]->vec[0] / in[1]->vec[0];
@@ -69,7 +69,7 @@ bNodeStack **out)
break;
case 4: /* Sine */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= sin(in[0]->vec[0]);
else
out[0]->vec[0]= sin(in[1]->vec[0]);
@@ -77,7 +77,7 @@ bNodeStack **out)
break;
case 5: /* Cosine */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= cos(in[0]->vec[0]);
else
out[0]->vec[0]= cos(in[1]->vec[0]);
@@ -85,7 +85,7 @@ bNodeStack **out)
break;
case 6: /* Tangent */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= tan(in[0]->vec[0]);
else
out[0]->vec[0]= tan(in[1]->vec[0]);
@@ -93,16 +93,16 @@ bNodeStack **out)
break;
case 7: /* Arc-Sine */
{
- if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
/* Can't do the impossible... */
- if( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
+ if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
out[0]->vec[0]= asin(in[0]->vec[0]);
else
out[0]->vec[0]= 0.0;
}
else {
/* Can't do the impossible... */
- if( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
+ if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
out[0]->vec[0]= asin(in[1]->vec[0]);
else
out[0]->vec[0]= 0.0;
@@ -111,16 +111,16 @@ bNodeStack **out)
break;
case 8: /* Arc-Cosine */
{
- if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
/* Can't do the impossible... */
- if( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
+ if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
out[0]->vec[0]= acos(in[0]->vec[0]);
else
out[0]->vec[0]= 0.0;
}
else {
/* Can't do the impossible... */
- if( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
+ if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
out[0]->vec[0]= acos(in[1]->vec[0]);
else
out[0]->vec[0]= 0.0;
@@ -129,7 +129,7 @@ bNodeStack **out)
break;
case 9: /* Arc-Tangent */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= atan(in[0]->vec[0]);
else
out[0]->vec[0]= atan(in[1]->vec[0]);
@@ -138,7 +138,7 @@ bNodeStack **out)
case 10: /* Power */
{
/* Don't want any imaginary numbers... */
- if( in[0]->vec[0] >= 0 )
+ if ( in[0]->vec[0] >= 0 )
out[0]->vec[0]= pow(in[0]->vec[0], in[1]->vec[0]);
else
out[0]->vec[0]= 0.0;
@@ -147,7 +147,7 @@ bNodeStack **out)
case 11: /* Logarithm */
{
/* Don't want any imaginary numbers... */
- if( in[0]->vec[0] > 0 && in[1]->vec[0] > 0 )
+ if ( in[0]->vec[0] > 0 && in[1]->vec[0] > 0 )
out[0]->vec[0]= log(in[0]->vec[0]) / log(in[1]->vec[0]);
else
out[0]->vec[0]= 0.0;
@@ -155,7 +155,7 @@ bNodeStack **out)
break;
case 12: /* Minimum */
{
- if( in[0]->vec[0] < in[1]->vec[0] )
+ if ( in[0]->vec[0] < in[1]->vec[0] )
out[0]->vec[0]= in[0]->vec[0];
else
out[0]->vec[0]= in[1]->vec[0];
@@ -163,7 +163,7 @@ bNodeStack **out)
break;
case 13: /* Maximum */
{
- if( in[0]->vec[0] > in[1]->vec[0] )
+ if ( in[0]->vec[0] > in[1]->vec[0] )
out[0]->vec[0]= in[0]->vec[0];
else
out[0]->vec[0]= in[1]->vec[0];
@@ -171,7 +171,7 @@ bNodeStack **out)
break;
case 14: /* Round */
{
- if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+ if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= (in[0]->vec[0]<0)?(int)(in[0]->vec[0] - 0.5f):(int)(in[0]->vec[0] + 0.5f);
else
out[0]->vec[0]= (in[1]->vec[0]<0)?(int)(in[1]->vec[0] - 0.5f):(int)(in[1]->vec[0] + 0.5f);
@@ -179,7 +179,7 @@ bNodeStack **out)
break;
case 15: /* Less Than */
{
- if( in[0]->vec[0] < in[1]->vec[0] )
+ if ( in[0]->vec[0] < in[1]->vec[0] )
out[0]->vec[0]= 1.0f;
else
out[0]->vec[0]= 0.0f;
@@ -187,7 +187,7 @@ bNodeStack **out)
break;
case 16: /* Greater Than */
{
- if( in[0]->vec[0] > in[1]->vec[0] )
+ if ( in[0]->vec[0] > in[1]->vec[0] )
out[0]->vec[0]= 1.0f;
else
out[0]->vec[0]= 0.0f;
@@ -224,7 +224,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN
case 8:
case 9:
case 14:
- if(in[0].hasinput || !in[1].hasinput)
+ if (in[0].hasinput || !in[1].hasinput)
GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
else
GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));
diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c
index 8b0e9a5803b..14a115a8353 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output.c
@@ -41,7 +41,7 @@ static bNodeSocketTemplate sh_node_output_in[]= {
static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
- if(data) {
+ if (data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi;
float col[4];
@@ -49,12 +49,12 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN
nodestack_get_vec(col, SOCK_VECTOR, in[0]);
nodestack_get_vec(col+3, SOCK_FLOAT, in[1]);
- if(shi->do_preview) {
+ if (shi->do_preview) {
nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage);
node->lasty= shi->ys;
}
- if(node->flag & NODE_DO_OUTPUT) {
+ if (node->flag & NODE_DO_OUTPUT) {
ShadeResult *shr= ((ShaderCallData *)data)->shr;
copy_v4_v4(shr->combined, col);
@@ -70,7 +70,7 @@ static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack
GPUNodeLink *outlink;
#if 0
- if(in[1].hasinput)
+ if (in[1].hasinput)
GPU_material_enable_alpha(mat);
#endif
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
index 551b70d9b8a..2fff2bab1d4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
@@ -54,7 +54,7 @@ static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode* node,
static int node_shader_gpu_tex_checker(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
index 8ecff6e3767..852c056dc28 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -55,13 +55,13 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNod
Image *ima= (Image*)node->id;
ImageUser *iuser= NULL;
- if(!ima) {
+ if (!ima) {
float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
GPUNodeLink *vec = GPU_uniform(black);
return GPU_stack_link(mat, "set_rgba", out, out, vec);
}
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_builtin(GPU_VIEW_POSITION);
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
index a2403b6bdec..769cf845b42 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
@@ -52,7 +52,7 @@ static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode* node,
static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
index aa7ff279178..69e45469174 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -54,13 +54,13 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack
Image *ima= (Image*)node->id;
ImageUser *iuser= NULL;
- if(!ima) {
+ if (!ima) {
float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
GPUNodeLink *vec = GPU_uniform(black);
return GPU_stack_link(mat, "set_rgba", out, out, vec);
}
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_MTFACE, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
index 3a270220667..e2c0cfc020f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
@@ -57,7 +57,7 @@ static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, GPUNodeStack
NodeTexMagic *tex = (NodeTexMagic*)node->storage;
float depth = tex->depth;
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
index 015b78687fd..9fe3e652eea 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
@@ -58,7 +58,7 @@ static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode* node,
static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
index bb365cf5a33..2667d2a5867 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
@@ -54,7 +54,7 @@ static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode* node, bN
static int node_shader_gpu_tex_noise(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
index a4131f3ca6c..b4855faaf94 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
@@ -54,7 +54,7 @@ static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode* node, bNod
static int node_shader_gpu_tex_sky(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
index 9adaab22b03..eebd4886c59 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
@@ -53,7 +53,7 @@ static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode* node,
static int node_shader_gpu_tex_voronoi(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
index d359a407bc0..3e079ffc4f4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
@@ -56,7 +56,7 @@ static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode* node, bNo
static int node_shader_gpu_tex_wave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
- if(!in[0].link)
+ if (!in[0].link)
in[0].link = GPU_attribute(CD_ORCO, "");
node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c
index 02818496dab..8b6386fe2f6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_texture.c
+++ b/source/blender/nodes/shader/nodes/node_shader_texture.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate sh_node_texture_out[]= {
static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
- if(data && node->id) {
+ if (data && node->id) {
ShadeInput *shi= ((ShaderCallData *)data)->shi;
TexResult texres;
bNodeSocket *sock_vector= node->inputs.first;
@@ -65,14 +65,14 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
texres.tr= texres.tg= texres.tb= 0.0f;
/* don't use in[0]->hasinput, see material node for explanation */
- if(sock_vector->link) {
+ if (sock_vector->link) {
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
- if(in[0]->datatype==NS_OSA_VECTORS) {
+ if (in[0]->datatype==NS_OSA_VECTORS) {
float *fp= in[0]->data;
retval= multitex_nodes((Tex *)node->id, vec, fp, fp+3, shi->osatex, &texres, thread, which_output, NULL, NULL);
}
- else if(in[0]->datatype==NS_OSA_VALUES) {
+ else if (in[0]->datatype==NS_OSA_VALUES) {
float *fp= in[0]->data;
float dxt[3], dyt[3];
@@ -89,18 +89,18 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
}
/* stupid exception */
- if( ((Tex *)node->id)->type==TEX_STUCCI) {
+ if ( ((Tex *)node->id)->type==TEX_STUCCI) {
texres.tin= 0.5f + 0.7f*texres.nor[0];
CLAMP(texres.tin, 0.0f, 1.0f);
}
/* intensity and color need some handling */
- if(texres.talpha)
+ if (texres.talpha)
out[0]->vec[0]= texres.ta;
else
out[0]->vec[0]= texres.tin;
- if((retval & TEX_RGB)==0) {
+ if ((retval & TEX_RGB)==0) {
out[1]->vec[0]= out[0]->vec[0];
out[1]->vec[1]= out[0]->vec[0];
out[1]->vec[2]= out[0]->vec[0];
@@ -115,7 +115,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
copy_v3_v3(out[2]->vec, nor);
- if(shi->do_preview)
+ if (shi->do_preview)
nodeAddToPreview(node, out[1]->vec, shi->xs, shi->ys, shi->do_manage);
}
@@ -125,7 +125,7 @@ static int gpu_shader_texture(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G
{
Tex *tex = (Tex*)node->id;
- if(tex && tex->type == TEX_IMAGE && tex->ima) {
+ if (tex && tex->type == TEX_IMAGE && tex->ima) {
GPUNodeLink *texlink = GPU_image(tex->ima, NULL);
return GPU_stack_link(mat, "texture_image", in, out, texlink);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
index f0a94928985..a9513eec6ea 100644
--- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
@@ -48,7 +48,7 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStac
/* stack order in: fac */
/* stack order out: col, alpha */
- if(node->storage) {
+ if (node->storage) {
float fac;
nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
index 75dbff11b6e..9b57780cd9d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
@@ -54,39 +54,39 @@ static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeSta
nodestack_get_vec(vec1, SOCK_VECTOR, in[0]);
nodestack_get_vec(vec2, SOCK_VECTOR, in[1]);
- if(node->custom1 == 0) { /* Add */
+ if (node->custom1 == 0) { /* Add */
out[0]->vec[0]= vec1[0] + vec2[0];
out[0]->vec[1]= vec1[1] + vec2[1];
out[0]->vec[2]= vec1[2] + vec2[2];
out[1]->vec[0]= (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3;
}
- else if(node->custom1 == 1) { /* Subtract */
+ else if (node->custom1 == 1) { /* Subtract */
out[0]->vec[0]= vec1[0] - vec2[0];
out[0]->vec[1]= vec1[1] - vec2[1];
out[0]->vec[2]= vec1[2] - vec2[2];
out[1]->vec[0]= (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3;
}
- else if(node->custom1 == 2) { /* Average */
+ else if (node->custom1 == 2) { /* Average */
out[0]->vec[0]= vec1[0] + vec2[0];
out[0]->vec[1]= vec1[1] + vec2[1];
out[0]->vec[2]= vec1[2] + vec2[2];
out[1]->vec[0] = normalize_v3( out[0]->vec );
}
- else if(node->custom1 == 3) { /* Dot product */
+ else if (node->custom1 == 3) { /* Dot product */
out[1]->vec[0]= (vec1[0] * vec2[0]) + (vec1[1] * vec2[1]) + (vec1[2] * vec2[2]);
}
- else if(node->custom1 == 4) { /* Cross product */
+ else if (node->custom1 == 4) { /* Cross product */
out[0]->vec[0]= (vec1[1] * vec2[2]) - (vec1[2] * vec2[1]);
out[0]->vec[1]= (vec1[2] * vec2[0]) - (vec1[0] * vec2[2]);
out[0]->vec[2]= (vec1[0] * vec2[1]) - (vec1[1] * vec2[0]);
out[1]->vec[0] = normalize_v3( out[0]->vec );
}
- else if(node->custom1 == 5) { /* Normalize */
- if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
+ else if (node->custom1 == 5) { /* Normalize */
+ if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
out[0]->vec[0]= vec1[0];
out[0]->vec[1]= vec1[1];
out[0]->vec[2]= vec1[2];
@@ -118,7 +118,7 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
GPU_socket(&in[0]), GPU_socket(&in[1]));
break;
case 5:
- if(in[0].hasinput || !in[1].hasinput)
+ if (in[0].hasinput || !in[1].hasinput)
GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
else
GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));