diff options
author | Thomas Dinges <blender@dingto.org> | 2013-06-13 12:55:51 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2013-06-13 12:55:51 +0400 |
commit | d523d27e621f92c2fd9cb53f9dbbb62750bacc2c (patch) | |
tree | 9233a7d9810a1877958433d4771e50c8e2692d13 /source/blender | |
parent | 182914873a13485a7b8d7b85884c655fccdefa48 (diff) |
Cycles / Blackbody node:
* First step towards a Blackbody to RGB converter. You can specify a color in Kelvin inside the node.
* Only implemented for OSL atm, SVM will follow.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 1 | ||||
-rw-r--r-- | source/blender/nodes/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/nodes/NOD_shader.h | 1 | ||||
-rw-r--r-- | source/blender/nodes/NOD_static_types.h | 1 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_blackbody.c | 54 |
6 files changed, 59 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index b43747ab33a..bc1ef7ac5c9 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -742,6 +742,7 @@ struct ShadeResult; #define SH_NODE_WIREFRAME 178 #define SH_NODE_BSDF_TOON 179 #define SH_NODE_WAVELENGTH 180 +#define SH_NODE_BLACKBODY 181 /* custom defines options for Material node */ #define SH_NODE_MAT_DIFF 1 diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index d40e0daf247..150fc8e0c33 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3403,6 +3403,7 @@ static void registerShaderNodes(void) register_node_type_sh_rgb(); register_node_type_sh_wireframe(); register_node_type_sh_wavelength(); + register_node_type_sh_blackbody(); register_node_type_sh_mix_rgb(); register_node_type_sh_valtorgb(); register_node_type_sh_rgbtobw(); diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index cc1a5f8cee9..4b7ee2aed51 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -146,6 +146,7 @@ set(SRC shader/nodes/node_shader_value.c shader/nodes/node_shader_wireframe.c shader/nodes/node_shader_wavelength.c + shader/nodes/node_shader_blackbody.c shader/nodes/node_shader_vectMath.c shader/nodes/node_shader_add_shader.c shader/nodes/node_shader_ambient_occlusion.c diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h index edb0ba6f475..a56d78af309 100644 --- a/source/blender/nodes/NOD_shader.h +++ b/source/blender/nodes/NOD_shader.h @@ -81,6 +81,7 @@ void register_node_type_sh_object_info(void); void register_node_type_sh_fresnel(void); void register_node_type_sh_wireframe(void); void register_node_type_sh_wavelength(void); +void register_node_type_sh_blackbody(void); void register_node_type_sh_layer_weight(void); void register_node_type_sh_tex_coord(void); void register_node_type_sh_particle_info(void); diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 8e3896f40f7..6d950d2a469 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -97,6 +97,7 @@ DefNode( ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PA DefNode( ShaderNode, SH_NODE_HAIR_INFO, 0, "HAIR_INFO", HairInfo, "Hair Info", "" ) DefNode( ShaderNode, SH_NODE_WIREFRAME, def_sh_tex_wireframe, "WIREFRAME", Wireframe, "Wireframe", "" ) DefNode( ShaderNode, SH_NODE_WAVELENGTH, 0, "WAVELENGTH", Wavelength, "Wavelength", "" ) +DefNode( ShaderNode, SH_NODE_BLACKBODY, 0, "BLACKBODY", Blackbody, "Blackbody", "" ) DefNode( ShaderNode, SH_NODE_BUMP, def_sh_bump, "BUMP", Bump, "Bump", "" ) DefNode( ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, "NORMAL_MAP", NormalMap, "Normal Map", "" ) DefNode( ShaderNode, SH_NODE_TANGENT, def_sh_tangent, "TANGENT", Tangent, "Tangent", "" ) diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.c b/source/blender/nodes/shader/nodes/node_shader_blackbody.c new file mode 100644 index 00000000000..0a59032778a --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.c @@ -0,0 +1,54 @@ +/* + * ***** 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" + +/* **************** Blackbody ******************** */ +static bNodeSocketTemplate sh_node_blackbody_in[] = { + { SOCK_FLOAT, 1, N_("Temperature"), 1200.0f, 0.0f, 0.0f, 0.0f, 1.0f, 10000.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_blackbody_out[] = { + { SOCK_RGBA, 0, N_("Color")}, + { -1, 0, "" } +}; + +/* node type definition */ +void register_node_type_sh_blackbody(void) +{ + static bNodeType ntype; + + sh_node_type_base(&ntype, SH_NODE_BLACKBODY, "Blackbody", NODE_CLASS_CONVERTOR, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); + node_type_socket_templates(&ntype, sh_node_blackbody_in, sh_node_blackbody_out); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + + nodeRegisterType(&ntype); +} |