# [SOLVED] Camera frustum

hello,

in the Camera class there is are some “show/hide” frustum functions but I can’t actually find a function that returns the frustum itself.

I would like to write some LOD functionality for my custom camera wrapper class and there is various stuff that I need, including the frustum.

I think I could calculate the frustum myself but I was hoping to use the one that panda uses.

You can use Lens::make_bounds() to return a BoundingHexahedron that represents the frustum.

But, really, it’s just a projection of the four corners of the film, onto the near and the far planes–that’s the eight corners of the frustum. You can get the same answer by calling Lens::project() four times.

David

I have actually resolved to use the BoundingVolumes

``````	int rockBottom = -1000;
int skyMax = 3000;

LPoint3f fll(x - half, y - half, rockBottom);
LPoint3f flr(x + half, y - half, rockBottom);
LPoint3f fur(x + half, y + half, rockBottom);
LPoint3f ful(x - half, y + half, rockBottom);
LPoint3f nll(x - half, y - half, skyMax);
LPoint3f nlr(x + half, y - half, skyMax);
LPoint3f nur(x + half, y + half, skyMax);
LPoint3f nul(x - half, y + half, skyMax);
CPT(BoundingHexahedron) bv = new BoundingHexahedron(fll, flr, fur, ful, nll, nlr, nur, nul);

pMyClass->SetBoundingVolume(bv);``````

this will give a “maximum” bounding box even if there is no “geometry” yet , which is what I need.

then I check it against the lens’s bounding volume

``````CPT(BoundingVolume) bv = DCAST(BoundingVolume, mBBox);
if(bv && pCamera->IsInFrustum(bv))
{
....
}``````

where pCamera is my helper class for dealing with the camera node/lens