From 05c86053307f2cc4fdc98f10e6bb5cde29768ad7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20Ulman?= <ulman@mpi-cbg.de>
Date: Mon, 31 Oct 2016 13:43:47 +0100
Subject: [PATCH] Texture tuned very slightly. Let's add FF.

---
 cmath3d/TriangleMesh.cpp | 22 ++++++++++++----------
 src/main.cpp             |  8 +++-----
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/cmath3d/TriangleMesh.cpp b/cmath3d/TriangleMesh.cpp
index 7727dee..050dfe0 100644
--- a/cmath3d/TriangleMesh.cpp
+++ b/cmath3d/TriangleMesh.cpp
@@ -18,7 +18,7 @@
 #undef max
 
 //some debug-code enabling triggers
-#define SAVE_INTERMEDIATE_IMAGES
+//#define SAVE_INTERMEDIATE_IMAGES
 
 //'multiple' should be ideally 10^desired_decimal_accuracy
 int inline RoundTo(const float val, const float multiple=1000.f)
@@ -881,13 +881,13 @@ void ActiveMesh::RenderOneTimeTexture(const i3d::Image3d<i3d::GRAY16>& mask,
 	perlinInner.CopyMetaData(mask);
 	DoPerlin3D(perlinInner,5.0,0.8*1.5,0.7*1.5,6);
 #ifdef SAVE_INTERMEDIATE_IMAGES
-	perlinInner.SaveImage("2_PerlinAlone_Inner.ics");
+	//perlinInner.SaveImage("2_PerlinAlone_Inner.ics");
 #endif
 
 	perlinOutside.CopyMetaData(mask);
 	DoPerlin3D(perlinOutside,2.,0.8*1.5,0.7*1.5,6);
 #ifdef SAVE_INTERMEDIATE_IMAGES
-	perlinOutside.SaveImage("2_PerlinAlone_Outside.ics");
+	//perlinOutside.SaveImage("2_PerlinAlone_Outside.ics");
 #endif
 
 	i3d::Image3d<i3d::GRAY16> erroded;
@@ -906,7 +906,7 @@ void ActiveMesh::RenderOneTimeTexture(const i3d::Image3d<i3d::GRAY16>& mask,
 		{
 			//close to the surface?
 			if (*p < 0.3f || *er == 0) *p=2000.f + 5000.f*(*pO); //corona
-			else                       *p=500.f  + 800.f*(*pI);  //inside
+			else                       *p=500.f  + 600.f*(*pI);  //inside
 			if (*er == 0) *p=2000.f; //std::max(*p,2000.f);                //corona
 
 			if (*p < 0.f) *p=0.f;
@@ -986,6 +986,8 @@ void ActiveMesh::CenterMesh(const Vector3F& newCentre)
 	y/=double(Pos.size());
 	z/=double(Pos.size());
 
+	//std::cout << "mesh centre is: " << x << "," << y << "," << z << "\n";
+
 	x-=newCentre.x;
 	y-=newCentre.y;
 	z-=newCentre.z;
@@ -1252,13 +1254,13 @@ void ActiveMesh::InitDots(const i3d::Image3d<i3d::GRAY16>& mask)
 	perlinInner.CopyMetaData(mask);
 	DoPerlin3D(perlinInner,5.0,0.8*1.5,0.7*1.5,6);
 #ifdef SAVE_INTERMEDIATE_IMAGES
-	perlinInner.SaveImage("2_PerlinAlone_Inner.ics");
+	//perlinInner.SaveImage("2_PerlinAlone_Inner.ics");
 #endif
 
 	perlinOutside.CopyMetaData(mask);
 	DoPerlin3D(perlinOutside,2.,0.8*1.5,0.7*1.5,6);
 #ifdef SAVE_INTERMEDIATE_IMAGES
-	perlinOutside.SaveImage("2_PerlinAlone_Outside.ics");
+	//perlinOutside.SaveImage("2_PerlinAlone_Outside.ics");
 #endif
 
 	i3d::Image3d<i3d::GRAY16> erroded;
@@ -1277,7 +1279,7 @@ void ActiveMesh::InitDots(const i3d::Image3d<i3d::GRAY16>& mask)
 		{
 			//close to the surface?
 			if (*p < 0.3f || *er == 0) *p=2000.f + 5000.f*(*pO); //corona
-			else                       *p=500.f  + 800.f*(*pI);  //inside
+			else                       *p=500.f  + 600.f*(*pI);  //inside
 			if (*er == 0) *p=2000.f; //std::max(*p,2000.f);                //corona
 
 			if (*p < 0.f) *p=0.f;
@@ -1324,10 +1326,10 @@ void ActiveMesh::InitDots(const i3d::Image3d<i3d::GRAY16>& mask)
 		}
 		*/
 	}
-#ifdef SAVE_INTERMEDIATE_IMAGES
+//#ifdef SAVE_INTERMEDIATE_IMAGES
 	std::cout << "intiated " << dots.size() << " fl. molecules (capacity is for "
 	          << dots.capacity() << ")\n";
-#endif
+//#endif
 }
 
 
@@ -1379,7 +1381,7 @@ void ActiveMesh::RenderDots(const i3d::Image3d<i3d::GRAY16>& mask,
 		const int z=(int)roundf( (dots[i].z-zOff) *zRes);
 
 		if ((x > 0) && (y > 0) && (z > 0)
-		   && (x < maxX) && (y < maxY) && (z < maxZ)) T[z*Slice +y*xLine +x]+=(i3d::GRAY16)50;
+		   && (x < maxX) && (y < maxY) && (z < maxZ)) T[z*Slice +y*xLine +x]+=i3d::GRAY16(50);
 	}
 
 
diff --git a/src/main.cpp b/src/main.cpp
index d019b8a..ba79759 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -34,8 +34,8 @@ int main(void)
 		std::cout << "normals   #: " << mesh.norm.size() << "\n";
 
 		RenderMesh(i);
-		//RenderMesh(i+1);
-		//RenderMesh(i+2);
+		RenderMesh(i+1);
+		RenderMesh(i+2);
 	}
 
 	/*
@@ -156,8 +156,7 @@ int RenderMesh(int fileNo)
 
 	//renders and resamples the texture
 	i3d::Image3d<i3d::GRAY16> texture;
-	mesh.RenderOneTimeTexture(mask,texture);
-	/*
+	//mesh.RenderOneTimeTexture(mask,texture);
 	if (mesh.DotsFirstRun())
 	{
 		std::cout << "rendering texture first run\n";
@@ -170,7 +169,6 @@ int RenderMesh(int fileNo)
 	}
 	std::cout << "rendering texture #" << fileNo << "\n";
 	mesh.RenderDots(mask,texture);
-	*/
 
 	std::cout << "exporting texture #" << fileNo << "\n";
 	char fileName[1024];
-- 
GitLab