From 6a13c760ece9ef3b21bcbf829ad6c4347623e856 Mon Sep 17 00:00:00 2001 From: Diogo Matos Date: Sun, 3 Mar 2024 16:10:19 +0000 Subject: [PATCH] fix: add correct `.hpp` files --- engine/include/Camera.hpp | 21 +++++++++++++++ engine/include/Configuration.hpp | 19 +++++++++++++ engine/include/Window.hpp | 15 +++++++++++ engine/include/parse.hpp | 10 +++++++ engine/src/Camera.cpp | 46 +++++++++++++------------------- engine/src/Configuration.cpp | 21 +++++---------- engine/src/Window.cpp | 22 +++++++-------- engine/src/parse.cpp | 8 ++---- 8 files changed, 101 insertions(+), 61 deletions(-) create mode 100644 engine/include/Camera.hpp create mode 100644 engine/include/Configuration.hpp create mode 100644 engine/include/Window.hpp create mode 100644 engine/include/parse.hpp diff --git a/engine/include/Camera.hpp b/engine/include/Camera.hpp new file mode 100644 index 0000000..04a1d95 --- /dev/null +++ b/engine/include/Camera.hpp @@ -0,0 +1,21 @@ +#ifndef CAMERA_HPP +#define CAMERA_HPP + +#include "Camera.hpp" +#include "utils.hpp" + +class Camera { + public: + Point position; + Point lookAt; + Point up; + int fov; + float near; + float far; + + Camera(); + Camera(Point position, Point lookAt, Point up, int fov, float near, + float far); +}; + +#endif // CAMERA_HPP \ No newline at end of file diff --git a/engine/include/Configuration.hpp b/engine/include/Configuration.hpp new file mode 100644 index 0000000..647f503 --- /dev/null +++ b/engine/include/Configuration.hpp @@ -0,0 +1,19 @@ +#ifndef CONFIGURATION_HPP +#define CONFIGURATION_HPP + +#include + +#include "Camera.hpp" +#include "Configuration.hpp" +#include "Window.hpp" + +class Configuration { + public: + Window window; + Camera camera; + std::vector models; + + Configuration(Window window, Camera camera, std::vector models); +}; + +#endif // CONFIGURATION_HPP \ No newline at end of file diff --git a/engine/include/Window.hpp b/engine/include/Window.hpp new file mode 100644 index 0000000..2bfb7c3 --- /dev/null +++ b/engine/include/Window.hpp @@ -0,0 +1,15 @@ +#ifndef WINDOW_HPP +#define WINDOW_HPP + +#include "Window.hpp" + +class Window { + public: + float width; + float height; + + Window(); + Window(float width, float height); +}; + +#endif // WINDOW_HPP \ No newline at end of file diff --git a/engine/include/parse.hpp b/engine/include/parse.hpp new file mode 100644 index 0000000..3025e2a --- /dev/null +++ b/engine/include/parse.hpp @@ -0,0 +1,10 @@ +#ifndef PARSE_HPP +#define PARSE_HPP + +#include "../../lib/rapidxml-1.13/rapidxml.hpp" +#include "Configuration.hpp" +#include "parse.hpp" + +Configuration parseConfig(char* filename); + +#endif // PARSE_HPP \ No newline at end of file diff --git a/engine/src/Camera.cpp b/engine/src/Camera.cpp index dfe9195..6df4a16 100644 --- a/engine/src/Camera.cpp +++ b/engine/src/Camera.cpp @@ -1,30 +1,20 @@ -#include "utils.hpp" +#include "Camera.hpp" -class Camera { - public: - Point position; - Point lookAt; - Point up; - int fov; - float near; - float far; +Camera::Camera() { + this->position = Point(); + this->lookAt = Point(); + this->up = Point(); + this->fov = 0; + this->near = 0; + this->far = 0; +} - Camera() { - this->position = Point(); - this->lookAt = Point(); - this->up = Point(); - this->fov = 0; - this->near = 0; - this->far = 0; - } - - Camera(Point position, Point lookAt, Point up, int fov, float near, - float far) { - this->position = position; - this->lookAt = lookAt; - this->up = up; - this->fov = fov; - this->near = near; - this->far = far; - } -}; +Camera::Camera(Point position, Point lookAt, Point up, int fov, float near, + float far) { + this->position = position; + this->lookAt = lookAt; + this->up = up; + this->fov = fov; + this->near = near; + this->far = far; +} diff --git a/engine/src/Configuration.cpp b/engine/src/Configuration.cpp index f6d158c..0c149d3 100644 --- a/engine/src/Configuration.cpp +++ b/engine/src/Configuration.cpp @@ -1,15 +1,8 @@ -#include "Camera.cpp" -#include "Window.cpp" +#include "Configuration.hpp" -class Configuration { - public: - Window window; - Camera camera; - std::vector models; - - Configuration(Window window, Camera camera, std::vector models) { - this->window = window; - this->camera = camera; - this->models = models; - } -}; +Configuration::Configuration(Window window, Camera camera, + std::vector models) { + this->window = window; + this->camera = camera; + this->models = models; +} diff --git a/engine/src/Window.cpp b/engine/src/Window.cpp index 8d1dd3d..a02b3ba 100644 --- a/engine/src/Window.cpp +++ b/engine/src/Window.cpp @@ -1,15 +1,11 @@ -class Window { - public: - float width; - float height; +#include "Window.hpp" - Window() { - this->width = 0; - this->height = 0; - } +Window::Window() { + this->width = 0; + this->height = 0; +} - Window(float width, float height) { - this->width = width; - this->height = height; - } -}; +Window::Window(float width, float height) { + this->width = width; + this->height = height; +} diff --git a/engine/src/parse.cpp b/engine/src/parse.cpp index 1d920b0..2874642 100644 --- a/engine/src/parse.cpp +++ b/engine/src/parse.cpp @@ -1,12 +1,8 @@ +#include "parse.hpp" + #include #include -#include "../../lib/rapidxml-1.13/rapidxml.hpp" -#include "Camera.cpp" -#include "Configuration.cpp" -#include "Window.cpp" -#include "utils.hpp" - Configuration parseConfig(char* filename) { // open file in read mode std::fstream file;