aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-07-23 23:13:55 +0200
committerJulian T <julian@jtle.dk>2020-07-23 23:13:55 +0200
commit18960c4b88ce912e08b12182b835a7de75388b78 (patch)
treefd3994dc07a07298824521000bde1683461e5262 /src
parent13a7b10ab0efa82a24187cdfb2cf2a55691568f0 (diff)
New project structure
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp23
-rw-r--r--src/object.hpp19
-rw-r--r--src/scene.cpp5
-rw-r--r--src/scene.hpp15
-rw-r--r--src/vector.hpp18
5 files changed, 80 insertions, 0 deletions
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 <SFML/Graphics/CircleShape.hpp>
+#include <SFML/Graphics/RenderWindow.hpp>
+#include <SFML/Window/Event.hpp>
+#include <SFML/Window/VideoMode.hpp>
+#include <iostream>
+
+#include <SFML/Graphics.hpp>
+
+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 <memory>
+#include "vector.hpp"
+
+class Material {
+ Vec3d color;
+
+ double defuse;
+ double emissive;
+};
+
+class Object {
+ public:
+ std::shared_ptr<Material> 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 <vector>
+#include "object.hpp"
+
+class Scene {
+ public:
+ void addObject(Object obj);
+
+ std::vector<Object> 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