From 37d5c8b6e0d77b7bb8de5cc7ba6f3c826dced7c8 Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <joseph@walton-rivers.uk>
Date: Fri, 22 Apr 2022 19:39:41 +0100
Subject: [PATCH] clean up headers and remove unused ones

---
 fggl/gfx/ogl/renderer.cpp         |  2 +-
 include/fggl/data/heightmap.h     |  1 +
 include/fggl/gfx/common.hpp       | 14 +++++---------
 include/fggl/gfx/ogl/backend.hpp  |  4 ++--
 include/fggl/gfx/ogl/common.hpp   |  4 ++--
 include/fggl/gfx/ogl/compat.hpp   |  4 ++--
 include/fggl/gfx/ogl/renderer.hpp |  5 -----
 include/fggl/gfx/renderer.hpp     | 19 -------------------
 include/fggl/gfx/vector.hpp       | 20 --------------------
 include/fggl/gfx/window.hpp       |  1 -
 10 files changed, 13 insertions(+), 61 deletions(-)
 delete mode 100644 include/fggl/gfx/renderer.hpp
 delete mode 100644 include/fggl/gfx/vector.hpp

diff --git a/fggl/gfx/ogl/renderer.cpp b/fggl/gfx/ogl/renderer.cpp
index ff9be3d..2f0de49 100644
--- a/fggl/gfx/ogl/renderer.cpp
+++ b/fggl/gfx/ogl/renderer.cpp
@@ -189,7 +189,7 @@ namespace fggl::gfx {
 	// TODO(webpigeon): this shouldn't be hard-coded
 	constexpr glm::vec3 DEFAULT_LIGHTPOS = glm::vec3(20.0F, 20.0F, 15.0F);
 
-	void MeshRenderer::render(fggl::ecs3::World &ecs, ecs3::entity_t camera, float dt) {
+	void GlMeshRenderer::render(fggl::ecs3::World &ecs, ecs3::entity_t camera, float dt) {
 		if (camera == ecs::NULL_ENTITY) {
 			spdlog::warn("tried to render a scene, but no camera exists!");
 			return;
diff --git a/include/fggl/data/heightmap.h b/include/fggl/data/heightmap.h
index 5043b24..bcf1a57 100644
--- a/include/fggl/data/heightmap.h
+++ b/include/fggl/data/heightmap.h
@@ -6,6 +6,7 @@
 #define FGGL_HEIGHTMAP_H
 
 #include <cstdint>
+#include "fggl/data/model.hpp"
 
 namespace fggl::data {
 
diff --git a/include/fggl/gfx/common.hpp b/include/fggl/gfx/common.hpp
index 302a195..02b8c0e 100644
--- a/include/fggl/gfx/common.hpp
+++ b/include/fggl/gfx/common.hpp
@@ -1,19 +1,15 @@
 #ifndef FGGL_GFX_COMMON_H
 #define FGGL_GFX_COMMON_H
 
+//
+// This file exists to ensure that dependencies are loaded in the correct order.
+// Code should NOT directly include things in this file (glfw, opengl) as the order MUST be correct or things go boom.
+//
+
 // load the correct rendering backend (only opengl for now)
 #include <fggl/gfx/ogl/common.hpp>
 
 // now it's safe to load the windowing system
 #include <GLFW/glfw3.h>
 
-#include <fggl/data/model.hpp>
-#include <string>
-#include <utility>
-
-namespace fggl::gfx {
-
-
-}
-
 #endif
diff --git a/include/fggl/gfx/ogl/backend.hpp b/include/fggl/gfx/ogl/backend.hpp
index 8250f5f..7b0225f 100644
--- a/include/fggl/gfx/ogl/backend.hpp
+++ b/include/fggl/gfx/ogl/backend.hpp
@@ -1,5 +1,5 @@
-#ifndef FGGL_GFX_OGL_BACKEND_H
-#define FGGL_GFX_OGL_BACKEND_H
+#ifndef FGGL_GFX_OGL_BACKEND_HPP
+#define FGGL_GFX_OGL_BACKEND_HPP
 
 #include <fggl/gfx/ogl/common.hpp>
 #include <fggl/gfx/window.hpp>
diff --git a/include/fggl/gfx/ogl/common.hpp b/include/fggl/gfx/ogl/common.hpp
index 855ac7d..aa98486 100644
--- a/include/fggl/gfx/ogl/common.hpp
+++ b/include/fggl/gfx/ogl/common.hpp
@@ -1,5 +1,5 @@
-#ifndef FGGL_GFX_OGL_COMMON_H
-#define FGGL_GFX_OGL_COMMON_H
+#ifndef FGGL_GFX_OGL_COMMON_HPP
+#define FGGL_GFX_OGL_COMMON_HPP
 
 /**
  * Ensure Graphics libraries are in the right order.
diff --git a/include/fggl/gfx/ogl/compat.hpp b/include/fggl/gfx/ogl/compat.hpp
index 2b51ecd..d00abfc 100644
--- a/include/fggl/gfx/ogl/compat.hpp
+++ b/include/fggl/gfx/ogl/compat.hpp
@@ -1,5 +1,5 @@
-#ifndef FGGL_GFX_OGL_COMPAT_H
-#define FGGL_GFX_OGL_COMPAT_H
+#ifndef FGGL_GFX_OGL_COMPAT_HPP
+#define FGGL_GFX_OGL_COMPAT_HPP
 /**
  * Legacy/Direct OpenGL calls.
  *
diff --git a/include/fggl/gfx/ogl/renderer.hpp b/include/fggl/gfx/ogl/renderer.hpp
index 97f621f..600969e 100644
--- a/include/fggl/gfx/ogl/renderer.hpp
+++ b/include/fggl/gfx/ogl/renderer.hpp
@@ -10,7 +10,6 @@
 #include "fggl/gfx/ogl4/canvas.hpp"
 
 #include <fggl/gfx/paint.hpp>
-#include <fggl/gfx/renderer.hpp>
 
 #include <memory>
 #include <vector>
@@ -71,10 +70,6 @@ namespace fggl::gfx {
 
 	using OpenGL4 = OpenGL4Backend;
 
-// specialisation hooks
-	using MeshRenderer = GlMeshRenderer;
-	using MeshToken = GlRenderToken;
-
 };  // namespace fggl::gfx
 
 #endif
diff --git a/include/fggl/gfx/renderer.hpp b/include/fggl/gfx/renderer.hpp
deleted file mode 100644
index 5fe42c6..0000000
--- a/include/fggl/gfx/renderer.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <functional>
-#include <memory>
-
-namespace fggl::gfx {
-
-	class RenderBackend {
-		public:
-			RenderBackend();
-			virtual ~RenderBackend() = default;
-
-			virtual void clear() = 0;
-			virtual void swap() = 0;
-
-	};
-
-	using RenderBackendPtr = std::unique_ptr<RenderBackend>;
-	using RenderBackendFactory = std::function<fggl::gfx::RenderBackendPtr &&()>;
-
-};
diff --git a/include/fggl/gfx/vector.hpp b/include/fggl/gfx/vector.hpp
deleted file mode 100644
index 72d7649..0000000
--- a/include/fggl/gfx/vector.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef FGGL_GFX_VECTOR_H
-#define FGGL_GFX_VECTOR_H
-
-#include <fggl/math/types.hpp>
-#include <vector>
-
-namespace fggl::gfx {
-
-	struct Rectangle {
-		math::vec2 topLeft;
-		math::vec2 size;
-	};
-
-	struct Polygon {
-		std::vector<math::vec2> points;
-	};
-
-}
-
-#endif
diff --git a/include/fggl/gfx/window.hpp b/include/fggl/gfx/window.hpp
index 36327b7..b3d5046 100644
--- a/include/fggl/gfx/window.hpp
+++ b/include/fggl/gfx/window.hpp
@@ -8,7 +8,6 @@
 #include <fggl/input/input.hpp>
 #include <fggl/gfx/common.hpp>
 #include <fggl/math/types.hpp>
-#include <fggl/gfx/input.hpp>
 #include <fggl/gfx/windowing.hpp>
 
 namespace fggl::gfx {
-- 
GitLab