src/glCompiler.h

changeset 1231
ce0c9f2e6b9c
parent 1222
34def2630300
child 1232
7eb8b59577d0
--- a/src/glCompiler.h	Thu Jan 11 11:41:40 2018 +0200
+++ b/src/glCompiler.h	Thu Jan 11 15:09:44 2018 +0200
@@ -17,33 +17,22 @@
  */
 
 #pragma once
+#include <QOpenGLFunctions>
 #include "main.h"
-#include "glRenderer.h"
 #include "glShared.h"
-#include <QMap>
-#include <QSet>
 
-// =============================================================================
-//
-class GLCompiler : public HierarchyElement, protected QOpenGLFunctions
+class GLCompiler : protected QOpenGLFunctions
 {
 public:
-	struct ObjectVBOInfo
-	{
-		QVector<GLfloat>	data[NumVbos];
-		bool				isChanged;
-	};
-
-	GLCompiler(GLRenderer* renderer);
+	GLCompiler(LDDocument* document, class GLRenderer* renderer);
 	~GLCompiler();
-	void compileDocument(LDDocument* doc);
+	void compileDocument(LDDocument* document);
 	void dropObjectInfo(LDObject* obj);
 	QColor getColorForPolygon(LDPolygon& poly, LDObject* topobj, ComplementVboType complement) const;
 	QColor indexColorForID(int id) const;
 	void initialize();
 	void needMerge();
 	void prepareVBO(int vbonum);
-	void setRenderer(GLRenderer* compiler);
 	void stageForCompilation(LDObject* obj);
 	void unstage(LDObject* obj);
 	GLuint vbo(int vbonum) const;
@@ -52,16 +41,23 @@
 	static int vboNumber(SurfaceVboType surface, ComplementVboType complement);
 
 private:
+	struct ObjectVBOInfo
+	{
+		QVector<GLfloat> data[NumVbos];
+		bool isChanged = false;
+	};
+
 	void compileStaged();
 	void compileObject(LDObject* obj);
 	void compilePolygon(LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo);
 
-	QMap<LDObject*, ObjectVBOInfo>	m_objectInfo;
-	QSet<LDObject*> m_staged; // Objects that need to be compiled
-	GLuint m_vbo[NumVbos];
-	bool m_vboChanged[NumVbos];
-	int m_vboSizes[NumVbos];
-	GLRenderer* m_renderer;
+	QMap<LDObject*, ObjectVBOInfo> objectInfo;
+	QSet<LDObject*> stagedObjects; // Objects that need to be compiled
+	LDDocument* const document;
+	GLuint vboIndices[NumVbos];
+	bool vboChanged[NumVbos] = {true};
+	int vboSizes[NumVbos] = {0};
+	class GLRenderer* renderer;
 };
 
 #define CHECK_GL_ERROR() { CheckGLErrorImpl(__FILE__, __LINE__); }

mercurial