src/glRenderer.cc

changeset 762
d259256e1394
parent 760
e4e585f464b3
child 763
b682c73492f0
--- a/src/glRenderer.cc	Thu May 01 14:26:10 2014 +0300
+++ b/src/glRenderer.cc	Sat May 03 00:36:50 2014 +0300
@@ -68,7 +68,7 @@
 CFGENTRY (Float,	mainColorAlpha,				1.0)
 CFGENTRY (Int,		lineThickness,				2)
 CFGENTRY (Bool,		bfcRedGreenView,			false)
-CFGENTRY (Int,		camera,						GLRenderer::EFreeCamera)
+CFGENTRY (Int,		camera,						EFreeCamera)
 CFGENTRY (Bool,		blackEdges,					false)
 CFGENTRY (Bool,		drawAxes,					false)
 CFGENTRY (Bool,		drawWireframe,				false)
@@ -91,17 +91,6 @@
 	QT_TRANSLATE_NOOP ("GLRenderer",  "Free")
 };
 
-const GL::EFixedCamera g_Cameras[7] =
-{
-	GL::ETopCamera,
-	GL::EFrontCamera,
-	GL::ELeftCamera,
-	GL::EBottomCamera,
-	GL::EBackCamera,
-	GL::ERightCamera,
-	GL::EFreeCamera
-};
-
 struct LDGLAxis
 {
 	const QColor col;
@@ -124,7 +113,7 @@
 GLRenderer::GLRenderer (QWidget* parent) : QGLWidget (parent)
 {
 	m_isPicking = m_rangepick = false;
-	m_camera = (EFixedCamera) cfg::camera;
+	m_camera = (ECamera) cfg::camera;
 	m_drawToolTip = false;
 	m_editMode = ESelectMode;
 	m_rectdraw = false;
@@ -146,10 +135,9 @@
 	m_thinBorderPen.setWidth (1);
 
 	// Init camera icons
-	for (const GL::EFixedCamera cam : g_Cameras)
+	for (ECamera cam = EFirstCamera; cam < ENumCameras; ++cam)
 	{
 		String iconname = format ("camera-%1", tr (g_CameraNames[cam]).toLower());
-
 		CameraIcon* info = &m_cameraIcons[cam];
 		info->img = new QPixmap (getIcon (iconname));
 		info->cam = cam;
@@ -246,11 +234,11 @@
 //
 void GLRenderer::resetAllAngles()
 {
-	EFixedCamera oldcam = camera();
+	ECamera oldcam = camera();
 
 	for (int i = 0; i < 7; ++i)
 	{
-		setCamera ((EFixedCamera) i);
+		setCamera ((ECamera) i);
 		resetAngles();
 	}
 
@@ -838,7 +826,7 @@
 		for (CameraIcon& info : m_cameraIcons)
 		{
 			// Don't draw the free camera icon when in draw mode
-			if (&info == &m_cameraIcons[GL::EFreeCamera] && editMode() != ESelectMode)
+			if (&info == &m_cameraIcons[EFreeCamera] && editMode() != ESelectMode)
 				continue;
 
 			paint.drawPixmap (info.destRect, *info.img, info.srcRect);
@@ -1215,7 +1203,7 @@
 
 // =============================================================================
 //
-void GLRenderer::setCamera (const GLRenderer::EFixedCamera cam)
+void GLRenderer::setCamera (const ECamera cam)
 {
 	m_camera = cam;
 	cfg::camera = (int) cam;
@@ -1739,9 +1727,9 @@
 
 // =============================================================================
 //
-Axis GLRenderer::getCameraAxis (bool y, GLRenderer::EFixedCamera camid)
+Axis GLRenderer::getCameraAxis (bool y, ECamera camid)
 {
-	if (camid == (GL::EFixedCamera) - 1)
+	if (camid == (ECamera) -1)
 		camid = camera();
 
 	const LDFixedCameraInfo* cam = &g_FixedCameras[camid];
@@ -1750,7 +1738,7 @@
 
 // =============================================================================
 //
-bool GLRenderer::setupOverlay (EFixedCamera cam, String file, int x, int y, int w, int h)
+bool GLRenderer::setupOverlay (ECamera cam, String file, int x, int y, int w, int h)
 {
 	QImage* img = new QImage (QImage (file).convertToFormat (QImage::Format_ARGB32));
 	LDGLOverlay& info = getOverlay (cam);
@@ -1958,11 +1946,11 @@
 //
 void GLRenderer::zoomAllToFit()
 {
-	EFixedCamera oldcam = camera();
+	ECamera oldcam = camera();
 
-	for (int i = 0; i < 7; ++i)
+	for (ECamera cam = EFirstCamera; cam < ENumCameras; ++cam)
 	{
-		setCamera ((EFixedCamera) i);
+		setCamera (cam);
 		zoomToFit();
 	}
 
@@ -2024,7 +2012,7 @@
 
 // =============================================================================
 //
-LDOverlay* GLRenderer::findOverlayObject (EFixedCamera cam)
+LDOverlay* GLRenderer::findOverlayObject (ECamera cam)
 {
 	LDOverlay* ovlobj = null;
 
@@ -2046,7 +2034,7 @@
 //
 void GLRenderer::initOverlaysFromObjects()
 {
-	for (EFixedCamera cam : g_Cameras)
+	for (ECamera cam = EFirstCamera; cam < ENumCameras; ++cam)
 	{
 		if (cam == EFreeCamera)
 			continue;
@@ -2069,7 +2057,7 @@
 //
 void GLRenderer::updateOverlayObjects()
 {
-	for (EFixedCamera cam : g_Cameras)
+	for (ECamera cam = EFirstCamera; cam < ENumCameras; ++cam)
 	{
 		if (cam == EFreeCamera)
 			continue;

mercurial