src/gl/common.h

changeset 210
232e7634cc8a
parent 206
654661eab7f3
child 215
34c6e7bc4ee1
--- a/src/gl/common.h	Thu Jun 09 11:51:42 2022 +0300
+++ b/src/gl/common.h	Thu Jun 09 13:32:55 2022 +0300
@@ -31,7 +31,6 @@
 
 namespace gl
 {
-	struct Polygon;
 	class ShaderProgram;
 
 	void buildShaders(
@@ -67,121 +66,10 @@
 	}
 };
 
-struct gl::Polygon
-{
-	enum Type : qint8
-	{
-		EdgeLine,
-		Triangle,
-		Quadrilateral,
-		ConditionalEdge
-	} type;
-	glm::vec3 vertices[4];
-	ldraw::Color color;
-	ModelId id;
-
-	/**
-	 * @return amount of vertices used for geometry
-	 */
-	inline unsigned int numPolygonVertices() const
-	{
-		if (type == Type::ConditionalEdge)
-			return 2;
-		else
-			return numVertices();
-	}
-
-	/**
-	 * @return amount of vertices
-	 */
-	inline unsigned int numVertices() const
-	{
-		switch (type)
-		{
-		case Type::EdgeLine:
-			return 2;
-		case Type::Triangle:
-			return 3;
-		case Type::ConditionalEdge:
-		case Type::Quadrilateral:
-			return 4;
-		}
-		return 0;
-	}
-};
-
-Q_DECLARE_METATYPE(gl::Polygon)
 extern QOpenGLFunctions glfunc;
 
 namespace gl
 {
-	constexpr Polygon::Type POLYGON_TYPES[] =
-	{
-		Polygon::Type::EdgeLine,
-		Polygon::Type::Triangle,
-		Polygon::Type::Quadrilateral,
-		Polygon::Type::ConditionalEdge
-	};
-
-	constexpr int NUM_POLYGON_TYPES = countof(POLYGON_TYPES);
-
-	inline Polygon edgeLine(const Colored<LineSegment>& seg, ModelId id)
-	{
-		return Polygon{
-			.type = Polygon::EdgeLine,
-			.vertices = {seg.p1, seg.p2},
-			.color = seg.color,
-			.id = id,
-		};
-	}
-
-	inline Polygon triangle(const Colored<Triangle>& tri, ModelId id)
-	{
-		return Polygon{
-			.type = Polygon::Triangle,
-			.vertices = {tri.p1, tri.p2, tri.p3},
-			.color = tri.color,
-			.id = id,
-		};
-	}
-
-	inline Polygon quadrilateral(const Colored<Quadrilateral>& quad, ModelId id)
-	{
-		return Polygon{
-			.type = Polygon::Quadrilateral,
-			.vertices = {quad.p1, quad.p2, quad.p3, quad.p4},
-			.color = quad.color,
-			.id = id,
-		};
-	}
-
-	inline Polygon conditionalEdge(const Colored<ConditionalEdge>& cedge, ModelId id)
-	{
-		return Polygon{
-			.type = Polygon::ConditionalEdge,
-			.vertices = {cedge.p1, cedge.p2, cedge.c1, cedge.c2},
-			.color = cedge.color,
-			.id = id,
-		};
-	}
-
-	// Vbo names
-	enum class ArrayClass : std::uint8_t
-	{
-		Lines,
-		Triangles,
-		Quads,
-		ConditionalLines
-	};
-
-	constexpr ArrayClass ARRAY_CLASSES[] = {
-		ArrayClass::Lines,
-		ArrayClass::Triangles,
-		ArrayClass::Quads,
-		ArrayClass::ConditionalLines,
-	};
-	constexpr int NUM_ARRAY_CLASSES = countof(ARRAY_CLASSES);
-
 	// Different ways to render the scene
 	enum class RenderStyle
 	{

mercurial