diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-11-13 03:12:30 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-11-13 03:12:30 +0400 |
commit | 0ca96e1eb1da42268c11c286c74e79ed31da2c37 (patch) | |
tree | 52bcd0a8f871b8cb491a7604ed1c8001832e78fc /source/blender/nodes | |
parent | 1ae159bff4c9c1d2e26df81744ab73c388b3bbe1 (diff) | |
parent | fc42a6185ddeb6a24ec92287dfa7b89beb059716 (diff) |
Merged changes in the trunk up to revision 41768.
Conflicts resolved:
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_enum_types.h
source/blender/render/intern/source/shadeinput.c
source/blenderplayer/bad_level_call_stubs/stubs.c
Additional changes:
* source/blender/makesrna/intern/rna_linestyle.c: Fixed white
space issues that generated a number of compiler errors. The
problem was that two string literals for enumerating MA_RAMP_SOFT
and MA_RAMP_LINEAR contained a space. The string literals are
supposed to represent a valid C identifier because of their use
for automatic code generation.
* Stroke transparency has been temporarily disabled due to a
functionality conflict with some merged changes. A fix of this
issue is planned.
Diffstat (limited to 'source/blender/nodes')
73 files changed, 2591 insertions, 200 deletions
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 69e7f9cac6b..1b327edbc9f 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -25,6 +25,7 @@ set(INC . + ../blenfont ../blenkernel ../blenlib ../blenloader @@ -128,6 +129,38 @@ set(SRC shader/nodes/node_shader_valToRgb.c shader/nodes/node_shader_value.c shader/nodes/node_shader_vectMath.c + shader/nodes/node_shader_attribute.c + shader/nodes/node_shader_background.c + # shader/nodes/node_shader_bsdf_anisotropic.c # XXX, why not included? + shader/nodes/node_shader_bsdf_diffuse.c + shader/nodes/node_shader_bsdf_glossy.c + shader/nodes/node_shader_bsdf_glass.c + shader/nodes/node_shader_bsdf_translucent.c + shader/nodes/node_shader_bsdf_transparent.c + shader/nodes/node_shader_bsdf_velvet.c + shader/nodes/node_shader_emission.c + shader/nodes/node_shader_fresnel.c + shader/nodes/node_shader_layer_weight.c + shader/nodes/node_shader_geometry.c + shader/nodes/node_shader_holdout.c + shader/nodes/node_shader_volume_transparent.c + shader/nodes/node_shader_volume_isotropic.c + shader/nodes/node_shader_light_path.c + shader/nodes/node_shader_mix_shader.c + shader/nodes/node_shader_add_shader.c + shader/nodes/node_shader_output_lamp.c + shader/nodes/node_shader_output_material.c + shader/nodes/node_shader_output_world.c + shader/nodes/node_shader_tex_gradient.c + shader/nodes/node_shader_tex_coord.c + shader/nodes/node_shader_tex_environment.c + shader/nodes/node_shader_tex_image.c + shader/nodes/node_shader_tex_magic.c + shader/nodes/node_shader_tex_musgrave.c + shader/nodes/node_shader_tex_noise.c + shader/nodes/node_shader_tex_sky.c + shader/nodes/node_shader_tex_voronoi.c + shader/nodes/node_shader_tex_wave.c shader/node_shader_tree.c shader/node_shader_util.c diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index f1415a8c8f0..6deea004417 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -1,21 +1,21 @@ /* * ***** BEGIN GPL LICENSE BLOCK ***** * - * This program is free software(ListBase *lb); you can redistribute it and/or + * 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(ListBase *lb); either version 2 + * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. The Blender * Foundation also sells licenses for use in proprietary software under * the Blender License. See http://www.blender.org/BL/ for information * about this. * * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY(ListBase *lb); without even the implied warranty of + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program(ListBase *lb); if not, write to the Free Software Foundation, + * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2005 Blender Foundation. diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h index 83352698e38..996660fcb8b 100644 --- a/source/blender/nodes/NOD_shader.h +++ b/source/blender/nodes/NOD_shader.h @@ -71,6 +71,41 @@ void register_node_type_sh_seprgb(ListBase *lb); void register_node_type_sh_combrgb(ListBase *lb); void register_node_type_sh_hue_sat(ListBase *lb); +void register_node_type_sh_attribute(ListBase *lb); +void register_node_type_sh_geometry(ListBase *lb); +void register_node_type_sh_light_path(ListBase *lb); +void register_node_type_sh_fresnel(ListBase *lb); +void register_node_type_sh_layer_weight(ListBase *lb); +void register_node_type_sh_tex_coord(ListBase *lb); + +void register_node_type_sh_background(ListBase *lb); +void register_node_type_sh_bsdf_diffuse(ListBase *lb); +void register_node_type_sh_bsdf_glossy(ListBase *lb); +void register_node_type_sh_bsdf_glass(ListBase *lb); +void register_node_type_sh_bsdf_translucent(ListBase *lb); +void register_node_type_sh_bsdf_transparent(ListBase *lb); +void register_node_type_sh_bsdf_velvet(ListBase *lb); +void register_node_type_sh_emission(ListBase *lb); +void register_node_type_sh_holdout(ListBase *lb); +void register_node_type_sh_volume_transparent(ListBase *lb); +void register_node_type_sh_volume_isotropic(ListBase *lb); +void register_node_type_sh_mix_shader(ListBase *lb); +void register_node_type_sh_add_shader(ListBase *lb); + +void register_node_type_sh_output_lamp(ListBase *lb); +void register_node_type_sh_output_material(ListBase *lb); +void register_node_type_sh_output_world(ListBase *lb); + +void register_node_type_sh_tex_image(ListBase *lb); +void register_node_type_sh_tex_environment(ListBase *lb); +void register_node_type_sh_tex_sky(ListBase *lb); +void register_node_type_sh_tex_voronoi(ListBase *lb); +void register_node_type_sh_tex_gradient(ListBase *lb); +void register_node_type_sh_tex_magic(ListBase *lb); +void register_node_type_sh_tex_wave(ListBase *lb); +void register_node_type_sh_tex_musgrave(ListBase *lb); +void register_node_type_sh_tex_noise(ListBase *lb); + #endif diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript index 0cbc7b80933..d7dbed51282 100644 --- a/source/blender/nodes/SConscript +++ b/source/blender/nodes/SConscript @@ -11,7 +11,7 @@ incs += '#/intern/guardedalloc ../editors/include ../blenlib ../makesdna' incs += ' ../render/extern/include ../makesrna ' incs += ' ../imbuf ../avi ' incs += ' ../blenloader' -incs += ' ../blenkernel ../renderconverter ' +incs += ' ../blenfont ../blenkernel ../renderconverter ' incs += ' ../gpu #/extern/glew/include ' incs += ' ' + env['BF_OPENGL_INC'] diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 06f88002a70..1a1d744fb1b 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -39,6 +39,8 @@ #include "BLI_listbase.h" #include "BLI_threads.h" +#include "BLF_translation.h" + #include "BKE_animsys.h" #include "BKE_colortools.h" #include "BKE_fcurve.h" @@ -70,16 +72,16 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func) static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func) { - func(calldata, NODE_CLASS_INPUT, "Input"); - func(calldata, NODE_CLASS_OUTPUT, "Output"); - func(calldata, NODE_CLASS_OP_COLOR, "Color"); - func(calldata, NODE_CLASS_OP_VECTOR, "Vector"); - func(calldata, NODE_CLASS_OP_FILTER, "Filter"); - func(calldata, NODE_CLASS_CONVERTOR, "Convertor"); - func(calldata, NODE_CLASS_MATTE, "Matte"); - func(calldata, NODE_CLASS_DISTORT, "Distort"); - func(calldata, NODE_CLASS_GROUP, "Group"); - func(calldata, NODE_CLASS_LAYOUT, "Layout"); + func(calldata, NODE_CLASS_INPUT, IFACE_("Input")); + func(calldata, NODE_CLASS_OUTPUT, IFACE_("Output")); + func(calldata, NODE_CLASS_OP_COLOR, IFACE_("Color")); + func(calldata, NODE_CLASS_OP_VECTOR, IFACE_("Vector")); + func(calldata, NODE_CLASS_OP_FILTER, IFACE_("Filter")); + func(calldata, NODE_CLASS_CONVERTOR, IFACE_("Convertor")); + func(calldata, NODE_CLASS_MATTE, IFACE_("Matte")); + func(calldata, NODE_CLASS_DISTORT, IFACE_("Distort")); + func(calldata, NODE_CLASS_GROUP, IFACE_("Group")); + func(calldata, NODE_CLASS_LAYOUT, IFACE_("Layout")); } static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node) @@ -601,7 +603,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) if(nodeexec) { node = nodeexec->node; if(ntree->progress && totnode) - ntree->progress(ntree->prh, (1.0 - curnode/(float)totnode)); + ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode)); if(ntree->stats_draw) { char str[64]; sprintf(str, "Compositing %d %s", curnode, node->name); diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 0356ed394f1..ddd55790436 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -762,7 +762,7 @@ void premul_compbuf(CompBuf *img, int inversed) drect= img->rect; if(inversed) { for(x=img->x*img->y; x>0; x--, drect+=4) { - if(fabs(drect[3]) < 1e-5f) { + if(fabsf(drect[3]) < 1e-5f) { drect[0]= 0.0f; drect[1]= 0.0f; drect[2]= 0.0f; @@ -1314,7 +1314,7 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) int i, x, y, sz; // <0.5 not valid, though can have a possibly useful sort of sharpening effect - if (sigma < 0.5) return; + if (sigma < 0.5f) return; if ((xy < 1) || (xy > 3)) xy = 3; @@ -1326,10 +1326,10 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 - if (sigma >= 3.556) - q = 0.9804*(sigma - 3.556) + 2.5091; + if (sigma >= 3.556f) + q = 0.9804f*(sigma - 3.556f) + 2.5091f; else // sigma >= 0.5 - q = (0.0561*sigma + 0.5784)*sigma - 0.2568; + q = (0.0561f*sigma + 0.5784f)*sigma - 0.2568f; q2 = q*q; sc = (1.1668 + q)*(3.203729649 + (2.21566 + q)*q); // no gabor filtering here, so no complex multiplies, just the regular coefs. diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c index 17038fd6780..0f341335783 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c @@ -62,13 +62,14 @@ static bNodeSocketTemplate cmp_node_bilateralblur_out[]= { #define KERNEL_ELEMENT_C3(k) \ temp_color = src + deltas[k]; \ ref_color = ref + deltas[k]; \ - w = weight_tab[k] + COLOR_DISTANCE_C3(ref, ref_color )*i2sigma_color; \ + w = weight_tab[k] + \ + (double)COLOR_DISTANCE_C3(ref, ref_color ) * i2sigma_color; \ w = 1.0/(w*w + 1); \ mean0 += w; \ - mean1[0] += temp_color[0]*w; \ - mean1[1] += temp_color[1]*w; \ - mean1[2] += temp_color[2]*w; \ - mean1[3] += temp_color[3]*w; + mean1[0] += (double)temp_color[0]*w; \ + mean1[1] += (double)temp_color[1]*w; \ + mean1[2] += (double)temp_color[2]*w; \ + mean1[3] += (double)temp_color[3]*w; /* write blurred values to image */ #define UPDATE_OUTPUT_C3 \ @@ -137,8 +138,8 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN sigma_color= nbbd->sigma_color; sigma_space= nbbd->sigma_space; - i2sigma_color= 1. / (sigma_color * sigma_color); - i2sigma_space= 1. / (sigma_space * sigma_space); + i2sigma_color= 1.0f / (sigma_color * sigma_color); + i2sigma_space= 1.0f / (sigma_space * sigma_space); INIT_3X3_DELTAS(deltas, step, pix); diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index d0ddfb47f08..816aacbe61c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -77,7 +77,7 @@ static float *make_bloomtab(int rad) bloomtab = (float *) MEM_mallocN(n * sizeof(float), "bloom"); for (i = -rad; i <= rad; i++) { - val = pow(1.0 - fabs((float)i)/((float)rad), 4.0); + val = powf(1.0f - fabsf((float)i)/((float)rad), 4.0f); bloomtab[i+rad] = val; } diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index 10f0afb6cf6..6597ceaeee2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -49,18 +49,18 @@ static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float * { /*normalize to the range 0.0 to 1.0) */ rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); - out[0]=(out[0])/255.0; - out[1]=(out[1])/255.0; - out[2]=(out[2])/255.0; + out[0]=(out[0])/255.0f; + out[1]=(out[1])/255.0f; + out[2]=(out[2])/255.0f; out[3]=in[3]; } static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ - in[0]=in[0]*255.0; - in[1]=in[1]*255.0; - in[2]=in[2]*255.0; + in[0]=in[0]*255.0f; + in[1]=in[1]*255.0f; + in[2]=in[2]*255.0f; ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); out[3]=in[3]; } diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c index 25891aeaa68..9aadfdf363b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c @@ -50,14 +50,14 @@ static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *i rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); //normalize to 0..1.0 - out[0]=out[0]/255.0; - out[1]=out[1]/255.0; - out[2]=out[2]/255.0; + out[0]=out[0]/255.0f; + out[1]=out[1]/255.0f; + out[2]=out[2]/255.0f; //rescale to -1.0..1.0 - out[0]=(out[0]*2.0)-1.0; - out[1]=(out[1]*2.0)-1.0; - out[2]=(out[2]*2.0)-1.0; + out[0]=(out[0]*2.0f)-1.0f; + out[1]=(out[1]*2.0f)-1.0f; + out[2]=(out[2]*2.0f)-1.0f; // out[0]=((out[0])-16)/255.0; // out[1]=((out[1])-128)/255.0; @@ -68,13 +68,13 @@ static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *i static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ - in[0]=(in[0]+1.0)/2.0; - in[1]=(in[1]+1.0)/2.0; - in[2]=(in[2]+1.0)/2.0; + in[0]=(in[0]+1.0f)/2.0f; + in[1]=(in[1]+1.0f)/2.0f; + in[2]=(in[2]+1.0f)/2.0f; - in[0]=(in[0]*255.0); - in[1]=(in[1]*255.0); - in[2]=(in[2]*255.0); + in[0]=(in[0]*255.0f); + in[1]=(in[1]*255.0f); + in[2]=(in[2]*255.0f); // in[0]=(in[0]*255.0)+16; // in[1]=(in[1]*255.0)+128; @@ -98,27 +98,27 @@ static void do_chroma_key(bNode *node, float *out, float *in) theta=atan2(c->key[2], c->key[1]); /*rotate the cb and cr into x/z space */ - x=in[1]*cos(theta)+in[2]*sin(theta); - z=in[2]*cos(theta)-in[1]*sin(theta); + x=in[1]*cosf(theta)+in[2]*sinf(theta); + z=in[2]*cosf(theta)-in[1]*sinf(theta); /*if within the acceptance angle */ - angle=c->t1*M_PI/180.0; /* convert to radians */ + angle=c->t1*(float)M_PI/180.0f; /* convert to radians */ /* if kfg is <0 then the pixel is outside of the key color */ - kfg=x-(fabs(z)/tan(angle/2.0)); + kfg= x-(fabsf(z)/tanf(angle/2.0f)); out[0]=in[0]; out[1]=in[1]; out[2]=in[2]; - if(kfg>0.0) { /* found a pixel that is within key color */ - alpha=(1.0-kfg)*(c->fstrength); + if(kfg>0.0f) { /* found a pixel that is within key color */ + alpha=(1.0f-kfg)*(c->fstrength); beta=atan2(z,x); - angle2=c->t2*M_PI/180.0; + angle2=c->t2*(float)(M_PI/180.0); /* if beta is within the cutoff angle */ - if(fabs(beta)<(angle2/2.0)) { + if(fabsf(beta) < (angle2/2.0f)) { alpha=0.0; } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c index b226e562799..66dc9ff0304 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c @@ -57,13 +57,13 @@ static void do_color_key(bNode *node, float *out, float *in) if( /* do hue last because it needs to wrap, and does some more checks */ - /* sat */ (fabs(in[1]-c->key[1]) < c->t2) && - /* val */ (fabs(in[2]-c->key[2]) < c->t3) && + /* sat */ (fabsf(in[1]-c->key[1]) < c->t2) && + /* val */ (fabsf(in[2]-c->key[2]) < c->t3) && /* multiply by 2 because it wraps on both sides of the hue, * otherwise 0.5 would key all hue's */ - /* hue */ ((h_wrap= 2.0f * fabs(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1) + /* hue */ ((h_wrap= 2.0f * fabsf(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1) ) { out[3]=0.0; /*make transparent*/ } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c index eb75802c0a6..f7de5801a5e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c @@ -61,7 +61,7 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop float x = in * slope + offset; /* prevent NaN */ - CLAMP(x, 0.0, 1.0); + CLAMP(x, 0.0f, 1.0f); return powf(x, power); } diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c index 6f4d32f6573..2e54836e042 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.c +++ b/source/blender/nodes/composite/nodes/node_composite_curves.c @@ -141,9 +141,9 @@ static void do_curves(bNode *node, float *out, float *in) static void do_curves_fac(bNode *node, float *out, float *in, float *fac) { - if(*fac>=1.0) + if(*fac >= 1.0f) curvemapping_evaluate_premulRGBF(node->storage, out, in); - else if(*fac<=0.0) { + else if(*fac <= 0.0f) { copy_v3_v3(out, in); } else { @@ -175,7 +175,7 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec); - if(in[0]->data==NULL && in[0]->vec[0] == 1.0) + if(in[0]->data==NULL && in[0]->vec[0] == 1.0f) composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA); else composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 2232c4a489e..9b32e0f6f3f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -58,8 +58,8 @@ typedef struct BokehCoeffs { static void makeBokeh(char bktype, char ro, int* len_bkh, float* inradsq, BokehCoeffs BKH[8], float bkh_b[4]) { float x0, x1, y0, y1, dx, dy, iDxy; - float w = MAX2(1e-5f, ro)*M_PI/180.f; // never reported stangely enough, but a zero offset causes missing center line... - float wi = (360.f/bktype)*M_PI/180.f; + float w = MAX2(1e-5f, ro)*(float)(M_PI/180); // never reported stangely enough, but a zero offset causes missing center line... + float wi = (360.f/bktype)*(float)(M_PI/180); int i, ov, nv; // bktype must be at least 3 & <= 8 @@ -81,7 +81,7 @@ static void makeBokeh(char bktype, char ro, int* len_bkh, float* inradsq, BokehC BKH[i].x0 = x0; BKH[i].y0 = y0; dx = x1-x0, dy = y1-y0; - iDxy = 1.f / sqrt(dx*dx + dy*dy); + iDxy = 1.f / sqrtf(dx*dx + dy*dy); dx *= iDxy; dy *= iDxy; BKH[i].dx = dx; @@ -146,6 +146,7 @@ static float RI_vdC(unsigned int bits, unsigned int r) // single channel IIR gaussian filtering // much faster than anything else, constant time independent of width // should extend to multichannel and make this a node, could be useful +// note: this is an almost exact copy of 'IIR_gauss' static void IIR_gauss_single(CompBuf* buf, float sigma) { double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3]; @@ -156,14 +157,14 @@ static void IIR_gauss_single(CompBuf* buf, float sigma) if (buf->type != CB_VAL) return; // <0.5 not valid, though can have a possibly useful sort of sharpening effect - if (sigma < 0.5) return; + if (sigma < 0.5f) return; // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 - if (sigma >= 3.556) - q = 0.9804*(sigma - 3.556) + 2.5091; + if (sigma >= 3.556f) + q = 0.9804f*(sigma - 3.556f) + 2.5091f; else // sigma >= 0.5 - q = (0.0561*sigma + 0.5784)*sigma - 0.2568; + q = (0.0561f*sigma + 0.5784f)*sigma - 0.2568f; q2 = q*q; sc = (1.1668 + q)*(3.203729649 + (2.21566 + q)*q); // no gabor filtering here, so no complex multiplies, just the regular coefs. @@ -260,7 +261,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, Camera* cam = (Camera*)camob->data; cam_lens = cam->lens; cam_fdist = dof_camera(camob); - if (cam_fdist==0.0) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */ + if (cam_fdist==0.0f) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */ cam_invfdist = 1.f/cam_fdist; } @@ -362,7 +363,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // scale crad back to original maximum and blend crad->rect[px] = bcrad + wts->rect[px]*(scf*crad->rect[px] - bcrad); */ - crad->rect[px] = 0.5f*fabs(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f)); + crad->rect[px] = 0.5f*fabsf(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f)); // 'bug' #6615, limit minimum radius to 1 pixel, not really a solution, but somewhat mitigates the problem crad->rect[px] = MAX2(crad->rect[px], 0.5f); @@ -530,12 +531,13 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, }\ }\ } + i = ceil(ct_crad); j = 0; T = 0; while (i > j) { Dj = sqrt(cR2 - j*j); - Dj -= floor(Dj); + Dj -= floorf(Dj); di = 0; if (Dj > T) { i--; di = 1; } T = Dj; @@ -548,26 +550,26 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, lwt = wt*Dj; if (i!=j) { // outer pixels - AAPIX(x+j, y+i); - AAPIX(x+j, y-i); + AAPIX(x+j, y+i) + AAPIX(x+j, y-i) if (j) { - AAPIX(x-j, y+i); // BL - AAPIX(x-j, y-i); // TL + AAPIX(x-j, y+i) // BL + AAPIX(x-j, y-i) // TL } if (di) { // only when i changed, interior of outer section - CSCAN(j, i); // bottom - CSCAN(j, -i); // top + CSCAN(j, i) // bottom + CSCAN(j, -i) // top } } // lower mid section - AAPIX(x+i, y+j); - if (i) AAPIX(x-i, y+j); - CSCAN(i, j); + AAPIX(x+i, y+j) + if (i) AAPIX(x-i, y+j) + CSCAN(i, j) // upper mid section if (j) { - AAPIX(x+i, y-j); - if (i) AAPIX(x-i, y-j); - CSCAN(i, -j); + AAPIX(x+i, y-j) + if (i) AAPIX(x-i, y-j) + CSCAN(i, -j) } j++; } @@ -600,7 +602,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, fxe = fxe*ct_crad + x; xs = (int)floor(fxs), xe = (int)ceil(fxe); // AA hack for first and last x pixel, near vertical edges only - if (fabs(mind) <= 1.f) { + if (fabsf(mind) <= 1.f) { if ((xs >= 0) && (xs < new->x)) { lwt = 1.f-(fxs - xs); aacol[0] = wtcol[0]*lwt; @@ -619,7 +621,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, } } } - if (fabs(maxd) <= 1.f) { + if (fabsf(maxd) <= 1.f) { if ((xe >= 0) && (xe < new->x)) { lwt = 1.f-(xe - fxe); aacol[0] = wtcol[0]*lwt; @@ -676,7 +678,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, fys = fys*ct_crad + y; fye = fye*ct_crad + y; // near horizontal edges only, line slope <= 1 - if (fabs(mind) <= 1.f) { + if (fabsf(mind) <= 1.f) { int iys = (int)floor(fys); if ((iys >= 0) && (iys < new->y)) { lwt = 1.f - (fys - iys); @@ -696,7 +698,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, } } } - if (fabs(maxd) <= 1.f) { + if (fabsf(maxd) <= 1.f) { int iye = ceil(fye); if ((iye >= 0) && (iye < new->y)) { lwt = 1.f - (iye - fye); diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index 17156ab3492..3b2a2342167 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -53,12 +53,12 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * float difference; float alpha; - difference= fabs(inColor2[0]-inColor1[0])+ - fabs(inColor2[1]-inColor1[1])+ - fabs(inColor2[2]-inColor1[2]); + difference= fabs(inColor2[0]-inColor1[0]) + + fabs(inColor2[1]-inColor1[1]) + + fabs(inColor2[2]-inColor1[2]); /*average together the distances*/ - difference=difference/3.0; + difference=difference/3.0f; copy_v3_v3(outColor, inColor1); diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index 591870d0911..802ef2d8e12 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -48,7 +48,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, if ((dist != 0.f) || (spin != 0.f) || (zoom != 0.f)) { void (*getpix)(CompBuf*, float, float, float*) = wrap ? qd_getPixelLerpWrap : qd_getPixelLerp; const float a= angle * (float)M_PI / 180.f; - const float itsc= 1.f / pow(2.f, (float)iterations); + const float itsc= 1.f / powf(2.f, (float)iterations); float D; float center_x_pix, center_y_pix; float tx, ty; @@ -62,14 +62,14 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, center_x_pix= center_x * img->x; center_y_pix= center_y * img->y; - tx= itsc * D * cos(a); - ty= -itsc * D * sin(a); + tx= itsc * D * cosf(a); + ty= -itsc * D * sinf(a); sc= itsc * zoom; rot= itsc * spin * (float)M_PI / 180.f; /* blur the image */ for(i= 0; i < iterations; ++i) { - const float cs= cos(rot), ss= sin(rot); + const float cs= cosf(rot), ss= sinf(rot); const float isc= 1.f / (1.f + sc); unsigned int x, y; float col[4]= {0,0,0,0}; diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index 02a1d203bef..a55a6093f12 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -49,7 +49,7 @@ static bNodeSocketTemplate cmp_node_displace_out[]= { /* minimum distance (in pixels) a pixel has to be displaced * in order to take effect */ -#define DISPLACE_EPSILON 0.01 +#define DISPLACE_EPSILON 0.01f static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale) { diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c index 2bb600db99d..ad377799dea 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.c +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c @@ -50,7 +50,7 @@ static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac) int i=0; for(i=0; i<3; i++) { /* check for negative to avoid nan's */ - out[i] = (in[i] > 0.0f)? pow(in[i],fac[0]): in[i]; + out[i] = (in[i] > 0.0f)? powf(in[i],fac[0]): in[i]; } out[3] = in[3]; } diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index f4391a1af77..b7cc1d3c92d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -253,7 +253,7 @@ static void streaks(NodeGlare* ndg, CompBuf* dst, CompBuf* src) const float p4 = pow(4.0, (double)n); const float vxp = vx*p4, vyp = vy*p4; const float wt = pow((double)ndg->fade, (double)p4); - const float cmo = 1.f - pow((double)ndg->colmod, (double)n+1); // colormodulation amount relative to current pass + const float cmo = 1.f - (float)pow((double)ndg->colmod, (double)n+1); // colormodulation amount relative to current pass float* tdstcol = tdst->rect; for (y=0; y<tsrc->y; ++y) { for (x=0; x<tsrc->x; ++x, tdstcol+=4) { diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index 3c73d07d96c..711560a0a94 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -48,12 +48,12 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac) { NodeHueSat *nhs= node->storage; - if(*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0 || nhs->val!=1.0)) { + if(*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0f || nhs->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]+= (nhs->hue - 0.5f); - if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0; + if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f; hsv[1]*= nhs->sat; hsv[2]*= nhs->val; hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c index f18eca3dfcc..acb70f13ec2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c @@ -61,7 +61,7 @@ static void do_huecorrect(bNode *node, float *out, float *in) f = curvemapping_evaluateF(node->storage, 2, hsv[0]); hsv[2] *= (f * 2.f); - hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */ + hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */ CLAMP(hsv[1], 0.f, 1.f); /* convert back to rgb */ @@ -89,7 +89,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac) f = curvemapping_evaluateF(node->storage, 2, hsv[0]); hsv[2] *= (f * 2.f); - hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */ + hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */ CLAMP(hsv[1], 0.f, 1.f); /* convert back to rgb */ diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 41427c42286..672d2af0646 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -358,41 +358,41 @@ static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, in static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out, int rectx, int recty) { - if(out[RRES_OUT_Z]->hasoutput) - out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_Z); - if(out[RRES_OUT_VEC]->hasoutput) - out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_VECTOR); - if(out[RRES_OUT_NORMAL]->hasoutput) - out[RRES_OUT_NORMAL]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_NORMAL); - if(out[RRES_OUT_UV]->hasoutput) - out[RRES_OUT_UV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_UV); - - if(out[RRES_OUT_RGBA]->hasoutput) - out[RRES_OUT_RGBA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RGBA); - if(out[RRES_OUT_DIFF]->hasoutput) - out[RRES_OUT_DIFF]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE); - if(out[RRES_OUT_SPEC]->hasoutput) - out[RRES_OUT_SPEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SPEC); - if(out[RRES_OUT_SHADOW]->hasoutput) - out[RRES_OUT_SHADOW]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SHADOW); - if(out[RRES_OUT_AO]->hasoutput) - out[RRES_OUT_AO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_AO); - if(out[RRES_OUT_REFLECT]->hasoutput) - out[RRES_OUT_REFLECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFLECT); - if(out[RRES_OUT_REFRACT]->hasoutput) - out[RRES_OUT_REFRACT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFRACT); - if(out[RRES_OUT_INDIRECT]->hasoutput) - out[RRES_OUT_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDIRECT); - if(out[RRES_OUT_INDEXOB]->hasoutput) - out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB); + if(out[RRES_OUT_Z]->hasoutput) + out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_Z); + if(out[RRES_OUT_VEC]->hasoutput) + out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_VECTOR); + if(out[RRES_OUT_NORMAL]->hasoutput) + out[RRES_OUT_NORMAL]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_NORMAL); + if(out[RRES_OUT_UV]->hasoutput) + out[RRES_OUT_UV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_UV); + + if(out[RRES_OUT_RGBA]->hasoutput) + out[RRES_OUT_RGBA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RGBA); + if(out[RRES_OUT_DIFF]->hasoutput) + out[RRES_OUT_DIFF]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE); + if(out[RRES_OUT_SPEC]->hasoutput) + out[RRES_OUT_SPEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SPEC); + if(out[RRES_OUT_SHADOW]->hasoutput) + out[RRES_OUT_SHADOW]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SHADOW); + if(out[RRES_OUT_AO]->hasoutput) + out[RRES_OUT_AO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_AO); + if(out[RRES_OUT_REFLECT]->hasoutput) + out[RRES_OUT_REFLECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFLECT); + if(out[RRES_OUT_REFRACT]->hasoutput) + out[RRES_OUT_REFRACT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFRACT); + if(out[RRES_OUT_INDIRECT]->hasoutput) + out[RRES_OUT_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDIRECT); + if(out[RRES_OUT_INDEXOB]->hasoutput) + out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB); if(out[RRES_OUT_INDEXMA]->hasoutput) out[RRES_OUT_INDEXMA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXMA); - if(out[RRES_OUT_MIST]->hasoutput) - out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST); - if(out[RRES_OUT_EMIT]->hasoutput) - out[RRES_OUT_EMIT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_EMIT); - if(out[RRES_OUT_ENV]->hasoutput) - out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT); + if(out[RRES_OUT_MIST]->hasoutput) + out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST); + if(out[RRES_OUT_EMIT]->hasoutput) + out[RRES_OUT_EMIT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_EMIT); + if(out[RRES_OUT_ENV]->hasoutput) + out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT); } static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c index daf2ee0cbe7..d98f5a1c64b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ b/source/blender/nodes/composite/nodes/node_composite_invert.c @@ -65,7 +65,7 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac) do_invert(node, col, in); /* blend inverted result against original input with fac */ - facm = 1.0 - fac[0]; + facm = 1.0f - fac[0]; if(node->custom1 & CMP_CHAN_RGB) { col[0] = fac[0]*col[0] + (facm*in[0]); diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c index 54e48bb749d..f3e4f0db8b6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ b/source/blender/nodes/composite/nodes/node_composite_levels.c @@ -63,7 +63,7 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins) /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0) { /* don't count transparent pixels */ + if(value[3] > 0.0f) { /* don't count transparent pixels */ switch(node->custom1) { case 1: { /* all colors */ rgb_tobw(value[0],value[1],value[2], &value[0]); @@ -120,7 +120,7 @@ static float brightness_mean(bNode* node, CompBuf* in) /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0) { /* don't count transparent pixels */ + if(value[3] > 0.0f) { /* don't count transparent pixels */ numPixels++; switch(node->custom1) { @@ -172,7 +172,7 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean) /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0) { /* don't count transparent pixels */ + if(value[3] > 0.0f) { /* don't count transparent pixels */ numPixels++; switch(node->custom1) { @@ -233,7 +233,7 @@ static void draw_histogram(bNode *node, CompBuf *out, int* bins) for(y=0;y<out->y; y++) { /* get normalized value (0..255) */ - value=((float)bins[x]/(float)max)*255.0; + value=((float)bins[x]/(float)max)*255.0f; if(y < (int)value) { /*if the y value is below the height of the bar for this line then draw with the color */ switch (node->custom1) { diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c index 5dc6d1c3aaa..b596f67a886 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c @@ -73,40 +73,40 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr /* adaptive sampling, red (U) channel */ /* prevent alpha zero UVs to be used */ - uv_l= uv[-1]!=0.0f? fabs(uv[0]-uv[-3]) : 0.0f; - uv_r= uv[ 5]!=0.0f? fabs(uv[0]-uv[ 3]) : 0.0f; + uv_l= uv[-1]!=0.0f? fabsf(uv[0]-uv[-3]) : 0.0f; + uv_r= uv[ 5]!=0.0f? fabsf(uv[0]-uv[ 3]) : 0.0f; //dx= 0.5f*(fabs(uv[0]-uv[-3]) + fabs(uv[0]-uv[3])); dx= 0.5f*(uv_l + uv_r); - uv_l= uvprev[-1]!=0.0f? fabs(uv[0]-uvprev[-3]) : 0.0f; - uv_r= uvnext[-1]!=0.0f? fabs(uv[0]-uvnext[-3]) : 0.0f; + uv_l= uvprev[-1]!=0.0f? fabsf(uv[0]-uvprev[-3]) : 0.0f; + uv_r= uvnext[-1]!=0.0f? fabsf(uv[0]-uvnext[-3]) : 0.0f; //dx+= 0.25f*(fabs(uv[0]-uvprev[-3]) + fabs(uv[0]-uvnext[-3])); dx+= 0.25f*(uv_l + uv_r); - uv_l= uvprev[ 5]!=0.0f? fabs(uv[0]-uvprev[+3]) : 0.0f; - uv_r= uvnext[ 5]!=0.0f? fabs(uv[0]-uvnext[+3]) : 0.0f; + uv_l= uvprev[ 5]!=0.0f? fabsf(uv[0]-uvprev[+3]) : 0.0f; + uv_r= uvnext[ 5]!=0.0f? fabsf(uv[0]-uvnext[+3]) : 0.0f; //dx+= 0.25f*(fabs(uv[0]-uvprev[+3]) + fabs(uv[0]-uvnext[+3])); dx+= 0.25f*(uv_l + uv_r); /* adaptive sampling, green (V) channel */ - uv_l= uv[-row+2]!=0.0f? fabs(uv[1]-uv[-row+1]) : 0.0f; - uv_r= uv[ row+2]!=0.0f? fabs(uv[1]-uv[ row+1]) : 0.0f; + uv_l= uv[-row+2]!=0.0f? fabsf(uv[1]-uv[-row+1]) : 0.0f; + uv_r= uv[ row+2]!=0.0f? fabsf(uv[1]-uv[ row+1]) : 0.0f; //dy= 0.5f*(fabs(uv[1]-uv[-row+1]) + fabs(uv[1]-uv[row+1])); dy= 0.5f*(uv_l + uv_r); - uv_l= uvprev[-1]!=0.0f? fabs(uv[1]-uvprev[+1-3]) : 0.0f; - uv_r= uvnext[-1]!=0.0f? fabs(uv[1]-uvnext[+1-3]) : 0.0f; + uv_l= uvprev[-1]!=0.0f? fabsf(uv[1]-uvprev[+1-3]) : 0.0f; + uv_r= uvnext[-1]!=0.0f? fabsf(uv[1]-uvnext[+1-3]) : 0.0f; //dy+= 0.25f*(fabs(uv[1]-uvprev[+1-3]) + fabs(uv[1]-uvnext[+1-3])); dy+= 0.25f*(uv_l + uv_r); - uv_l= uvprev[ 5]!=0.0f? fabs(uv[1]-uvprev[+1+3]) : 0.0f; - uv_r= uvnext[ 5]!=0.0f? fabs(uv[1]-uvnext[+1+3]) : 0.0f; + uv_l= uvprev[ 5]!=0.0f? fabsf(uv[1]-uvprev[+1+3]) : 0.0f; + uv_r= uvnext[ 5]!=0.0f? fabsf(uv[1]-uvnext[+1+3]) : 0.0f; //dy+= 0.25f*(fabs(uv[1]-uvprev[+1+3]) + fabs(uv[1]-uvnext[+1+3])); dy+= 0.25f*(uv_l + uv_r); diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c index a0e7beff1ab..27fdcfc1d4e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.c +++ b/source/blender/nodes/composite/nodes/node_composite_math.c @@ -103,10 +103,10 @@ static void do_math(bNode *node, float *out, float *in, float *in2) } else { float y_mod_1 = fmod(in2[0], 1); /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */ - if (y_mod_1 > 0.999 || y_mod_1 < 0.001) { - out[0]= pow(in[0], floor(in2[0] + 0.5)); + if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) { + out[0]= powf(in[0], floorf(in2[0] + 0.5f)); } else { - out[0] = 0.0; + out[0] = 0.0f; } } } diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c index 439616377a1..8411de39353 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c @@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_moviedistortion_out[]= { { -1, 0, "" } }; -static void exec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { if(in[0]->data) { if(node->id) { @@ -57,14 +57,18 @@ static void exec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack ** ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); if(ibuf) { + RenderData *rd= data; ImBuf *obuf; MovieTracking *tracking= &clip->tracking; int width, height; float overscan= 0.0f; + MovieClipUser user= {0}; + + BKE_movieclip_user_set_frame(&user, rd->cfra); ibuf->rect_float= cbuf->rect; - BKE_movieclip_get_size(clip, NULL, &width, &height); + BKE_movieclip_get_size(clip, &user, &width, &height); if(!node->storage) node->storage= BKE_tracking_distortion_create(); diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index 96712baf8b0..730c53a1a29 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -58,7 +58,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac int x, y, yo, xo; ImBuf *ibuf, *obuf; - rad= (M_PI*in[1]->vec[0])/180.0f; + rad= ((float)M_PI*in[1]->vec[0])/180.0f; s= sin(rad); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c index 3b3d57bf442..7944176c5d3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c @@ -53,9 +53,9 @@ static void do_sepycca_601(bNode *UNUSED(node), float *out, float *in) rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT601); /*divided by 255 to normalize for viewing in */ - out[0]= y/255.0; - out[1]= cb/255.0; - out[2]= cr/255.0; + out[0]= y/255.0f; + out[1]= cb/255.0f; + out[2]= cr/255.0f; out[3]= in[3]; } @@ -66,9 +66,9 @@ static void do_sepycca_709(bNode *UNUSED(node), float *out, float *in) rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT709); /*divided by 255 to normalize for viewing in */ - out[0]= y/255.0; - out[1]= cb/255.0; - out[2]= cr/255.0; + out[0]= y/255.0f; + out[1]= cb/255.0f; + out[2]= cr/255.0f; out[3]= in[3]; } @@ -79,9 +79,9 @@ static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in) rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_JFIF_0_255); /*divided by 255 to normalize for viewing in */ - out[0]= y/255.0; - out[1]= cb/255.0; - out[2]= cr/255.0; + out[0]= y/255.0f; + out[1]= cb/255.0f; + out[2]= cr/255.0f; out[3]= in[3]; } @@ -106,9 +106,9 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta } /*divided by 255 to normalize for viewing in */ - out[0]->vec[0] = y/255.0; - out[1]->vec[0] = cb/255.0; - out[2]->vec[0] = cr/255.0; + out[0]->vec[0] = y/255.0f; + out[1]->vec[0] = cb/255.0f; + out[2]->vec[0] = cr/255.0f; out[3]->vec[0] = in[0]->vec[3]; } else if ((out[0]->hasoutput) || (out[1]->hasoutput) || (out[2]->hasoutput) || (out[3]->hasoutput)) { diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index aa8ba12f799..6c7667c6729 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -43,6 +43,8 @@ #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_global.h" #include "BKE_main.h" #include "BKE_node.h" @@ -78,19 +80,19 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func) static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback func) { - func(calldata, NODE_CLASS_INPUT, "Input"); - func(calldata, NODE_CLASS_OUTPUT, "Output"); + func(calldata, NODE_CLASS_INPUT, IFACE_("Input")); + func(calldata, NODE_CLASS_OUTPUT, IFACE_("Output")); if(scene_use_new_shading_nodes(scene)) { - func(calldata, NODE_CLASS_SHADER, "Shader"); - func(calldata, NODE_CLASS_TEXTURE, "Texture"); + func(calldata, NODE_CLASS_SHADER, IFACE_("Shader")); + func(calldata, NODE_CLASS_TEXTURE, IFACE_("Texture")); } - func(calldata, NODE_CLASS_OP_COLOR, "Color"); - func(calldata, NODE_CLASS_OP_VECTOR, "Vector"); - func(calldata, NODE_CLASS_CONVERTOR, "Convertor"); - func(calldata, NODE_CLASS_GROUP, "Group"); - func(calldata, NODE_CLASS_LAYOUT, "Layout"); + func(calldata, NODE_CLASS_OP_COLOR, IFACE_("Color")); + func(calldata, NODE_CLASS_OP_VECTOR, IFACE_("Vector")); + func(calldata, NODE_CLASS_CONVERTOR, IFACE_("Convertor")); + func(calldata, NODE_CLASS_GROUP, IFACE_("Group")); + func(calldata, NODE_CLASS_LAYOUT, IFACE_("Layout")); } static void local_sync(bNodeTree *localtree, bNodeTree *ntree) @@ -233,7 +235,8 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr) @note: preserve material from ShadeInput for material id, nodetree execs change it fix for bug "[#28012] Mat ID messy with shader nodes" */ - Material *mat = shi->mat; bNodeThreadStack *nts = NULL; + Material *mat = shi->mat; + bNodeThreadStack *nts = NULL; bNodeTreeExec *exec = ntree->execdata; /* convert caller data to struct */ diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index 0c86d8fd5e4..d601c205682 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -117,6 +117,8 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo *texco |= TEXCO_NORM|NEED_UV; break; case GEOM_OUT_VCOL: *texco |= NEED_UV; *mode |= MA_VERTEXCOL; break; + case GEOM_OUT_VCOL_ALPHA: + *texco |= NEED_UV; *mode |= MA_VERTEXCOL; break; } } } @@ -242,6 +244,29 @@ static void data_from_gpu_stack_list(ListBase *sockets, bNodeStack **ns, GPUNode node_data_from_gpu_stack(ns[i], &gs[i]); } +bNode *nodeGetActiveTexture(bNodeTree *ntree) +{ + /* this is the node we texture paint and draw in textured draw */ + bNode *node; + + if(!ntree) + return NULL; + + /* check for group edit */ + for(node= ntree->nodes.first; node; node= node->next) + if(node->flag & NODE_GROUP_EDIT) + break; + + if(node) + ntree= (bNodeTree*)node->id; + + for(node= ntree->nodes.first; node; node= node->next) + if(node->flag & NODE_ACTIVE_TEXTURE) + return node; + + return NULL; +} + void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs) { bNodeExec *nodeexec; @@ -285,3 +310,22 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs) } } } + +void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *UNUSED(out)) +{ + NodeTexBase *base= node->storage; + TexMapping *texmap= &base->tex_mapping; + float domin= (texmap->flag & TEXMAP_CLIP_MIN) != 0; + float domax= (texmap->flag & TEXMAP_CLIP_MAX) != 0; + + 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); + GPUNodeLink *tdomin = GPU_uniform(&domin); + GPUNodeLink *tdomax = GPU_uniform(&domax); + + GPU_link(mat, "mapping", in[0].link, tmat, tmin, tmax, tdomin, tdomax, &in[0].link); + } +} + diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h index 3a0c97511e4..48e54d9d0b4 100644 --- a/source/blender/nodes/shader/node_shader_util.h +++ b/source/blender/nodes/shader/node_shader_util.h @@ -40,6 +40,7 @@ #include "MEM_guardedalloc.h" #include "DNA_color_types.h" +#include "DNA_customdata_types.h" #include "DNA_ID.h" #include "DNA_image_types.h" #include "DNA_material_types.h" @@ -91,7 +92,8 @@ typedef struct ShaderCallData { #define GEOM_OUT_UV 4 #define GEOM_OUT_NORMAL 5 #define GEOM_OUT_VCOL 6 -#define GEOM_OUT_FRONTBACK 7 +#define GEOM_OUT_VCOL_ALPHA 7 +#define GEOM_OUT_FRONTBACK 8 /* input socket defines */ @@ -122,6 +124,7 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns); void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, struct bNodeStack *ns); void node_data_from_gpu_stack(struct bNodeStack *ns, struct GPUNodeStack *gs); +void node_shader_gpu_tex_mapping(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out); void ntreeExecGPUNodes(struct bNodeTreeExec *exec, struct GPUMaterial *mat, int do_outputs); diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.c b/source/blender/nodes/shader/nodes/node_shader_add_shader.c new file mode 100644 index 00000000000..d715971e618 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.c @@ -0,0 +1,66 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_add_shader_in[]= { + { SOCK_SHADER, 1, "Shader"}, + { SOCK_SHADER, 1, "Shader"}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_add_shader_out[]= { + { SOCK_SHADER, 0, "Shader"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_add_shader(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_add_shader", in, out); +} + +/* node type definition */ +void register_node_type_sh_add_shader(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_add_shader_in, sh_node_add_shader_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_add_shader); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c new file mode 100644 index 00000000000..4b238f72117 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c @@ -0,0 +1,63 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_attribute_out[]= { + { SOCK_RGBA, 0, "Color"}, + { SOCK_VECTOR, 0, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Fac", 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX}, + { -1, 0, "" } +}; + +static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeShaderAttribute *attr = MEM_callocN(sizeof(NodeShaderAttribute), "NodeShaderAttribute"); + node->storage = attr; +} + +/* node type definition */ +void register_node_type_sh_attribute(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, NULL, sh_node_attribute_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_attribute); + node_type_storage(&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, NULL); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/shader/nodes/node_shader_background.c b/source/blender/nodes/shader/nodes/node_shader_background.c new file mode 100644 index 00000000000..b2bd837d66b --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_background.c @@ -0,0 +1,61 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_background_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Strength", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_background_out[]= { + { SOCK_SHADER, 0, "Background"}, + { -1, 0, "" } +}; + +/* node type definition */ +void register_node_type_sh_background(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_background_in, sh_node_background_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, NULL); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c new file mode 100644 index 00000000000..c71696b351c --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c @@ -0,0 +1,67 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Roughness U", 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Roughness V", 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_bsdf_anisotropic_out[]= { + { SOCK_SHADER, 0, "BSDF"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_bsdf_anisotropic", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); +} + +/* node type definition */ +void register_node_type_sh_bsdf_anisotropic(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_BSDF_ANISOTROPIC, "Glossy Anisotropic BSDF", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_bsdf_anisotropic_in, sh_node_bsdf_anisotropic_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_bsdf_anisotropic); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c new file mode 100644 index 00000000000..737f77d923e --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c @@ -0,0 +1,65 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_bsdf_diffuse_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_bsdf_diffuse_out[]= { + { SOCK_SHADER, 0, "BSDF"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_bsdf_diffuse", in, out, GPU_builtin(GPU_VIEW_NORMAL)); +} + +/* node type definition */ +void register_node_type_sh_bsdf_diffuse(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_bsdf_diffuse_in, sh_node_bsdf_diffuse_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_bsdf_diffuse); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c new file mode 100644 index 00000000000..7d3b91d34d4 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c @@ -0,0 +1,67 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_bsdf_glass_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Roughness", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "IOR", 1.45f, 0.0f, 0.0f, 0.0f, 1.0f, 1000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_bsdf_glass_out[]= { + { SOCK_SHADER, 0, "BSDF"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_bsdf_glass", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); +} + +/* node type definition */ +void register_node_type_sh_bsdf_glass(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_bsdf_glass_in, sh_node_bsdf_glass_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_bsdf_glass); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c new file mode 100644 index 00000000000..5ccc1cf4a61 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c @@ -0,0 +1,67 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_bsdf_glossy_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Roughness", 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_bsdf_glossy_out[]= { + { SOCK_SHADER, 0, "BSDF"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + /* todo: is incoming vector normalized? */ + return GPU_stack_link(mat, "node_bsdf_glossy", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); +} + +/* node type definition */ +void register_node_type_sh_bsdf_glossy(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_bsdf_glossy_in, sh_node_bsdf_glossy_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_bsdf_glossy); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c new file mode 100644 index 00000000000..2836714f477 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c @@ -0,0 +1,65 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_bsdf_translucent_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_bsdf_translucent_out[]= { + { SOCK_SHADER, 0, "BSDF"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_bsdf_translucent", in, out, GPU_builtin(GPU_VIEW_NORMAL)); +} + +/* node type definition */ +void register_node_type_sh_bsdf_translucent(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_bsdf_translucent_in, sh_node_bsdf_translucent_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_bsdf_translucent); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c new file mode 100644 index 00000000000..5352bd9be30 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c @@ -0,0 +1,65 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_bsdf_transparent_in[]= { + { SOCK_RGBA, 1, "Color", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_bsdf_transparent_out[]= { + { SOCK_SHADER, 0, "BSDF"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_bsdf_transparent", in, out); +} + +/* node type definition */ +void register_node_type_sh_bsdf_transparent(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_bsdf_transparent_in, sh_node_bsdf_transparent_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_bsdf_transparent); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c new file mode 100644 index 00000000000..dfcf3b68d67 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c @@ -0,0 +1,66 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_bsdf_velvet_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Sigma", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_bsdf_velvet_out[]= { + { SOCK_SHADER, 0, "BSDF"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_bsdf_velvet", in, out, GPU_builtin(GPU_VIEW_NORMAL)); +} + +/* node type definition */ +void register_node_type_sh_bsdf_velvet(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_bsdf_velvet_in, sh_node_bsdf_velvet_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_bsdf_velvet); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.c b/source/blender/nodes/shader/nodes/node_shader_emission.c new file mode 100644 index 00000000000..6ef82890559 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_emission.c @@ -0,0 +1,66 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_emission_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Strength", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_emission_out[]= { + { SOCK_SHADER, 0, "Emission"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_emission(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_emission", in, out, GPU_builtin(GPU_VIEW_NORMAL)); +} + +/* node type definition */ +void register_node_type_sh_emission(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_emission_in, sh_node_emission_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_emission); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.c b/source/blender/nodes/shader/nodes/node_shader_fresnel.c new file mode 100644 index 00000000000..c5d55c9a1c8 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.c @@ -0,0 +1,65 @@ +/** + * $Id: node_shader_fresnel.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** Fresnel ******************** */ +static bNodeSocketTemplate sh_node_fresnel_in[]= { + { SOCK_FLOAT, 1, "IOR", 1.45f, 0.0f, 0.0f, 0.0f, 1.0f, 1000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_fresnel_out[]= { + { SOCK_FLOAT, 0, "Fac", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + /* todo: is incoming vector normalized? */ + return GPU_stack_link(mat, "node_fresnel", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); +} + +/* node type definition */ +void register_node_type_sh_fresnel(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_fresnel_in, sh_node_fresnel_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_fresnel); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c index 5c4ba75ae67..6547194b33a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geom.c +++ b/source/blender/nodes/shader/nodes/node_shader_geom.c @@ -45,6 +45,7 @@ static bNodeSocketTemplate sh_node_geom_out[]= { { SOCK_VECTOR, 0, "UV"}, { SOCK_VECTOR, 0, "Normal"}, { SOCK_RGBA, 0, "Vertex Color"}, + { SOCK_FLOAT, 0, "Vertex Alpha"}, { SOCK_FLOAT, 0, "Front/Back"}, { -1, 0, "" } }; @@ -91,10 +92,13 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i } copy_v3_v3(out[GEOM_OUT_VCOL]->vec, scol->col); - out[GEOM_OUT_VCOL]->vec[3]= 1.0f; + out[GEOM_OUT_VCOL]->vec[3]= scol->col[3]; + out[GEOM_OUT_VCOL_ALPHA]->vec[0]= scol->col[3]; } - else + else { memcpy(out[GEOM_OUT_VCOL]->vec, defaultvcol, sizeof(defaultvcol)); + out[GEOM_OUT_VCOL_ALPHA]->vec[0]= 1.0f; + } if(shi->osatex) { out[GEOM_OUT_GLOB]->data= shi->dxgl; diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.c b/source/blender/nodes/shader/nodes/node_shader_geometry.c new file mode 100644 index 00000000000..63f6ba3928f --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_geometry.c @@ -0,0 +1,68 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_geometry_out[]= { + { SOCK_VECTOR, 0, "Position", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "Tangent", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "True Normal", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "Incoming", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "Parametric", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Backfacing", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_geometry", in, out, + GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), + GPU_builtin(GPU_INVERSE_VIEW_MATRIX)); +} + +/* node type definition */ +void register_node_type_sh_geometry(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, NULL, sh_node_geometry_out); + node_type_size(&ntype, 120, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_geometry); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.c b/source/blender/nodes/shader/nodes/node_shader_holdout.c new file mode 100644 index 00000000000..747519c861e --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_holdout.c @@ -0,0 +1,60 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_holdout_in[]= { + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_holdout_out[]= { + { SOCK_SHADER, 0, "Holdout"}, + { -1, 0, "" } +}; + + +/* node type definition */ +void register_node_type_sh_holdout(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_HOLDOUT, "Holdout", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_holdout_in, sh_node_holdout_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, NULL); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c new file mode 100644 index 00000000000..16b58e18761 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c @@ -0,0 +1,66 @@ +/** + * $Id: node_shader_layer_weight.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** Layer Weight ******************** */ + +static bNodeSocketTemplate sh_node_layer_weight_in[]= { + { SOCK_FLOAT, 1, "Blend", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_layer_weight_out[]= { + { SOCK_FLOAT, 0, "Fresnel", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Facing", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static int node_shader_gpu_layer_weight(GPUMaterial *UNUSED(mat), bNode *UNUSED(node), GPUNodeStack *UNUSED(in), GPUNodeStack *UNUSED(out)) +{ + return 0; +} + +/* node type definition */ +void register_node_type_sh_layer_weight(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_layer_weight_in, sh_node_layer_weight_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_layer_weight); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.c b/source/blender/nodes/shader/nodes/node_shader_light_path.c new file mode 100644 index 00000000000..d399a0bddd4 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.c @@ -0,0 +1,66 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_light_path_out[]= { + { SOCK_FLOAT, 0, "Is Camera Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Is Shadow Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Is Diffuse Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Is Glossy Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Is Singular Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Is Reflection Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Is Transmission Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static int node_shader_gpu_light_path(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_light_path", in, out); +} + +/* node type definition */ +void register_node_type_sh_light_path(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, NULL, sh_node_light_path_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_light_path); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c index 35007724037..2fa885dcdd3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.c +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c @@ -91,7 +91,7 @@ void register_node_type_sh_mapping(ListBase *lb) static bNodeType ntype; node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); - node_type_compatibility(&ntype, NODE_OLD_SHADING); + node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_mapping_in, sh_node_mapping_out); node_type_size(&ntype, 240, 160, 320); node_type_init(&ntype, node_shader_init_mapping); diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c index 13ee1f79fe6..1c15c49a7da 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.c +++ b/source/blender/nodes/shader/nodes/node_shader_math.c @@ -241,7 +241,7 @@ void register_node_type_sh_math(ListBase *lb) static bNodeType ntype; node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); - node_type_compatibility(&ntype, NODE_OLD_SHADING); + node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_math_in, sh_node_math_out); node_type_size(&ntype, 120, 110, 160); node_type_label(&ntype, node_math_label); diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c index 7692956368c..5d7ec9a23ab 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c @@ -78,7 +78,7 @@ void register_node_type_sh_mix_rgb(ListBase *lb) static bNodeType ntype; node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS); - node_type_compatibility(&ntype, NODE_OLD_SHADING); + node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out); node_type_size(&ntype, 100, 60, 150); node_type_label(&ntype, node_blend_label); diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c new file mode 100644 index 00000000000..5ce2a03f464 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c @@ -0,0 +1,67 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_mix_shader_in[]= { + { SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_SHADER, 1, "Shader"}, + { SOCK_SHADER, 1, "Shader"}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_mix_shader_out[]= { + { SOCK_SHADER, 0, "Shader"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_mix_shader(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_mix_shader", in, out); +} + +/* node type definition */ +void register_node_type_sh_mix_shader(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_MIX_SHADER, "Mix Shader", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_mix_shader_in, sh_node_mix_shader_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_mix_shader); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c new file mode 100644 index 00000000000..2c954d1cf8f --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c @@ -0,0 +1,55 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_output_lamp_in[]= { + { SOCK_SHADER, 1, "Surface", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +/* node type definition */ +void register_node_type_sh_output_lamp(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_OUTPUT_LAMP, "Lamp Output", NODE_CLASS_OUTPUT, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_output_lamp_in, NULL); + node_type_size(&ntype, 120, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, NULL); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c b/source/blender/nodes/shader/nodes/node_shader_output_material.c new file mode 100644 index 00000000000..0059489fcc7 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c @@ -0,0 +1,68 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_output_material_in[]= { + { SOCK_SHADER, 1, "Surface"}, + { SOCK_SHADER, 1, "Volume"}, + { SOCK_FLOAT, 1, "Displacement", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { -1, 0, "" } +}; + +static int node_shader_gpu_output_material(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + GPUNodeLink *outlink; + + GPU_stack_link(mat, "node_output_material", in, out, &outlink); + GPU_material_output_link(mat, outlink); + + return 1; +} + + +/* node type definition */ +void register_node_type_sh_output_material(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_OUTPUT_MATERIAL, "Material Output", NODE_CLASS_OUTPUT, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_output_material_in, NULL); + node_type_size(&ntype, 120, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_output_material); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.c b/source/blender/nodes/shader/nodes/node_shader_output_world.c new file mode 100644 index 00000000000..20bb3ab8f58 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_output_world.c @@ -0,0 +1,56 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_output_world_in[]= { + { SOCK_SHADER, 1, "Surface", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_SHADER, 1, "Volume", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +/* node type definition */ +void register_node_type_sh_output_world(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_OUTPUT_WORLD, "World Output", NODE_CLASS_OUTPUT, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_output_world_in, NULL); + node_type_size(&ntype, 120, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, NULL); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.c b/source/blender/nodes/shader/nodes/node_shader_rgb.c index 67c0ec165ca..58a00ed92e5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_rgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_rgb.c @@ -71,7 +71,7 @@ void register_node_type_sh_rgb(ListBase *lb) static bNodeType ntype; node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS); - node_type_compatibility(&ntype, NODE_OLD_SHADING); + node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_rgb_out); node_type_init(&ntype, node_shader_init_rgb); node_type_size(&ntype, 140, 80, 140); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c new file mode 100644 index 00000000000..a33e5599d77 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c @@ -0,0 +1,72 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +#include "DNA_customdata_types.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_tex_coord_out[]= { + { SOCK_VECTOR, 0, "Generated", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "UV", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "Object", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "Camera", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "Window", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VECTOR, 0, "Reflection", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) +{ + GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); + GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, ""); + + return GPU_stack_link(mat, "node_tex_coord", in, out, + GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), + GPU_builtin(GPU_INVERSE_VIEW_MATRIX), orco, mtface); +} + +/* node type definition */ +void register_node_type_sh_tex_coord(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, NULL, sh_node_tex_coord_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_coord); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c new file mode 100644 index 00000000000..ecf5a053ad3 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c @@ -0,0 +1,89 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_tex_environment_in[]= { + { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_tex_environment_out[]= { + { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeTexEnvironment *tex = MEM_callocN(sizeof(NodeTexEnvironment), "NodeTexEnvironment"); + default_tex_mapping(&tex->base.tex_mapping); + default_color_mapping(&tex->base.color_mapping); + tex->color_space = SHD_COLORSPACE_SRGB; + + node->storage = tex; +} + +static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + Image *ima= (Image*)node->id; + ImageUser *iuser= NULL; + + 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) + in[0].link = GPU_builtin(GPU_VIEW_POSITION); + + node_shader_gpu_tex_mapping(mat, node, in, out); + + return GPU_stack_link(mat, "node_tex_environment", in, out, GPU_image(ima, iuser)); +} + +/* node type definition */ +void register_node_type_sh_tex_environment(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_tex_environment_in, sh_node_tex_environment_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_tex_environment); + node_type_storage(&ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_environment); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c new file mode 100644 index 00000000000..d78a5e9693a --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c @@ -0,0 +1,81 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Gradienter Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** BLEND ******************** */ + +static bNodeSocketTemplate sh_node_tex_gradient_in[]= { + { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_tex_gradient_out[]= { + { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Fac", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeTexGradient *tex = MEM_callocN(sizeof(NodeTexGradient), "NodeTexGradient"); + default_tex_mapping(&tex->base.tex_mapping); + default_color_mapping(&tex->base.color_mapping); + tex->gradient_type = SHD_BLEND_LINEAR; + + node->storage = tex; +} + +static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + if(!in[0].link) + in[0].link = GPU_attribute(CD_ORCO, ""); + + node_shader_gpu_tex_mapping(mat, node, in, out); + + return GPU_stack_link(mat, "node_tex_gradient", in, out); +} + +/* node type definition */ +void register_node_type_sh_tex_gradient(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_tex_gradient_in, sh_node_tex_gradient_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_tex_gradient); + node_type_storage(&ntype, "NodeTexGradient", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_gradient); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c new file mode 100644 index 00000000000..75b5f26b252 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -0,0 +1,89 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_tex_image_in[]= { + { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_tex_image_out[]= { + { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeTexImage *tex = MEM_callocN(sizeof(NodeTexImage), "NodeTexImage"); + default_tex_mapping(&tex->base.tex_mapping); + default_color_mapping(&tex->base.color_mapping); + tex->color_space = SHD_COLORSPACE_SRGB; + + node->storage = tex; +} + +static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + Image *ima= (Image*)node->id; + ImageUser *iuser= NULL; + + 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) + in[0].link = GPU_attribute(CD_MTFACE, ""); + + node_shader_gpu_tex_mapping(mat, node, in, out); + + return GPU_stack_link(mat, "node_tex_image", in, out, GPU_image(ima, iuser)); +} + +/* node type definition */ +void register_node_type_sh_tex_image(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_tex_image_in, sh_node_tex_image_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_tex_image); + node_type_storage(&ntype, "NodeTexImage", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_image); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c new file mode 100644 index 00000000000..6c021a7f900 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c @@ -0,0 +1,86 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_tex_magic_in[]= { + { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { SOCK_FLOAT, 1, "Scale", 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { SOCK_FLOAT, 1, "Distortion", 1.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_tex_magic_out[]= { + { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Fac", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeTexMagic *tex = MEM_callocN(sizeof(NodeTexMagic), "NodeTexMagic"); + default_tex_mapping(&tex->base.tex_mapping); + default_color_mapping(&tex->base.color_mapping); + tex->depth = 2; + + node->storage = tex; +} + +static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + NodeTexMagic *tex = (NodeTexMagic*)node->storage; + float depth = tex->depth; + + if(!in[0].link) + in[0].link = GPU_attribute(CD_ORCO, ""); + + node_shader_gpu_tex_mapping(mat, node, in, out); + + return GPU_stack_link(mat, "node_tex_magic", in, out, GPU_uniform(&depth)); +} + +/* node type definition */ +void register_node_type_sh_tex_magic(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_tex_magic_in, sh_node_tex_magic_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_tex_magic); + node_type_storage(&ntype, "NodeTexMagic", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_magic); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c new file mode 100644 index 00000000000..4aefea3e383 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c @@ -0,0 +1,87 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** MUSGRAVE ******************** */ + +static bNodeSocketTemplate sh_node_tex_musgrave_in[]= { + { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { SOCK_FLOAT, 1, "Scale", 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { SOCK_FLOAT, 1, "Detail", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f}, + { SOCK_FLOAT, 1, "Dimension", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { SOCK_FLOAT, 1, "Lacunarity", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { SOCK_FLOAT, 1, "Offset", 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { SOCK_FLOAT, 1, "Gain", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_tex_musgrave_out[]= { + { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Fac", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeTexMusgrave *tex = MEM_callocN(sizeof(NodeTexMusgrave), "NodeTexMusgrave"); + default_tex_mapping(&tex->base.tex_mapping); + default_color_mapping(&tex->base.color_mapping); + tex->musgrave_type = SHD_MUSGRAVE_FBM; + + node->storage = tex; +} + +static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + if(!in[0].link) + in[0].link = GPU_attribute(CD_ORCO, ""); + + node_shader_gpu_tex_mapping(mat, node, in, out); + + return GPU_stack_link(mat, "node_tex_musgrave", in, out); +} + +/* node type definition */ +void register_node_type_sh_tex_musgrave(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_tex_musgrave_in, sh_node_tex_musgrave_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_tex_musgrave); + node_type_storage(&ntype, "NodeTexMusgrave", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_musgrave); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c new file mode 100644 index 00000000000..6c27384a24d --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c @@ -0,0 +1,83 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** NOISE ******************** */ + +static bNodeSocketTemplate sh_node_tex_noise_in[]= { + { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { SOCK_FLOAT, 1, "Scale", 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { SOCK_FLOAT, 1, "Detail", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f}, + { SOCK_FLOAT, 1, "Distortion", 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_tex_noise_out[]= { + { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Fac", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeTexNoise *tex = MEM_callocN(sizeof(NodeTexNoise), "NodeTexNoise"); + default_tex_mapping(&tex->base.tex_mapping); + default_color_mapping(&tex->base.color_mapping); + + node->storage = tex; +} + +static int node_shader_gpu_tex_noise(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + if(!in[0].link) + in[0].link = GPU_attribute(CD_ORCO, ""); + + node_shader_gpu_tex_mapping(mat, node, in, out); + + return GPU_stack_link(mat, "node_tex_noise", in, out); +} + +/* node type definition */ +void register_node_type_sh_tex_noise(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_tex_noise_in, sh_node_tex_noise_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_tex_noise); + node_type_storage(&ntype, "NodeTexNoise", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_noise); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c new file mode 100644 index 00000000000..1abcec86b12 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -0,0 +1,83 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_tex_sky_in[]= { + { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_tex_sky_out[]= { + { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeTexSky *tex = MEM_callocN(sizeof(NodeTexSky), "NodeTexSky"); + default_tex_mapping(&tex->base.tex_mapping); + default_color_mapping(&tex->base.color_mapping); + tex->sun_direction[0] = 0.0f; + tex->sun_direction[1] = 0.0f; + tex->sun_direction[2] = 1.0f; + tex->turbidity = 2.2f; + + node->storage = tex; +} + +static int node_shader_gpu_tex_sky(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + if(!in[0].link) + in[0].link = GPU_attribute(CD_ORCO, ""); + + node_shader_gpu_tex_mapping(mat, node, in, out); + + return GPU_stack_link(mat, "node_tex_sky", in, out); +} + +/* node type definition */ +void register_node_type_sh_tex_sky(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_tex_sky_in, sh_node_tex_sky_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_tex_sky); + node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_sky); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c new file mode 100644 index 00000000000..6be3a2e928b --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c @@ -0,0 +1,82 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** VORONOI ******************** */ + +static bNodeSocketTemplate sh_node_tex_voronoi_in[]= { + { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { SOCK_FLOAT, 1, "Scale", 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_tex_voronoi_out[]= { + { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Fac", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeTexVoronoi *tex = MEM_callocN(sizeof(NodeTexVoronoi), "NodeTexVoronoi"); + default_tex_mapping(&tex->base.tex_mapping); + default_color_mapping(&tex->base.color_mapping); + tex->coloring = SHD_VORONOI_INTENSITY; + + node->storage = tex; +} + +static int node_shader_gpu_tex_voronoi(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + if(!in[0].link) + in[0].link = GPU_attribute(CD_ORCO, ""); + + node_shader_gpu_tex_mapping(mat, node, in, out); + + return GPU_stack_link(mat, "node_tex_voronoi", in, out); +} + +/* node type definition */ +void register_node_type_sh_tex_voronoi(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_tex_voronoi_in, sh_node_tex_voronoi_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_tex_voronoi); + node_type_storage(&ntype, "NodeTexVoronoi", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_voronoi); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c new file mode 100644 index 00000000000..ed0aa230721 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c @@ -0,0 +1,85 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** WAVE ******************** */ + +static bNodeSocketTemplate sh_node_tex_wave_in[]= { + { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { SOCK_FLOAT, 1, "Scale", 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { SOCK_FLOAT, 1, "Distortion", 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { SOCK_FLOAT, 1, "Detail", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f}, + { SOCK_FLOAT, 1, "Detail Scale", 1.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_tex_wave_out[]= { + { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Fac", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + NodeTexWave *tex = MEM_callocN(sizeof(NodeTexWave), "NodeTexWave"); + default_tex_mapping(&tex->base.tex_mapping); + default_color_mapping(&tex->base.color_mapping); + tex->wave_type = SHD_WAVE_BANDS; + + node->storage = tex; +} + +static int node_shader_gpu_tex_wave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + if(!in[0].link) + in[0].link = GPU_attribute(CD_ORCO, ""); + + node_shader_gpu_tex_mapping(mat, node, in, out); + + return GPU_stack_link(mat, "node_tex_wave", in, out); +} + +/* node type definition */ +void register_node_type_sh_tex_wave(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_tex_wave_in, sh_node_tex_wave_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, node_shader_init_tex_wave); + node_type_storage(&ntype, "NodeTexWave", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_tex_wave); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c index 4d41e62b242..94afd09274a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c @@ -117,7 +117,7 @@ void register_node_type_sh_rgbtobw(ListBase *lb) static bNodeType ntype; node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING); + node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_rgbtobw_in, sh_node_rgbtobw_out); node_type_size(&ntype, 80, 40, 120); node_type_exec(&ntype, node_shader_exec_rgbtobw); diff --git a/source/blender/nodes/shader/nodes/node_shader_value.c b/source/blender/nodes/shader/nodes/node_shader_value.c index 4a8aa6c9cf4..8f490f4953b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_value.c +++ b/source/blender/nodes/shader/nodes/node_shader_value.c @@ -71,7 +71,7 @@ void register_node_type_sh_value(ListBase *lb) static bNodeType ntype; node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS); - node_type_compatibility(&ntype, NODE_OLD_SHADING); + node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_value_out); node_type_init(&ntype, node_shader_init_value); node_type_size(&ntype, 80, 50, 120); diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c index b3f995dcdce..bb56037b4d4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c +++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c @@ -135,7 +135,7 @@ void register_node_type_sh_vect_math(ListBase *lb) static bNodeType ntype; node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); - node_type_compatibility(&ntype, NODE_OLD_SHADING); + node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_vect_math_in, sh_node_vect_math_out); node_type_size(&ntype, 80, 75, 140); node_type_label(&ntype, node_vect_math_label); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c b/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c new file mode 100644 index 00000000000..9f4c1447f65 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c @@ -0,0 +1,66 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_volume_isotropic_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Density", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_volume_isotropic_out[]= { + { SOCK_SHADER, 0, "Volume"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_volume_isotropic(GPUMaterial *UNUSED(mat), bNode *UNUSED(node), GPUNodeStack *UNUSED(in), GPUNodeStack *UNUSED(out)) +{ + return 0; +} + +/* node type definition */ +void register_node_type_sh_volume_isotropic(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_VOLUME_ISOTROPIC, "Isotropic Volume", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_volume_isotropic_in, sh_node_volume_isotropic_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_volume_isotropic); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c b/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c new file mode 100644 index 00000000000..910933bb5fa --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c @@ -0,0 +1,66 @@ +/** + * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_volume_transparent_in[]= { + { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Density", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_volume_transparent_out[]= { + { SOCK_SHADER, 0, "Volume"}, + { -1, 0, "" } +}; + +static int node_shader_gpu_volume_transparent(GPUMaterial *UNUSED(mat), bNode *UNUSED(node), GPUNodeStack *UNUSED(in), GPUNodeStack *UNUSED(out)) +{ + return 0; +} + +/* node type definition */ +void register_node_type_sh_volume_transparent(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_VOLUME_TRANSPARENT, "Transparent Volume", NODE_CLASS_SHADER, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_volume_transparent_in, sh_node_volume_transparent_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, node_shader_gpu_volume_transparent); + + nodeRegisterType(lb, &ntype); +}; + diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 84bb53e2215..e863e9f6e0f 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -39,6 +39,8 @@ #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_global.h" #include "BKE_main.h" #include "BKE_node.h" @@ -64,15 +66,15 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func) static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func) { - func(calldata, NODE_CLASS_INPUT, "Input"); - func(calldata, NODE_CLASS_OUTPUT, "Output"); - func(calldata, NODE_CLASS_OP_COLOR, "Color"); - func(calldata, NODE_CLASS_PATTERN, "Patterns"); - func(calldata, NODE_CLASS_TEXTURE, "Textures"); - func(calldata, NODE_CLASS_CONVERTOR, "Convertor"); - func(calldata, NODE_CLASS_DISTORT, "Distort"); - func(calldata, NODE_CLASS_GROUP, "Group"); - func(calldata, NODE_CLASS_LAYOUT, "Layout"); + func(calldata, NODE_CLASS_INPUT, IFACE_("Input")); + func(calldata, NODE_CLASS_OUTPUT, IFACE_("Output")); + func(calldata, NODE_CLASS_OP_COLOR, IFACE_("Color")); + func(calldata, NODE_CLASS_PATTERN, IFACE_("Patterns")); + func(calldata, NODE_CLASS_TEXTURE, IFACE_("Textures")); + func(calldata, NODE_CLASS_CONVERTOR, IFACE_("Convertor")); + func(calldata, NODE_CLASS_DISTORT, IFACE_("Distort")); + func(calldata, NODE_CLASS_GROUP, IFACE_("Group")); + func(calldata, NODE_CLASS_LAYOUT, IFACE_("Layout")); } static void local_sync(bNodeTree *localtree, bNodeTree *ntree) |