From 18960c4b88ce912e08b12182b835a7de75388b78 Mon Sep 17 00:00:00 2001 From: Julian T Date: Thu, 23 Jul 2020 23:13:55 +0200 Subject: New project structure --- src/main.cpp | 23 +++++++++++++++++++++++ src/object.hpp | 19 +++++++++++++++++++ src/scene.cpp | 5 +++++ src/scene.hpp | 15 +++++++++++++++ src/vector.hpp | 18 ++++++++++++++++++ 5 files changed, 80 insertions(+) create mode 100644 src/main.cpp create mode 100644 src/object.hpp create mode 100644 src/scene.cpp create mode 100644 src/scene.hpp create mode 100644 src/vector.hpp (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..3c15429 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include +#include + +#include + +using namespace std; + +int main() +{ + cout << "Hello World!" << endl; + + sf::RenderWindow window(sf::VideoMode(200, 200), "Yaah working"); + sf::CircleShape shape(100.f); + + window.clear(); + window.draw(shape); + window.display(); + + return 0; +} diff --git a/src/object.hpp b/src/object.hpp new file mode 100644 index 0000000..56c6968 --- /dev/null +++ b/src/object.hpp @@ -0,0 +1,19 @@ +#ifndef OBJECT_H +#define OBJECT_H + +#include +#include "vector.hpp" + +class Material { + Vec3d color; + + double defuse; + double emissive; +}; + +class Object { + public: + std::shared_ptr m; +}; + +#endif diff --git a/src/scene.cpp b/src/scene.cpp new file mode 100644 index 0000000..d65dca7 --- /dev/null +++ b/src/scene.cpp @@ -0,0 +1,5 @@ +#include "scene.hpp" + +void Scene::addObject(Object obj) { + objs.push_back(obj); +} diff --git a/src/scene.hpp b/src/scene.hpp new file mode 100644 index 0000000..6e3f33e --- /dev/null +++ b/src/scene.hpp @@ -0,0 +1,15 @@ +#ifndef SCENE_H +#define SCENE_H + +#include +#include "object.hpp" + +class Scene { + public: + void addObject(Object obj); + + std::vector objs; + +}; + +#endif diff --git a/src/vector.hpp b/src/vector.hpp new file mode 100644 index 0000000..6d15f34 --- /dev/null +++ b/src/vector.hpp @@ -0,0 +1,18 @@ +#ifndef VECTOR_H +#define VECTOR_H + +class Vec3d { + Vec3d(); + Vec3d(double x, double y, double z); + + void set(double x, double y, double z); + void normalize(); + + double length(); + + Vec3d cross(const Vec3d &vec); + + // Operators +}; + +#endif -- cgit v1.2.3