ccdemos/textures.cc
branchpyrit
changeset 43 0b8b968b42d1
parent 42 fbdeb3e04543
child 47 320d5d466864
--- a/ccdemos/textures.cc	Sat Dec 29 13:53:33 2007 +0100
+++ b/ccdemos/textures.cc	Sun Dec 30 00:11:47 2007 +0100
@@ -27,7 +27,7 @@
 void texture2D(Float u, Float v, Float &r, Float &g, Float &b)
 {
 	// checkers
-	r = fabs((int)(u*4.4)%2 + (int)(v*4.4)%2 - 1);
+	r = fabs((int)(u*4.2)%2 + (int)(v*4.2)%2 - 1);
 	g=r; b=r;
 }
 
@@ -60,12 +60,18 @@
 		{
 			if (fabs(point.x) > fabs(point.z))
 			{
-				u = point.y;
+				if (point.x < 0)
+					u = -point.y;
+				else
+					u = point.y;
 				v = point.z;
 			}
 			else
 			{
-				u = point.x;
+				if (point.z < 0)
+					u = -point.x;
+				else
+					u = point.x;
 				v = point.y;
 			}
 		}
@@ -73,12 +79,18 @@
 		{
 			if (fabs(point.y) > fabs(point.z))
 			{
-				u = point.x;
+				if (point.y < 0)
+					u = -point.x;
+				else
+					u = point.x;
 				v = point.z;
 			}
 			else
 			{
-				u = point.x;
+				if (point.z < 0)
+					u = -point.x;
+				else
+					u = point.x;
 				v = point.y;
 			}
 		}
@@ -266,6 +278,7 @@
 		Float *fdata = (Float *) malloc(w*h*3*sizeof(Float));
 		rt.setOversample(2);
 		rt.setSubsample(1);
+		rt.ambientocclusion(300, 5.0, 0.5);
 		rt.render(w, h, fdata);
 
 		struct image *img;