Is there a way i can knoe if object or entities is currently
on screen or not.
I mean if it is seen by active camera or not.
thanks in avanced for any respond.
Object on camera ?
no, that won't work. isVisible only returns false if you have previously called setVisible(false). The engine does not call setVisible(false) on culled nodes. Here is the function that the SceneManager uses to tell if a node is culled
Note that this is a very rough and inacurate culling function. A much better test (though admittedly somewhat slower to compute) would be to test the objects against the planes of the view frustum rather than simply the aabb of the view frustum.
Code: Select all
bool CSceneManager::isCulled(ISceneNode* node)
{
if (!node->getAutomaticCulling())
return false;
ICameraSceneNode* cam = getActiveCamera();
if (!cam)
return false;
core::aabbox3d<f32> tbox = node->getBoundingBox();
node->getAbsoluteTransformation().transformBox(tbox);
return !(tbox.intersectsWithBox(cam->getViewFrustrum()->boundingBox));
// This is a slower but more exact version:
// SViewFrustrum f = *cam->getViewFrustrum();
// core::matrix4 invTrans;
// AbsoluteTransformation.getInverse(invTrans);
// f.transform(invTrans);
// culled = !(f.boundingBox.intersectsWithBox(Mesh->getBoundingBox()));
}You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.
Crucible of Stars
Crucible of Stars
-
PC-XT