[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17426] trunk/blender/source/blender/nodes /intern: Added new files for previous commit...

Ton Roosendaal ton at blender.org
Wed Nov 12 20:10:41 CET 2008


Revision: 17426
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17426
Author:   ton
Date:     2008-11-12 20:10:41 +0100 (Wed, 12 Nov 2008)

Log Message:
-----------
Added new files for previous commit...

Added Paths:
-----------
    trunk/blender/source/blender/nodes/intern/TEX_nodes/
    trunk/blender/source/blender/nodes/intern/TEX_nodes/Makefile
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_image.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_invert.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_math.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_texture.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_translate.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
    trunk/blender/source/blender/nodes/intern/TEX_util.h

Added: trunk/blender/source/blender/nodes/intern/TEX_nodes/Makefile
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/Makefile	                        (rev 0)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/Makefile	2008-11-12 19:10:41 UTC (rev 17426)
@@ -0,0 +1,48 @@
+#
+# $Id: Makefile 12796 2007-12-05 16:58:52Z sirdude $
+#
+# ***** BEGIN GPL/BL DUAL 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. 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; 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL/BL DUAL LICENSE BLOCK *****
+#
+#
+
+LIBNAME = nodes_tex
+DIR = $(OCGDIR)/blender/$(LIBNAME)
+
+include nan_compile.mk
+
+CFLAGS += $(LEVEL_1_C_WARNINGS)
+
+CPPFLAGS += -I../../../blenkernel
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+CPPFLAGS += -I../../../makesdna
+CPPFLAGS += -I../../../blenlib
+CPPFLAGS += -I../../../include
+CPPFLAGS += -I../../../imbuf
+CPPFLAGS += -I../../../render/extern/include
+CPPFLAGS += -I$(OPENGL_HEADERS)

Added: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c	                        (rev 0)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c	2008-11-12 19:10:41 UTC (rev 17426)
@@ -0,0 +1,123 @@
+/**
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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 "../TEX_util.h"                                                   
+#include <math.h>
+
+static bNodeSocketType inputs[]= {
+	{ SOCK_RGBA,  1, "Bricks 1",    0.596f, 0.282f, 0.0f,  1.0f,  0.0f,    1.0f },
+	{ SOCK_RGBA,  1, "Bricks 2",    0.632f, 0.504f, 0.05f, 1.0f,  0.0f,    1.0f },
+	{ SOCK_RGBA,  1, "Mortar",      0.0f,   0.0f,   0.0f,  1.0f,  0.0f,    1.0f },
+	{ SOCK_VALUE, 1, "Thickness",   0.02f,  0.0f,   0.0f,  0.0f,  0.0f,    1.0f },
+	{ SOCK_VALUE, 1, "Bias",        0.0f,   0.0f,   0.0f,  0.0f, -1.0f,    1.0f },
+	{ SOCK_VALUE, 1, "Brick Width", 0.5f,   0.0f,   0.0f,  0.0f,  0.001f, 99.0f },
+	{ SOCK_VALUE, 1, "Row Height",  0.25f,  0.0f,   0.0f,  0.0f,  0.001f, 99.0f },
+	{ -1, 0, "" }
+};
+static bNodeSocketType outputs[]= {
+	{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+	{ -1, 0, ""	}
+};
+
+static void init(bNode *node) {
+	node->custom3 = 0.5; /* offset */
+	node->custom4 = 1.0; /* squash */
+}
+
+static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
+{
+	float x = coord[0];
+	float y = coord[1];
+	
+	float bricknum, rownum, offset = 0;
+	float ins_x, ins_y;
+	float tint;
+	
+	float bricks1[4];
+	float bricks2[4];
+	float mortar[4];
+	
+	float mortar_thickness = tex_input_value(in[3], coord, thread);
+	float bias             = tex_input_value(in[4], coord, thread);
+	float brick_width      = tex_input_value(in[5], coord, thread);
+	float row_height       = tex_input_value(in[6], coord, thread);
+	
+	tex_input_rgba(bricks1, in[0], coord, thread);
+	tex_input_rgba(bricks2, in[1], coord, thread);
+	tex_input_rgba(mortar,  in[2], coord, thread);
+	
+	rownum = floor(y / row_height);
+	
+	if( node->custom1 && node->custom2 ) {
+		brick_width *= ((int)(rownum) % node->custom2 ) ? 1.0f : node->custom4;      /* squash */
+		offset = ((int)(rownum) % node->custom1 ) ? 0 : (brick_width*node->custom3); /* offset */
+	}
+	
+	bricknum = floor((x+offset) / brick_width);
+	
+	ins_x = (x+offset) - brick_width*bricknum;
+	ins_y = y - row_height*rownum;
+	
+	srand( (123456*rownum) + bricknum );
+	tint = rand() / (float)RAND_MAX + bias;
+	CLAMP(tint,0.0f,1.0f);
+	
+	if( ins_x < mortar_thickness || ins_y < mortar_thickness ||
+		ins_x > (brick_width - mortar_thickness) ||
+		ins_y > (row_height - mortar_thickness) ) {
+		QUATCOPY( out, mortar );
+	} else {
+		QUATCOPY( out, bricks1 );
+		ramp_blend( MA_RAMP_BLEND, out, out+1, out+2, tint, bricks2 );
+	}
+}
+
+static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+{
+	tex_output(node, in, out[0], &colorfn);
+	
+	tex_do_preview(node, out[0], data);
+}
+
+bNodeType tex_node_bricks= {
+	/* *next,*prev */	NULL, NULL,
+	/* type code   */	TEX_NODE_BRICKS,
+	/* name        */	"Bricks",
+	/* width+range */	150, 60, 150,
+	/* class+opts  */	NODE_CLASS_PATTERN, NODE_OPTIONS | NODE_PREVIEW,
+	/* input sock  */	inputs,
+	/* output sock */	outputs,
+	/* storage     */	"", 
+	/* execfunc    */	exec,
+	/* butfunc     */	NULL,
+	/* initfunc    */	init,
+	/* freestoragefunc    */	NULL,
+	/* copystoragefunc    */	NULL,
+	/* id          */	NULL
+	
+};

Added: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_checker.c	                        (rev 0)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_checker.c	2008-11-12 19:10:41 UTC (rev 17426)
@@ -0,0 +1,85 @@
+/**
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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 "../TEX_util.h"                                                   
+#include <math.h>
+
+static bNodeSocketType inputs[]= {
+	{ SOCK_RGBA, 1, "Color1", 1.0f, 0.0f, 0.0f, 1.0f,  0.0f, 1.0f },
+	{ SOCK_RGBA, 1, "Color2", 1.0f, 1.0f, 1.0f, 1.0f,  0.0f, 1.0f },
+	{ SOCK_VALUE, 1, "Size",   0.5f, 0.0f, 0.0f, 0.0f,  0.0f, 100.0f },
+	{ -1, 0, "" }
+};
+static bNodeSocketType outputs[]= {
+	{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+	{ -1, 0, "" }
+};
+
+static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
+{
+	float x  = coord[0];
+	float y  = coord[1];
+	float z  = coord[2];
+	float sz = tex_input_value(in[2], coord, thread);
+	
+	/* 0.00001  because of unit sized stuff */
+	int xi = (int)fabs(floor(0.00001 + x / sz));
+	int yi = (int)fabs(floor(0.00001 + y / sz));
+	int zi = (int)fabs(floor(0.00001 + z / sz));
+	
+	if( (xi % 2 == yi % 2) == (zi % 2) ) {
+		tex_input_rgba(out, in[0], coord, thread);
+	} else {
+		tex_input_rgba(out, in[1], coord, thread);
+	} 
+}
+
+static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+{
+	tex_output(node, in, out[0], &colorfn);
+	
+	tex_do_preview(node, out[0], data);
+}
+
+bNodeType tex_node_checker= {
+	/* *next,*prev */	NULL, NULL,
+	/* type code   */	TEX_NODE_CHECKER,
+	/* name        */	"Checker",
+	/* width+range */	100, 60, 150,
+	/* class+opts  */	NODE_CLASS_PATTERN, NODE_OPTIONS | NODE_PREVIEW,
+	/* input sock  */	inputs,
+	/* output sock */	outputs,
+	/* storage     */	"", 
+	/* execfunc    */	exec,
+	/* butfunc     */	NULL,
+	/* initfunc    */	NULL,
+	/* freestoragefunc    */	NULL,
+	/* copystoragefunc    */	NULL,
+	/* id          */	NULL
+	
+};

Added: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_curves.c	                        (rev 0)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_curves.c	2008-11-12 19:10:41 UTC (rev 17426)
@@ -0,0 +1,127 @@
+/**
+ *
+ * ***** 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.
+ *

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list