2008/7/27 David Adam david.adam.cnrs@gmail.com:
ortho = D3DXVec3Dot(praydirection, &normal[i]);
if ( ortho )
{
t = D3DXVec3Dot(praydirection, &normal[i]) / ortho;
This doesn't make much sense, t will always be close to zero this way.
- rayposition.x = -3.0f; rayposition.y = 1.0f; rayposition.z = -2.0f;
- result = D3DXBoxBoundProbe(&bottom_point, &top_point, &rayposition, &raydirection);
- ok(result == TRUE, "expected TRUE, received FALSE\n");
This succeeds because rayposition lies on one of the faces of the box. I think it would be useful to also add a test where rayposition lies outside the box but where the ray still intersects the box.
In general, also note that the fact that the box is always axis-aligned means the normal is always 0 in two of the three directions. This simplifies the equations a bit.