fixed: overlays coudln't be defined for other cameras than the one used currently

Thu, 04 Jul 2013 21:09:19 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Thu, 04 Jul 2013 21:09:19 +0300
changeset 336
9dd47cc12ab8
parent 335
30c11cff511d
child 337
4e05207c76c9

fixed: overlays coudln't be defined for other cameras than the one used currently

changelog.txt file | annotate | diff | comparison | revisions
src/gldraw.cpp file | annotate | diff | comparison | revisions
src/gldraw.h file | annotate | diff | comparison | revisions
--- a/changelog.txt	Thu Jul 04 21:01:52 2013 +0300
+++ b/changelog.txt	Thu Jul 04 21:09:19 2013 +0300
@@ -22,6 +22,7 @@
 	the no-response policy could be a bad thing.
 - Color selector is now twice as wide for easier color selection.
 - Fixed: Recent files should behave coherently now.
+- Fixed: Overlays could only be defined for the current camera, changing the camera in the prompt didn't work.
 - Fixed: text editing did not trigger checks while setting LDraw path, removed the Configure
 	button from the LDraw path config dialog, it's no longer needed.
 - Fixed: Coordinates weren't drawn properly on a bright background (was always drawn in bright colors..).
--- a/src/gldraw.cpp	Thu Jul 04 21:01:52 2013 +0300
+++ b/src/gldraw.cpp	Thu Jul 04 21:09:19 2013 +0300
@@ -1391,8 +1391,11 @@
 }
 
 // =============================================================================
-Axis GLRenderer::cameraAxis (bool y) {
-	const staticCameraMeta* cam = &g_staticCameras[m_camera];
+Axis GLRenderer::cameraAxis (bool y, GL::Camera camid) {
+	if( camid == (GL::Camera) -1 )
+		camid = m_camera;
+	
+	const staticCameraMeta* cam = &g_staticCameras[camid];
 	return (y) ? cam->axisY : cam->axisX;
 }
 
@@ -1423,11 +1426,11 @@
 	elif( info.lh == 0 )
 		info.lh = ( info.lw * img->height() ) / img->width();
 	
-	const Axis x2d = cameraAxis( false ),
-		y2d = cameraAxis( true );
+	const Axis x2d = cameraAxis( false, cam ),
+		y2d = cameraAxis( true, cam );
 	
-	double negXFac = g_staticCameras[m_camera].negX ? -1 : 1,
-		negYFac = g_staticCameras[m_camera].negY ? -1 : 1;
+	double negXFac = g_staticCameras[cam].negX ? -1 : 1,
+		negYFac = g_staticCameras[cam].negY ? -1 : 1;
 	
 	info.v0 = info.v1 = g_origin;
 	info.v0[x2d] = -( info.ox * info.lw * negXFac ) / img->width();
--- a/src/gldraw.h	Thu Jul 04 21:01:52 2013 +0300
+++ b/src/gldraw.h	Thu Jul 04 21:09:19 2013 +0300
@@ -71,7 +71,7 @@
 	~GLRenderer ();
 	
 	Camera         camera              () const { return m_camera; }
-	Axis           cameraAxis          (bool y);
+	Axis           cameraAxis          ( bool y, Camera camid = (Camera) -1 );
 	const char*    cameraName          () const;
 	void           clearOverlay        ();
 	void           compileObject       (LDObject* obj);

mercurial