Model is loaded and added, started to implement ray generation

This commit is contained in:
Gamemaker1998
2025-01-24 23:21:14 +01:00
parent 8af00e2510
commit 8317ccaaba
5 changed files with 37 additions and 15 deletions
+5
View File
@@ -3,6 +3,7 @@
#include <glm/glm.hpp>
#include <algorithm>
#include "util/Ray.h"
#include <iostream>
struct AABB
{
@@ -45,9 +46,13 @@ struct AABB
}
bool intersects(Ray ray, float tmin, float tmax)
{
std::cout << "Hello1" << std::endl;
glm::vec3 invD = 1.0f / ray.direction;
std::cout << "Hello2: " << min.x << " " << min.y << " " << min.z << " " << max.x << " " << max.y << " " << max.z << " " << std::endl;
glm::vec3 t0s = glm::vec3(min - ray.origin) * invD;
std::cout << "Hello3" << std::endl;
glm::vec3 t1s = glm::vec3(max - ray.origin) * invD;
std::cout << "Hello4" << std::endl;
glm::vec3 tsmaller = glm::min(t0s, t1s);
glm::vec3 tbigger = glm::max(t0s, t1s);