[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43302] trunk/blender/source/blender/ render/intern/source/convertblender.c: Fix #29836: stress not working as input for displacement texture.

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Jan 11 17:21:20 CET 2012


Revision: 43302
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43302
Author:   blendix
Date:     2012-01-11 16:21:17 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
Fix #29836: stress not working as input for displacement texture. Previously it
would be computed after displacement, but I don't think this made much sense.

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/convertblender.c

Modified: trunk/blender/source/blender/render/intern/source/convertblender.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/convertblender.c	2012-01-11 15:18:25 UTC (rev 43301)
+++ trunk/blender/source/blender/render/intern/source/convertblender.c	2012-01-11 16:21:17 UTC (rev 43302)
@@ -2283,7 +2283,18 @@
 	if(texco & TEXCO_REFL) {
 		/* not (yet?) */
 	}
-	
+	if(texco & TEXCO_STRESS) {
+		float *s= RE_vertren_get_stress(obr, vr, 0);
+
+		if(s) {
+			shi->stress= *s;
+			if(shi->stress<1.0f) shi->stress-= 1.0f;
+			else shi->stress= (shi->stress-1.0f)/shi->stress;
+		}
+		else
+			shi->stress= 0.0f;
+	}
+
 	shi->displace[0]= shi->displace[1]= shi->displace[2]= 0.0;
 	
 	do_material_tex(shi, re);
@@ -3536,6 +3547,9 @@
 	}
 	
 	if(!timeoffset) {
+		if(need_stress)
+			calc_edge_stress(re, obr, me);
+
 		if (test_for_displace(re, ob ) ) {
 			recalc_normals= 1;
 			calc_vertexnormals(re, obr, 0, 0);
@@ -3552,9 +3566,6 @@
 
 		if(recalc_normals!=0 || need_tangent!=0)
 			calc_vertexnormals(re, obr, need_tangent, need_nmap_tangent);
-		
-		if(need_stress)
-			calc_edge_stress(re, obr, me);
 	}
 
 	dm->release(dm);



More information about the Bf-blender-cvs mailing list