src/glcompiler.cpp

changeset 1306
be85306198a2
parent 1305
31627acdd4b5
child 1313
4baed9f54de3
--- a/src/glcompiler.cpp	Mon Mar 19 12:24:59 2018 +0200
+++ b/src/glcompiler.cpp	Mon Mar 19 12:44:27 2018 +0200
@@ -24,6 +24,7 @@
 #include "guiutilities.h"
 #include "documentmanager.h"
 #include "grid.h"
+#include "algorithms/invert.h"
 
 void checkGLError(HierarchyElement* element, QString file, int line)
 {
@@ -375,8 +376,10 @@
 	case LDObjectType::SubfileReference:
 		{
 			LDSubfileReference* subfileReference = static_cast<LDSubfileReference*>(object);
-			// TODO: move winding to Model and use it here
-			auto data = subfileReference->inlinePolygons(m_documents, CounterClockwise);
+			auto data = subfileReference->inlinePolygons(
+				m_documents,
+				m_renderer->model()->winding()
+			);
 
 			for (LDPolygon& poly : data)
 				compilePolygon (poly, index, info);
@@ -407,6 +410,9 @@
 	const QModelIndex& polygonOwnerIndex,
 	ObjectVboData& objectInfo
 ) {
+	if (m_renderer->model()->winding() == Clockwise)
+		::invertPolygon(poly);
+
 	VboClass surface;
 	int vertexCount;
 
@@ -486,6 +492,12 @@
 	return m_vboSizes[vbonum];
 }
 
+void GLCompiler::fullUpdate()
+{
+	m_objectInfo.clear();
+	recompile();
+}
+
 /*
  * Recompiles the entire model.
  */

mercurial