[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18471] branches/sim_physics/source/ blender: * Little feature, blend texture can have extrapolation modes ( like repeat).

Matt Ebb matt at mke3.net
Tue Jan 13 03:39:56 CET 2009


Revision: 18471
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18471
Author:   broken
Date:     2009-01-13 03:39:46 +0100 (Tue, 13 Jan 2009)

Log Message:
-----------
* Little feature, blend texture can have extrapolation modes (like repeat).

This should probably go in trunk, but I'll stay away for now with all the 2.5 work on.

Modified Paths:
--------------
    branches/sim_physics/source/blender/blenkernel/BKE_blender.h
    branches/sim_physics/source/blender/blenloader/intern/readfile.c
    branches/sim_physics/source/blender/render/intern/source/texture.c
    branches/sim_physics/source/blender/src/buttons_shading.c

Modified: branches/sim_physics/source/blender/blenkernel/BKE_blender.h
===================================================================
--- branches/sim_physics/source/blender/blenkernel/BKE_blender.h	2009-01-13 02:09:58 UTC (rev 18470)
+++ branches/sim_physics/source/blender/blenkernel/BKE_blender.h	2009-01-13 02:39:46 UTC (rev 18471)
@@ -41,7 +41,7 @@
 struct MemFile;
 
 #define BLENDER_VERSION			248
-#define BLENDER_SUBVERSION		1
+#define BLENDER_SUBVERSION		3
 
 #define BLENDER_MINVERSION		245
 #define BLENDER_MINSUBVERSION	15

Modified: branches/sim_physics/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/sim_physics/source/blender/blenloader/intern/readfile.c	2009-01-13 02:09:58 UTC (rev 18470)
+++ branches/sim_physics/source/blender/blenloader/intern/readfile.c	2009-01-13 02:39:46 UTC (rev 18471)
@@ -7975,7 +7975,6 @@
 				tex->vd->int_multiplier = 1.0;
 			}
 		}
-		
 	}
 	
 	/* set the curve radius interpolation to 2.47 default - easy */
@@ -8074,6 +8073,16 @@
 		}
 	}
 	
+	if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 3)) {
+		Tex *tex;
+		
+		/* blend texture extrapolation */
+		for(tex=main->tex.first; tex; tex= tex->id.next) {
+			if (tex->type == TEX_BLEND)
+				tex->extend = TEX_EXTEND;
+		}
+	}
+	
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
 	/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
 

Modified: branches/sim_physics/source/blender/render/intern/source/texture.c
===================================================================
--- branches/sim_physics/source/blender/render/intern/source/texture.c	2009-01-13 02:09:58 UTC (rev 18470)
+++ branches/sim_physics/source/blender/render/intern/source/texture.c	2009-01-13 02:39:46 UTC (rev 18471)
@@ -197,6 +197,23 @@
 		y= texvec[1];
 	}
 
+	if (tex->extend == TEX_REPEAT) {
+		if (x < -1.0 || x > 1.0) {
+			const float x2 = (x + 1.0)* 0.5;			/* to 0.0, 1.0 */
+			x = (x2 - floor(x2) - 0.5) * 2.0;	/* to -1.0, 1.0 */
+		}
+		if (y < -1.0 || y > 1.0) {
+			const float y2 = (y + 1.0)* 0.5;			/* to 0.0, 1.0 */
+			y = (y2 - floor(y2) - 0.5) * 2.0;	/* to -1.0, 1.0 */
+		}
+	} else if (tex->extend == TEX_CLIP) {
+		if (x < -1.0 || x > 1.0 || y < -1.0 || y > 1.0) {
+			texres->tin = 0.f;
+			BRICONT;
+			return TEX_INT;
+		}
+	}
+
 	if(tex->stype==TEX_LIN) {	/* lin */
 		texres->tin= (1.0+x)/2.0;
 	}

Modified: branches/sim_physics/source/blender/src/buttons_shading.c
===================================================================
--- branches/sim_physics/source/blender/src/buttons_shading.c	2009-01-13 02:09:58 UTC (rev 18470)
+++ branches/sim_physics/source/blender/src/buttons_shading.c	2009-01-13 02:39:46 UTC (rev 18471)
@@ -644,7 +644,13 @@
 	uiDefButS(block, ROW, B_TEXPRV, "Sphere",	85, 160, 75, 19, &tex->stype, 2.0, (float)TEX_SPHERE, 0, 0, "Use progression with the shape of a sphere");
 	uiDefButS(block, ROW, B_TEXPRV, "Halo",		160, 160, 75, 19, &tex->stype, 2.0, (float)TEX_HALO, 0, 0, "Use a quadratic progression with the shape of a sphere");
 	uiDefButS(block, ROW, B_TEXPRV, "Radial",	235, 160, 75, 19, &tex->stype, 2.0, (float)TEX_RAD, 0, 0, "Use a polar progression");
+	uiBlockEndAlign(block);
 	
+	uiBlockBeginAlign(block);
+	uiDefButS(block, ROW, B_TEXREDR_PRV, "Extend",			10,120,63,19, &tex->extend, 4.0, 1.0, 0, 0, "Extends the color of the edge pixels");
+	uiDefButS(block, ROW, B_TEXREDR_PRV, "Clip",			73,120,48,19, &tex->extend, 4.0, 2.0, 0, 0, "Sets alpha 0.0 outside Image edges");
+	uiDefButS(block, ROW, B_TEXREDR_PRV, "Repeat",			121,120,63,19, &tex->extend, 4.0, 3.0, 0, 0, "Causes Image to repeat horizontally and vertically");	
+	uiBlockEndAlign(block);
 }
 
 /* newnoise: noisebasis menu string */





More information about the Bf-blender-cvs mailing list