GLRenderer no longer exposes the model pointer.

Thu, 09 Feb 2017 00:45:44 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 09 Feb 2017 00:45:44 +0200
changeset 1099
14276e435640
parent 1098
0b837bed121d
child 1100
9b2797729c82

GLRenderer no longer exposes the model pointer.

src/editmodes/abstractEditMode.cpp file | annotate | diff | comparison | revisions
src/glRenderer.cpp file | annotate | diff | comparison | revisions
src/glRenderer.h file | annotate | diff | comparison | revisions
--- a/src/editmodes/abstractEditMode.cpp	Thu Feb 09 00:43:30 2017 +0200
+++ b/src/editmodes/abstractEditMode.cpp	Thu Feb 09 00:45:44 2017 +0200
@@ -197,7 +197,7 @@
 
 	if (countof(model) > 0)
 	{
-		renderer()->model()->merge(model, position);
+		currentDocument()->merge(model, position);
 		m_window->refresh();
 		m_window->endAction();
 	}
--- a/src/glRenderer.cpp	Thu Feb 09 00:43:30 2017 +0200
+++ b/src/glRenderer.cpp	Thu Feb 09 00:45:44 2017 +0200
@@ -177,11 +177,6 @@
 	m_isDrawOnly = value;
 }
 
-Model* GLRenderer::model() const
-{
-	return m_model;
-}
-
 GLCompiler* GLRenderer::compiler() const
 {
 	return m_compiler;
@@ -1239,10 +1234,6 @@
 void GLRenderer::zoomToFit()
 {
 	zoom() = 30.0f;
-
-	if (model() == nullptr or m_width == -1 or m_height == -1)
-		return;
-
 	bool lastfilled = false;
 	bool firstrun = true;
 	enum { black = 0xFF000000 };
@@ -1343,7 +1334,7 @@
 //
 LDOverlay* GLRenderer::findOverlayObject (Camera cam)
 {
-	for (LDObject* obj : model()->objects())
+	for (LDObject* obj : m_model->objects())
 	{
 		LDOverlay* overlay = dynamic_cast<LDOverlay*> (obj);
 
@@ -1403,11 +1394,11 @@
 			LDObject* nextobj = overlayObject->next();
 
 			if (nextobj and nextobj->type() == OBJ_Empty)
-				model()->remove(nextobj);
+				m_model->remove(nextobj);
 
 			// If the overlay object was there and the overlay itself is
 			// not, remove the object.
-			model()->remove(overlayObject);
+			m_model->remove(overlayObject);
 			overlayObject = nullptr;
 		}
 		else if (meta.image and overlayObject == nullptr)
@@ -1425,9 +1416,9 @@
 			int lastOverlayPosition = -1;
 			bool found = false;
 
-			for (i = 0; i < model()->size(); ++i)
+			for (i = 0; i < m_model->size(); ++i)
 			{
-				LDObject* object = model()->getObject (i);
+				LDObject* object = m_model->getObject (i);
 
 				if (object->isScemantic())
 				{
@@ -1441,14 +1432,14 @@
 
 			if (lastOverlayPosition != -1)
 			{
-				overlayObject = model()->emplaceAt<LDOverlay>(lastOverlayPosition + 1);
+				overlayObject = m_model->emplaceAt<LDOverlay>(lastOverlayPosition + 1);
 			}
 			else
 			{
-				overlayObject = model()->emplaceAt<LDOverlay>(i);
+				overlayObject = m_model->emplaceAt<LDOverlay>(i);
 
 				if (found)
-					model()->emplaceAt<LDEmpty>(i + 1);
+					m_model->emplaceAt<LDEmpty>(i + 1);
 			}
 		}
 
--- a/src/glRenderer.h	Thu Feb 09 00:43:30 2017 +0200
+++ b/src/glRenderer.h	Thu Feb 09 00:45:44 2017 +0200
@@ -104,7 +104,6 @@
 	QString currentCameraName() const;
 	EditModeType currentEditModeType() const;
 	int depthNegateFactor() const;
-	Model* model() const;
 	void drawPoint(QPainter& painter, QPointF pos, QColor color = QColor (64, 192, 0)) const;
 	void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d);
 	void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d, QPointF pos);

mercurial