frustum frustration..
You can avoid all of the tests to get the p and n vertices, either by precalculating an index per plane (which will be the same for all bounding boxes), or using centre and size like the example code I linked to.
thanks, i tried it out, no visible result yet though:
// check negative vertex; less far along the normal's direction
dist = D3DXPlaneDotCoord(&mFrustumPlane, &_nvtx);
if(dist < 0) intersect = true; // return INTERSECT; // intersecting, negative vertex within frustum
}
if(intersect) return INTERSECT;
Good idea on precalculating the index per plane, saves me a lot when having a lot of bounding box checks.
The 'inaccuracy' sympton is that ik looks accurate for small objects. The larger the object, the more inaccurary. When the camera is further away from the object, the accuracy gets better (for larger objects specifically). The inaccuracy I mean is that an object is not culled while it's not in the frustum anymore (for 1 up to 3 worldspace units or so).
It's the same when I loop through all 8 points against all planes, so probably doesn't have to do with using pos and neg vertex (Extents) instead.
First I thought it was the shape of the besh, but using a real aligned box as a mesh gives the same results.
Crealysm game & engine development: http://www.crealysm.com
Looking for a passionate, disciplined and structured producer? PM me