diff --git a/src/definitions/primatives/plane.cpp b/src/definitions/primatives/plane.cpp index 843db82..e246c12 100644 --- a/src/definitions/primatives/plane.cpp +++ b/src/definitions/primatives/plane.cpp @@ -14,6 +14,10 @@ bool Plane::Intersect(Ray& ray, float& t) { return false; } +glm::vec3 Plane::SurfaceTangent(glm::vec3 normal) { + return {}; +} + glm::vec3 Plane::SurfaceNormal(glm::vec3 hitPoint) { return -normal; } diff --git a/src/definitions/primatives/plane.hpp b/src/definitions/primatives/plane.hpp index af24c6f..03e9404 100644 --- a/src/definitions/primatives/plane.hpp +++ b/src/definitions/primatives/plane.hpp @@ -10,6 +10,7 @@ public: bool Intersect(Ray& ray, float& t) override; glm::vec3 SurfaceNormal(glm::vec3 hitPoint) override; + glm::vec3 SurfaceTangent(glm::vec3 normal) override; glm::vec2 TexCoords(glm::vec3 hitPoint) override; void Translate(glm::vec3 trans) override; }; diff --git a/src/definitions/primatives/sphere.cpp b/src/definitions/primatives/sphere.cpp index 138e520..e18434e 100644 --- a/src/definitions/primatives/sphere.cpp +++ b/src/definitions/primatives/sphere.cpp @@ -23,6 +23,10 @@ glm::vec3 Sphere::SurfaceNormal(glm::vec3 hitPoint) { return glm::normalize(hitPoint - center); } +glm::vec3 Sphere::SurfaceTangent(glm::vec3 normal) { + return {}; +} + glm::vec2 Sphere::TexCoords(glm::vec3 hitPoint) { glm::vec3 hit = hitPoint - center; return { (1.0f + atan2(hit.z, hit.x) / PI) * 0.5f, diff --git a/src/definitions/primatives/sphere.hpp b/src/definitions/primatives/sphere.hpp index b5ffe41..9d08a10 100644 --- a/src/definitions/primatives/sphere.hpp +++ b/src/definitions/primatives/sphere.hpp @@ -10,6 +10,7 @@ public: bool Intersect(Ray& ray, float& t) override; glm::vec3 SurfaceNormal(glm::vec3 hitPoint) override; + glm::vec3 SurfaceTangent(glm::vec3 normal) override; glm::vec2 TexCoords(glm::vec3 hitPoint) override; void Translate(glm::vec3 trans) override; }; diff --git a/src/definitions/primatives/triangle.cpp b/src/definitions/primatives/triangle.cpp index 9c30341..7a3ab61 100644 --- a/src/definitions/primatives/triangle.cpp +++ b/src/definitions/primatives/triangle.cpp @@ -30,6 +30,10 @@ bool Triangle::Intersect(Ray& ray, float& t) { return false; } +glm::vec3 Triangle::SurfaceTangent(glm::vec3 normal) { + return {}; +} + glm::vec3 Triangle::SurfaceNormal(glm::vec3 hitPoint) { return ((normals[0] + normals[1] + normals[2]) / 3.0f); } diff --git a/src/definitions/primatives/triangle.hpp b/src/definitions/primatives/triangle.hpp index 6d3e953..ca378b9 100644 --- a/src/definitions/primatives/triangle.hpp +++ b/src/definitions/primatives/triangle.hpp @@ -10,8 +10,10 @@ public: bool Intersect(Ray& ray, float& t) override; glm::vec3 SurfaceNormal(glm::vec3 hitPoint) override; + glm::vec3 SurfaceTangent(glm::vec3 normal) override; glm::vec2 TexCoords(glm::vec3 hitPoint) override; void Translate(glm::vec3 trans) override; + glm::vec3 Midpoint(); }; diff --git a/test/main.cpp b/test/main.cpp index f49799c..17e1265 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -2,8 +2,8 @@ #include "../src/inferno.hpp" -static const int width = 600; -static const int height = 600; +static const int width = 1000; +static const int height = 1000; int main(int argc, char** argv) { InfernoEngine inferno; @@ -23,15 +23,16 @@ int main(int argc, char** argv) { scene->objects.push_back(&sphere1); Sphere sphere({ 0.0f, 0.0f, -5.0f }, 1.0f, new Material({ 0.817f, 0.374, 0.574 })); - sphere.material->NormalTexture = new Texture("/home/ben/programming/inferno/resources/textures/dirt-normal.jpg"); + sphere.material->NormalTexture = new Texture("E:/Projects/Inferno/resources/textures/dirt-normal.jpg"); + // sphere.material->NormalTexture = new Texture("/home/ben/programming/inferno/resources/textures/dirt-normal.jpg"); scene->objects.push_back(&sphere); Sphere light({ 35.0f, 56.0f, 25.0f }, 35.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f, 5.0f)); scene->objects.push_back(&light); Plane plane({ 0.0f,-1.0f, 0.0f }, { 0.0f, -1.0f, 0.0f }, new Material({ 0.9f, 0.9f, 0.9f }, 0.2f)); - // plane.material->NormalTexture = new Texture("E:/Projects/Inferno/resources/textures/normals.png"); - plane.material->NormalTexture = new Texture("/home/ben/programming/inferno/resources/textures/normals.png"); + plane.material->NormalTexture = new Texture("E:/Projects/Inferno/resources/textures/normals.png"); + // plane.material->NormalTexture = new Texture("/home/ben/programming/inferno/resources/textures/normals.png"); scene->objects.push_back(&plane); //scene->objects.push_back(new Sphere({ 35.0f, 26.0f, 25.0f }, 15.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f, 5.0f)));