diff options
author | Thomas Dinges <blender@dingto.org> | 2013-05-20 19:58:37 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2013-05-20 19:58:37 +0400 |
commit | 3758193c18a886faa5bb803dd378f24866e793e5 (patch) | |
tree | 9d013e4f7008845a3a2b04539396bb2e2e341888 /source | |
parent | 38dc85f296a27a5641d296c8f41834db41dac18b (diff) |
Cycles / Wireframe node:
* Added a wireframe node (Input category) to get access to Mesh wireframe data.
The thickness can be controlled via a "Size" parameter, and is available in world units (default) and screen pixel size.
* Only the triangulated mesh is available now, quads is for later.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/More#Wireframe
Render and Example file:
http://www.pasteall.org/pic/show.php?id=51731
http://www.pasteall.org/blend/21510
Diffstat (limited to 'source')
-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/editors/space_node/drawnode.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 10 | ||||
-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_wireframe.c | 54 |
8 files changed, 77 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 8723afb881b..9f8858f760b 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -738,6 +738,7 @@ struct ShadeResult; #define SH_NODE_NORMAL_MAP 175 #define SH_NODE_HAIR_INFO 176 #define SH_NODE_SUBSURFACE_SCATTERING 177 +#define SH_NODE_WIREFRAME 178 /* 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 75bf594a976..ad046af964f 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3394,6 +3394,7 @@ static void registerShaderNodes(void) register_node_type_sh_brightcontrast(); register_node_type_sh_value(); register_node_type_sh_rgb(); + register_node_type_sh_wireframe(); register_node_type_sh_mix_rgb(); register_node_type_sh_valtorgb(); register_node_type_sh_rgbtobw(); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 9ce28cc3314..e26fe5f6f3e 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -759,6 +759,11 @@ static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), Po uiItemR(layout, ptr, "attribute_name", 0, IFACE_("Name"), ICON_NONE); } +static void node_shader_buts_wireframe(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "use_pixel_size", 0, NULL, 0); +} + static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr) { PointerRNA imaptr = RNA_pointer_get(ptr, "image"); @@ -965,6 +970,9 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_ATTRIBUTE: ntype->uifunc = node_shader_buts_attribute; break; + case SH_NODE_WIREFRAME: + ntype->uifunc = node_shader_buts_wireframe; + break; case SH_NODE_TEX_SKY: ntype->uifunc = node_shader_buts_tex_sky; break; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index a40d85ae954..308fab7e610 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -3406,6 +3406,16 @@ static void def_sh_tex_coord(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_sh_tex_wireframe(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "use_pixel_size", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); + RNA_def_property_ui_text(prop, "Pixel Size", "Use screen pixel size instead of world units"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + static void def_glossy(StructRNA *srna) { PropertyRNA *prop; diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index f2ce9665e2b..3e0c57f4960 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -145,6 +145,7 @@ set(SRC shader/nodes/node_shader_texture.c shader/nodes/node_shader_valToRgb.c shader/nodes/node_shader_value.c + shader/nodes/node_shader_wireframe.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 eb324182e39..334f8f48ca0 100644 --- a/source/blender/nodes/NOD_shader.h +++ b/source/blender/nodes/NOD_shader.h @@ -79,6 +79,7 @@ void register_node_type_sh_light_path(void); void register_node_type_sh_light_falloff(void); 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_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 f9868966892..2754fb1b886 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -94,6 +94,7 @@ DefNode( ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, "LI DefNode( ShaderNode, SH_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "" ) DefNode( ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PARTICLE_INFO", ParticleInfo, "Particle Info", "" ) 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_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_wireframe.c b/source/blender/nodes/shader/nodes/node_shader_wireframe.c new file mode 100644 index 00000000000..76a176db614 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.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" + +/* **************** Wireframe ******************** */ +static bNodeSocketTemplate sh_node_wireframe_in[] = { + { SOCK_FLOAT, 1, N_("Size"), 0.01f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f}, + { -1, 0, "" } +}; + +static bNodeSocketTemplate sh_node_wireframe_out[] = { + { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +/* node type definition */ +void register_node_type_sh_wireframe(void) +{ + static bNodeType ntype; + + sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_socket_templates(&ntype, sh_node_wireframe_in, sh_node_wireframe_out); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + + nodeRegisterType(&ntype); +} |