Question

So I'm back with another ray tracing question. My code renders spheres all fine and dandy, but cubes aren't really working. I'm using this code to test for intersections: http://pastebin.com/qgm6vpdx (It's a recursive function, t is the distance to the intersection point) The bounding box is defined as:

Cube* c1 = new Cube;      
c1->Corner1 = Vec3(100, 100, 100);      
c1->Corner2 = Vec3(200, 200, 200);

I've confirmed that the camera is not inside the cube. Now, the only problem is that the entire screen shows up as green (the color designated to the cube)

I don't think I'm doing the cube intersections right, can anyone proof read my code?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top