[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26958] trunk/blender/source/blender: Texture Nodes:

Brecht Van Lommel brecht at blender.org
Tue Feb 16 16:45:19 CET 2010


Revision: 26958
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26958
Author:   blendix
Date:     2010-02-16 16:45:19 +0100 (Tue, 16 Feb 2010)

Log Message:
-----------
Texture Nodes:

* Remove the manual OSA method but rather pass on derivatives to the
  textures. This means that at the moment e.g. the bricks node is not
  antialiased, but that image textures are now using mipmaps. Doing
  oversampling on the whole nodetree is convenient but it is really
  the individual textures that can do filtering best and quickest.
* Image textures in a texture node tree were not color corrected and
  did not support 2d mapping, now it's passing along shadeinput to
  make this possible. Would like to avoid this but not sure how.
* Fix preview not filling in all pixels when scaling or rotating in
  the texture nodes.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_node.h
    trunk/blender/source/blender/nodes/intern/SHD_nodes/SHD_texture.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_at.c
    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_coord.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_image.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_scale.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_valToNor.c
    trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
    trunk/blender/source/blender/nodes/intern/TEX_util.c
    trunk/blender/source/blender/nodes/intern/TEX_util.h
    trunk/blender/source/blender/render/extern/include/RE_shader_ext.h
    trunk/blender/source/blender/render/intern/source/texture.c

Modified: trunk/blender/source/blender/blenkernel/BKE_node.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_node.h	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/blenkernel/BKE_node.h	2010-02-16 15:45:19 UTC (rev 26958)
@@ -433,7 +433,7 @@
 /* API */
 int  ntreeTexTagAnimated(struct bNodeTree *ntree);
 void ntreeTexSetPreviewFlag(int);
-void ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target, float *coord, float *dxt, float *dyt, short thread, struct Tex *tex, short which_output, int cfra, int preview);
+int ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target, float *coord, float *dxt, float *dyt, int osatex, short thread, struct Tex *tex, short which_output, int cfra, int preview, struct ShadeInput *shi, struct MTex *mtex);
 void ntreeTexCheckCyclics(struct bNodeTree *ntree);
 char* ntreeTexOutputMenu(struct bNodeTree *ntree);
 

Modified: trunk/blender/source/blender/nodes/intern/SHD_nodes/SHD_texture.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/SHD_nodes/SHD_texture.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/SHD_nodes/SHD_texture.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -64,7 +64,7 @@
 			
 			if(in[0]->datatype==NS_OSA_VECTORS) {
 				float *fp= in[0]->data;
-				retval= multitex_thread((Tex *)node->id, vec, fp, fp+3, shi->osatex, &texres, thread, which_output);
+				retval= multitex_nodes((Tex *)node->id, vec, fp, fp+3, shi->osatex, &texres, thread, which_output, NULL, NULL);
 			}
 			else if(in[0]->datatype==NS_OSA_VALUES) {
 				float *fp= in[0]->data;
@@ -72,14 +72,14 @@
 				
 				dxt[0]= fp[0]; dxt[1]= dxt[2]= 0.0f;
 				dyt[0]= fp[1]; dyt[1]= dyt[2]= 0.0f;
-				retval= multitex_thread((Tex *)node->id, vec, dxt, dyt, shi->osatex, &texres, thread, which_output);
+				retval= multitex_nodes((Tex *)node->id, vec, dxt, dyt, shi->osatex, &texres, thread, which_output, NULL, NULL);
 			}
 			else
-				retval= multitex_thread((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output);
+				retval= multitex_nodes((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output, NULL, NULL);
 		}
 		else {
 			VECCOPY(vec, shi->lo);
-			retval= multitex_thread((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output);
+			retval= multitex_nodes((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output, NULL, NULL);
 		}
 		
 		/* stupid exception */

Modified: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_at.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_at.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_at.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -41,10 +41,10 @@
 static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
 {
 	TexParams np = *p;
-	float new_coord[3];
-	np.coord = new_coord;
+	float new_co[3];
+	np.co = new_co;
 	
-	tex_input_vec(new_coord, in[1], p, thread);
+	tex_input_vec(new_co, in[1], p, thread);
 	tex_input_rgba(out, in[0], &np, thread);
 }
 

Modified: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -59,10 +59,10 @@
 
 static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
 {
-	float *coord = p->coord;
+	float *co = p->co;
 	
-	float x = coord[0];
-	float y = coord[1];
+	float x = co[0];
+	float y = co[1];
 	
 	int bricknum, rownum;
 	float offset = 0;

Modified: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_checker.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_checker.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -42,9 +42,9 @@
 
 static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
 {
-	float x  = p->coord[0];
-	float y  = p->coord[1];
-	float z  = p->coord[2];
+	float x  = p->co[0];
+	float y  = p->co[1];
+	float z  = p->co[2];
 	float sz = tex_input_value(in[2], p, thread);
 	
 	/* 0.00001  because of unit sized stuff */

Modified: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_coord.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_coord.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_coord.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -35,9 +35,9 @@
 
 static void vectorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
 {
-	out[0] = p->coord[0];
-	out[1] = p->coord[1];
-	out[2] = p->coord[2];
+	out[0] = p->co[0];
+	out[1] = p->co[1];
+	out[2] = p->co[2];
 }
 
 static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)

Modified: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_distance.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_distance.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -43,12 +43,12 @@
 
 static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
 {
-	float coord1[3], coord2[3];
+	float co1[3], co2[3];
 
-	tex_input_vec(coord1, in[0], p, thread);
-	tex_input_vec(coord2, in[1], p, thread);
+	tex_input_vec(co1, in[0], p, thread);
+	tex_input_vec(co2, in[1], p, thread);
 
-	*out = len_v3v3(coord2, coord1);
+	*out = len_v3v3(co2, co1);
 }
 
 static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)

Modified: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_image.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_image.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_image.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -36,8 +36,8 @@
 
 static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
 {
-	float x = p->coord[0];
-	float y = p->coord[1];
+	float x = p->co[0];
+	float y = p->co[1];
 	Image *ima= (Image *)node->id;
 	ImageUser *iuser= (ImageUser *)node->storage;
 	
@@ -69,7 +69,7 @@
 			QUATCOPY( out, result );
 		}
 	}
-};
+}
 
 static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {

Modified: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -35,48 +35,6 @@
 	{ -1, 0, ""	}
 };
 
-static void osa(
-	void (*input_fn)(float *, bNodeStack *, TexParams *, short),
-	float *out,
-	bNodeStack *in,
-	TexParams *p,
-	short thread
-){
-	if(!p->dxt) {
-		input_fn(out, in, p, thread);
-	} else {
-		float sample[4] = {0};
-		float coord[3];
-		TexParams sp = *p;
-		int i;
-	
-		sp.coord = coord;
-		sp.dxt = sp.dyt = 0;
-		
-		QUATCOPY(out, sample);
-		
-		for(i=0; i<5; i++) {
-			VECCOPY(coord, p->coord);
-			
-			if(i < 4)
-			{
-				if(i % 2) VECADD(coord, coord, p->dxt);
-				if(i > 1) VECADD(coord, coord, p->dyt);
-			}
-			else
-			{
-				VECADDFAC(coord, coord, p->dxt, 0.5);
-				VECADDFAC(coord, coord, p->dyt, 0.5);
-			}
-			
-			input_fn(sample, in, &sp, thread);
-			
-			QUATADDFAC(out, out, sample, 0.2);
-		}
-	}
-}
-	
-
 /* applies to render pipeline */
 static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
@@ -91,7 +49,7 @@
 			tex_input_rgba(&target->tr, in[1], &params, cdata->thread);
 		else
 			tex_input_rgba(&target->tr, in[0], &params, cdata->thread);
-		tex_do_preview(node, params.coord, &target->tr);
+		tex_do_preview(node, params.co, &target->tr);
 	}
 	else {
 		/* 0 means don't care, so just use first */
@@ -99,14 +57,14 @@
 			TexParams params;
 			params_from_cdata(&params, cdata);
 			
-			osa(tex_input_rgba, &target->tr, in[0], &params, cdata->thread);
+			tex_input_rgba(&target->tr, in[0], &params, cdata->thread);
 		
 			target->tin = (target->tr + target->tg + target->tb) / 3.0f;
 			target->talpha = 1.0f;
 		
 			if(target->nor) {
 				if(in[1]->hasinput)
-					osa(tex_input_vec, target->nor, in[1], &params, cdata->thread);
+					tex_input_vec(target->nor, in[1], &params, cdata->thread);
 				else
 					target->nor = 0;
 			}
@@ -210,3 +168,4 @@
 	/* copystoragefunc */  copy,  
 	/* id              */  NULL
 };
+

Modified: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_proc.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_proc.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -62,7 +62,8 @@
 	else
 		texres.nor = NULL;
 	
-	textype = multitex_thread(tex, p->coord, p->dxt, p->dyt, 0, &texres, thread, 0);
+	textype = multitex_nodes(tex, p->co, p->dxt, p->dyt, p->osatex,
+		&texres, thread, 0, p->shi, p->mtex);
 	
 	if(is_normal)
 		return;

Modified: trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c	2010-02-16 15:01:34 UTC (rev 26957)
+++ trunk/blender/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c	2010-02-16 15:45:19 UTC (rev 26958)
@@ -42,54 +42,44 @@
 	{ -1, 0, "" } 
 };
 
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void rotate(float new_co[3], float a, float ax[3], float co[3])
 {
-	float new_coord[3];
-	float *coord = p->coord;
-	
-	float ax[4];
 	float para[3];
 	float perp[3];
 	float cp[3];
 	
-	float magsq, ndx;
-	
-	float a = tex_input_value(in[1], p, thread);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list