src/gl/compiler.h

changeset 80
764381756899
parent 78
97c3ce5aa498
child 150
b6cbba6e29a1
--- a/src/gl/compiler.h	Wed Mar 11 17:19:38 2020 +0200
+++ b/src/gl/compiler.h	Wed Mar 11 19:05:34 2020 +0200
@@ -34,15 +34,6 @@
 namespace gl
 {
 	class Compiler;
-
-	struct Vertex
-	{
-		glm::vec3 position;
-		glm::vec4 color;
-		glm::vec3 normal;
-		glm::int32 id;
-		glm::int32 selected = 0;
-	};
 }
 
 class gl::Compiler : public QObject, protected QOpenGLExtraFunctions
@@ -52,7 +43,6 @@
 	Compiler(const ldraw::ColorTable& colorTable, QObject* parent);
 	~Compiler();
 	void build(Model* model, DocumentManager* context, const RenderPreferences& preferences);
-	void buildPolygon(Polygon polygon, std::vector<Vertex>* vboData, const gl::RenderPreferences& preferences);
 	std::size_t vertexCount(gl::ArrayClass arrayClass) const;
 	QColor getColorForPolygon(const gl::Polygon& polygon, const RenderPreferences& preferences);
 	glm::vec3 modelCenter() const;
@@ -86,7 +76,16 @@
 		this->setUniform(uniformName, *array);
 	}
 private:
-	std::size_t storedVertexCounts[gl::NUM_ARRAY_CLASSES] = {0_z};
+	struct Vertex
+	{
+		glm::vec3 position;
+		glm::vec4 color;
+		glm::vec3 normal;
+		glm::int32 id;
+		glm::int32 selected = 0;
+	};
+	void buildPolygon(Polygon polygon, std::vector<Vertex>* vboData, const gl::RenderPreferences& preferences);
+	std::size_t storedVertexCounts[gl::NUM_POLYGON_TYPES] = {0};
 	bool initialized = false;
 	BoundingBox boundingBox;
 	const ldraw::ColorTable& colorTable;
@@ -97,8 +96,8 @@
 		QOpenGLShaderProgram* pickSceneProgram = nullptr;
 		QOpenGLBuffer buffer{QOpenGLBuffer::VertexBuffer};
 		QOpenGLVertexArrayObject vertexArray;
-		std::vector<gl::Vertex> cachedData;
-	} glObjects[gl::NUM_ARRAY_CLASSES];
+		std::vector<Vertex> cachedData;
+	} glObjects[gl::NUM_POLYGON_TYPES];
 };
 
 #define CHECK_GL_ERROR() { checkGLError(__FILE__, __LINE__); }

mercurial