diff options
author | Thomas Dinges <blender@dingto.org> | 2013-08-01 01:27:48 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2013-08-01 01:27:48 +0400 |
commit | 2a2f0319bc1e9c16331f356730a1edb837f4056b (patch) | |
tree | c306be867a197ad2201ec158865111a7fc65f962 /source/blender | |
parent | 34009da32efcea87e80c6205c9a152ad3f30bbb7 (diff) | |
parent | 285ef99931447646b20ec968ec87f7c68939a104 (diff) |
Cycles / HSV Separator and Combine node:
* Added nodes to separate and combine hsv colors.
Part of my GSoC 2013 project, SVN merge of r57981.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 2 | ||||
-rw-r--r-- | source/blender/nodes/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/nodes/NOD_shader.h | 2 | ||||
-rw-r--r-- | source/blender/nodes/NOD_static_types.h | 2 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c | 80 |
6 files changed, 89 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 5f84450045f..c151d47334e 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -744,6 +744,8 @@ struct ShadeResult; #define SH_NODE_WAVELENGTH 180 #define SH_NODE_BLACKBODY 181 #define SH_NODE_VECT_TRANSFORM 182 +#define SH_NODE_SEPHSV 183 +#define SH_NODE_COMBHSV 184 /* 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 1f7d1c84bbe..5001aa01653 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3424,6 +3424,8 @@ static void registerShaderNodes(void) register_node_type_sh_invert(); register_node_type_sh_seprgb(); register_node_type_sh_combrgb(); + register_node_type_sh_sephsv(); + register_node_type_sh_combhsv(); register_node_type_sh_hue_sat(); register_node_type_sh_attribute(); diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 3241f98ad1e..64261246e3d 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -140,6 +140,7 @@ set(SRC shader/nodes/node_shader_output.c shader/nodes/node_shader_rgb.c shader/nodes/node_shader_sepcombRGB.c + shader/nodes/node_shader_sepcombHSV.c shader/nodes/node_shader_squeeze.c shader/nodes/node_shader_texture.c shader/nodes/node_shader_valToRgb.c diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h index a8c77a9baed..ec39d81618d 100644 --- a/source/blender/nodes/NOD_shader.h +++ b/source/blender/nodes/NOD_shader.h @@ -70,6 +70,8 @@ void register_node_type_sh_material_ext(void); void register_node_type_sh_invert(void); void register_node_type_sh_seprgb(void); void register_node_type_sh_combrgb(void); +void register_node_type_sh_sephsv(void); +void register_node_type_sh_combhsv(void); void register_node_type_sh_hue_sat(void); void register_node_type_sh_tex_brick(void); diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 81f3fbf7432..0b526fcde0e 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -115,6 +115,8 @@ DefNode( ShaderNode, SH_NODE_TEX_CHECKER, def_sh_tex_checker, "TE DefNode( ShaderNode, SH_NODE_TEX_BRICK, def_sh_tex_brick, "TEX_BRICK", TexBrick, "Brick Texture", "" ) DefNode( ShaderNode, SH_NODE_TEX_COORD, def_sh_tex_coord, "TEX_COORD", TexCoord, "Texture Coordinate","" ) DefNode( ShaderNode, SH_NODE_VECT_TRANSFORM, def_sh_vect_transform, "VECT_TRANSFORM", VectorTransform, "Vector Transform", "" ) +DefNode( ShaderNode, SH_NODE_SEPHSV, 0, "SEPHSV", SeparateHSV, "Separate HSV", "" ) +DefNode( ShaderNode, SH_NODE_COMBHSV, 0, "COMBHSV", CombineHSV, "Combine HSV", "" ) DefNode( CompositorNode, CMP_NODE_VIEWER, def_cmp_viewer, "VIEWER", Viewer, "Viewer", "" ) DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" ) diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c new file mode 100644 index 00000000000..707e295241a --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c @@ -0,0 +1,80 @@ +/* + * ***** 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) 2013 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/nodes/shader/nodes/node_shader_sepcombHSV.c + * \ingroup shdnodes + */ + + +#include "node_shader_util.h" + +/* **************** SEPARATE HSV ******************** */ +static bNodeSocketTemplate sh_node_sephsv_in[] = { + { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, + { -1, 0, "" } +}; +static bNodeSocketTemplate sh_node_sephsv_out[] = { + { SOCK_FLOAT, 0, N_("H")}, + { SOCK_FLOAT, 0, N_("S")}, + { SOCK_FLOAT, 0, N_("V")}, + { -1, 0, "" } +}; + +void register_node_type_sh_sephsv(void) +{ + static bNodeType ntype; + + sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTOR, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_sephsv_in, sh_node_sephsv_out); + + nodeRegisterType(&ntype); +} + + +/* **************** COMBINE HSV ******************** */ +static bNodeSocketTemplate sh_node_combhsv_in[] = { + { SOCK_FLOAT, 1, N_("H"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, + { SOCK_FLOAT, 1, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, + { SOCK_FLOAT, 1, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, + { -1, 0, "" } +}; +static bNodeSocketTemplate sh_node_combhsv_out[] = { + { SOCK_RGBA, 0, N_("Color")}, + { -1, 0, "" } +}; + +void register_node_type_sh_combhsv(void) +{ + static bNodeType ntype; + + sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTOR, 0); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_combhsv_in, sh_node_combhsv_out); + + nodeRegisterType(&ntype); +} |