very basic thing works
This commit is contained in:
+2
-2
@@ -11,8 +11,8 @@ int main()
|
||||
Window window(1920, 1080);
|
||||
scene.startRender(
|
||||
Camera{
|
||||
.position = glm::vec3(0, 0, 10),
|
||||
.direction = glm::vec3(0, 0, -1),
|
||||
.position = glm::vec3(0, 10, 10),
|
||||
.direction = glm::vec3(0, -1, -1),
|
||||
},
|
||||
RenderParameter{
|
||||
.width = 1920,
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ std::optional<IntersectionInfo> BVH::traceRay(Ray ray)
|
||||
|
||||
std::vector<IntersectionInfo> BVH::generateIntersections(PNode& currentNode, Ray ray)
|
||||
{
|
||||
if (!currentNode->aabb.intersects(ray, 0, 1))
|
||||
if (!currentNode->aabb.intersects(ray, 0, std::numeric_limits<float>::max()))
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ void Scene::render(Camera camera, RenderParameter params)
|
||||
std::uniform_real_distribution<float> rnd02(0.0, 2.0);
|
||||
for (int h = 0; h < params.height; ++h)
|
||||
{
|
||||
Ray cam = Ray(camera.position, camera.direction);
|
||||
Ray cam = Ray(camera.position, glm::normalize(camera.direction));
|
||||
glm::vec3 cx =
|
||||
glm::normalize(glm::cross(cam.direction, abs(cam.direction.y) < 0.9 ? glm::vec3(0, 1, 0) : glm::vec3(0, 0, 1))),
|
||||
cy = glm::cross(cx, cam.direction);
|
||||
|
||||
Reference in New Issue
Block a user