- fixed zoom value not being initialized properly + some other minor things

Mon, 10 Mar 2014 14:29:12 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 10 Mar 2014 14:29:12 +0200
changeset 699
aca63a3cce36
parent 698
16e6d7d87982
child 700
d2c6592178f9

- fixed zoom value not being initialized properly + some other minor things

src/GLCompiler.cc file | annotate | diff | comparison | revisions
src/GLRenderer.cc file | annotate | diff | comparison | revisions
src/GLRenderer.h file | annotate | diff | comparison | revisions
--- a/src/GLCompiler.cc	Mon Mar 10 14:12:28 2014 +0200
+++ b/src/GLCompiler.cc	Mon Mar 10 14:29:12 2014 +0200
@@ -257,12 +257,13 @@
 //
 void GLCompiler::compileObject (LDObject* obj)
 {
-	print ("compiling #%1\n", obj->id());
+	print ("compiling #%1 (%2, %3)\n", obj->id(), obj->typeName(), obj->origin());
 	ObjectVBOInfo info;
 	dropObject (obj);
 	compileSubObject (obj, obj, &info);
 	mObjectInfo[obj] = info;
 	needMerge();
+	print ("#%1 compiled.\n", obj->id());
 }
 
 // =============================================================================
--- a/src/GLRenderer.cc	Mon Mar 10 14:12:28 2014 +0200
+++ b/src/GLRenderer.cc	Mon Mar 10 14:29:12 2014 +0200
@@ -1787,9 +1787,12 @@
 //
 void GLRenderer::zoomToFit()
 {
+	print ("zooming %1 to fit..\n", camera());
+	zoom() = 30.0f;
+
 	if (document() == null || m_width == -1 || m_height == -1)
 	{
-		zoom() = 30.0f;
+		print ("document is invalid!\n");
 		return;
 	}
 
@@ -1831,22 +1834,23 @@
 			if (imgdata[i] != white || imgdata[((h - 1) * w) + i] != white)
 			{
 				filled = true;
-				goto endOfLoop;
+				break;
 			}
 		}
 
 		// Left and right edges
-		for (int i = 0; i < h; ++i)
+		if (filled == false)
 		{
-			if (imgdata[i * w] != white || imgdata[(i * w) + w - 1] != white)
+			for (int i = 0; i < h; ++i)
 			{
-				filled = true;
-				goto endOfLoop;
+				if (imgdata[i * w] != white || imgdata[(i * w) + w - 1] != white)
+				{
+					filled = true;
+					break;
+				}
 			}
 		}
 
-endOfLoop:
-
 		delete[] cap;
 
 		if (firstrun)
@@ -1880,6 +1884,7 @@
 
 	setBackground();
 	setPicking (false);
+	print ("zoom to fit done.\n");
 }
 
 // =============================================================================
--- a/src/GLRenderer.h	Mon Mar 10 14:12:28 2014 +0200
+++ b/src/GLRenderer.h	Mon Mar 10 14:29:12 2014 +0200
@@ -79,12 +79,22 @@
 
 	LDGLData()
 	{
-		for (int i = 0; i < 6; ++i)
+		for (int i = 0; i < 7; ++i)
 		{
-			overlays[i].img = null;
-			depthValues[i] = 0.0f;
+			if (i < 6)
+			{
+				overlays[i].img = null;
+				depthValues[i] = 0.0f;
+			}
+
+			zoom[i] = 30.0;
+			panX[i] = 0.0;
+			panY[i] = 0.0;
 		}
 
+		rotX = 0;
+		rotY = 0;
+		rotZ = 0;
 		init = false;
 	}
 };

mercurial