[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22585] branches/blender2.5/blender/source /blender/nodes/intern: Implemented multisampling for texture nodes.

Robin Allen roblovski at gmail.com
Tue Aug 18 00:17:25 CEST 2009


Revision: 22585
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22585
Author:   kakbarnf
Date:     2009-08-18 00:17:25 +0200 (Tue, 18 Aug 2009)

Log Message:
-----------
Implemented multisampling for texture nodes.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c
    branches/blender2.5/blender/source/blender/nodes/intern/TEX_util.c

Modified: branches/blender2.5/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c
===================================================================
--- branches/blender2.5/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c	2009-08-17 22:09:36 UTC (rev 22584)
+++ branches/blender2.5/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c	2009-08-17 22:17:25 UTC (rev 22585)
@@ -35,6 +35,48 @@
 	{ -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)
 {
@@ -52,14 +94,14 @@
 			TexParams params;
 			params_from_cdata(&params, cdata);
 			
-			tex_input_rgba(&target->tr, in[0], &params, cdata->thread);
+			osa(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)
-					tex_input_vec(target->nor, in[1], &params, cdata->thread);
+					osa(tex_input_vec, target->nor, in[1], &params, cdata->thread);
 				else
 					target->nor = 0;
 			}

Modified: branches/blender2.5/blender/source/blender/nodes/intern/TEX_util.c
===================================================================
--- branches/blender2.5/blender/source/blender/nodes/intern/TEX_util.c	2009-08-17 22:09:36 UTC (rev 22584)
+++ branches/blender2.5/blender/source/blender/nodes/intern/TEX_util.c	2009-08-17 22:17:25 UTC (rev 22585)
@@ -149,7 +149,7 @@
 	
 	params.dxt = 0;
 	params.dyt = 0;
-	params.cfra = 0; /* XXX Use current? */
+	params.cfra = cdata->cfra;
 	params.coord = coord;
 	
 	for(x=0; x<preview->xsize; x++)





More information about the Bf-blender-cvs mailing list