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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2011-12-17 00:35:06 +0400
committerDalai Felinto <dfelinto@gmail.com>2011-12-17 00:35:06 +0400
commit2a6fdbcccdb285664d921d59f66f96d0345124de (patch)
tree3d7b8d41a05318d43821efe43548ac8df5162d78 /source/blender
parent3311164b24da61f2967f96d0ee27508a7e2e0267 (diff)
Cycles Gamma Node
Node specially useful for Texture correction. This is also a nice example of a simple node made from scratch in case someone wants to create their custom nodes. Review by Brecht.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_node.h1
-rw-r--r--source/blender/blenkernel/intern/node.c1
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h1
-rw-r--r--source/blender/nodes/CMakeLists.txt1
-rw-r--r--source/blender/nodes/NOD_shader.h1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_gamma.c63
6 files changed, 68 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 5dbf22b54bf..378e5872791 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -521,6 +521,7 @@ struct ShadeResult;
#define SH_NODE_LAYER_WEIGHT 160
#define SH_NODE_VOLUME_TRANSPARENT 161
#define SH_NODE_VOLUME_ISOTROPIC 162
+#define SH_NODE_GAMMA 163
/* 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 7be6ef9968d..cc49e8465b9 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1899,6 +1899,7 @@ static void registerShaderNodes(bNodeTreeType *ttype)
register_node_type_sh_output(ttype);
register_node_type_sh_material(ttype);
register_node_type_sh_camera(ttype);
+ register_node_type_sh_gamma(ttype);
register_node_type_sh_value(ttype);
register_node_type_sh_rgb(ttype);
register_node_type_sh_mix_rgb(ttype);
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index d8fabad824e..19082ea4689 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -40,6 +40,7 @@ DefNode( ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTO
DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
+DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" )
DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" )
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 1b327edbc9f..a09aa7a52a3 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -113,6 +113,7 @@ set(SRC
shader/nodes/node_shader_common.c
shader/nodes/node_shader_curves.c
shader/nodes/node_shader_dynamic.c
+ shader/nodes/node_shader_gamma.c
shader/nodes/node_shader_geom.c
shader/nodes/node_shader_hueSatVal.c
shader/nodes/node_shader_invert.c
diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h
index ae255517733..2cabdd33971 100644
--- a/source/blender/nodes/NOD_shader.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -54,6 +54,7 @@ void register_node_type_sh_valtorgb(struct bNodeTreeType *ttype);
void register_node_type_sh_rgbtobw(struct bNodeTreeType *ttype);
void register_node_type_sh_texture(struct bNodeTreeType *ttype);
void register_node_type_sh_normal(struct bNodeTreeType *ttype);
+void register_node_type_sh_gamma(struct bNodeTreeType *ttype);
void register_node_type_sh_geom(struct bNodeTreeType *ttype);
void register_node_type_sh_mapping(struct bNodeTreeType *ttype);
void register_node_type_sh_curve_vec(struct bNodeTreeType *ttype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.c b/source/blender/nodes/shader/nodes/node_shader_gamma.c
new file mode 100644
index 00000000000..1d525d71698
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_gamma.c
@@ -0,0 +1,63 @@
+/*
+ * ***** 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) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+
+*/
+
+/** \file blender/nodes/composite/nodes/node_composite_gamma.c
+ * \ingroup cmpnodes
+ */
+
+
+#include "node_shader_util.h"
+
+/* **************** Gamma Tools ******************** */
+
+static bNodeSocketTemplate sh_node_gamma_in[]= {
+ { SOCK_RGBA, 1, "Color", 1.0f, 1.0f, 1.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Gamma", 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED},
+ { -1, 0, "" }
+};
+
+static bNodeSocketTemplate sh_node_gamma_out[]= {
+ { SOCK_RGBA, 0, "Color"},
+ { -1, 0, "" }
+};
+
+void register_node_type_sh_gamma(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_socket_templates(&ntype, sh_node_gamma_in, sh_node_gamma_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_init(&ntype, NULL);
+ node_type_storage(&ntype, "", NULL, NULL);
+ node_type_exec(&ntype, NULL);
+ node_type_gpu(&ntype, NULL);
+
+ nodeRegisterType(ttype, &ntype);
+}