diff --git a/CMakeLists.txt b/CMakeLists.txt index 9168ee2..01fd637 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ file(GLOB SourceFiles ${SrcDIR}/engine/* ${SrcDIR}/display/* ${SrcDIR}/definitions/* - ${SrcDIR}/primatives/definitions/* + ${SrcDIR}/definitions/primatives/* ${SrcDIR}/util/* ${TestDIR}/${CurrentTest} ) diff --git a/src/definitions/primatives/primative.hpp b/src/definitions/primatives/primative.hpp index 43c1484..16266b9 100644 --- a/src/definitions/primatives/primative.hpp +++ b/src/definitions/primatives/primative.hpp @@ -1,7 +1,7 @@ #ifndef INFERNO_DEFINITIONS_PRIMATIVES_PRIMATIVE_H_ #define INFERNO_DEFINITIONS_PRIMATIVES_PRIMATIVE_H_ -#include "../maths.hpp" +#include "../../maths.hpp" class Ray; diff --git a/src/definitions/primatives/sphere.cpp b/src/definitions/primatives/sphere.cpp index 5b0ed89..3e8a8b5 100644 --- a/src/definitions/primatives/sphere.cpp +++ b/src/definitions/primatives/sphere.cpp @@ -1,20 +1,9 @@ +#include "../ray.hpp" #include "sphere.hpp" -#include "ray.hpp" bool Sphere::DoesIntersect(Ray& ray, float& t) { float t0, t1; // Solutions for intersect - // glm::vec3 L = ray.origin - center; - - // float a = glm::dot(ray.direction, ray.direction); - // float b = 2 * glm::dot(ray.direction, L); - // float c = glm::dot(L, L) - radius; - - // if (!quadratic(a, b, c, t0, t1)) { - // t = INFINITY; - // return false; - // }; - glm::vec3 l = center - ray.origin; float tca = glm::dot(l, ray.direction); if (tca < 0.0f) return false; diff --git a/src/definitions/primatives/sphere.hpp b/src/definitions/primatives/sphere.hpp index 5dd1693..67f8b47 100644 --- a/src/definitions/primatives/sphere.hpp +++ b/src/definitions/primatives/sphere.hpp @@ -4,7 +4,7 @@ #include "primative.hpp" class Sphere : public Primative { - +public: Sphere(glm::vec3 center, float radius) : Primative(center, radius) { } diff --git a/src/engine/progressiverenderer.cpp b/src/engine/progressiverenderer.cpp index 54cdd26..05c8846 100644 --- a/src/engine/progressiverenderer.cpp +++ b/src/engine/progressiverenderer.cpp @@ -29,7 +29,10 @@ void ProgressiveRenderer::Render() { // Update the camera m_scene->camera->Update(); - + for (int x = 0; x < m_scene->w; x++) + for (int y = 0; y < m_scene->h; y++) { + + } // Swap framebuffers m_interface->Update(); diff --git a/src/inferno.hpp b/src/inferno.hpp index d430aa9..79793d1 100644 --- a/src/inferno.hpp +++ b/src/inferno.hpp @@ -10,6 +10,7 @@ // Give the user access to the base classes to define shit #include "definitions/scene.hpp" #include "definitions/camera.hpp" +#include "definitions/primatives/sphere.hpp" class Display; class Renderer; diff --git a/test/main.cpp b/test/main.cpp index 3e081df..fa6e6d8 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -13,6 +13,7 @@ int main(int argc, char** argv) { Scene* scene = new Scene(600, 600); scene->camera = new Camera({0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, 600, 600); + scene->objects.push_back(new Sphere({0.0f, 0.0f, 2.0f}, 1.0f)); inferno.SetScene(scene);