Fixed DrawCallback in Drawable and added CullCallback to Drawable

Cull Visitor now checks for a Drawable's CullCallback and calls it
if it exists.  It then prunes based on the return value (bool) of the
cull callback.
This commit is contained in:
Don BURNS
2002-03-13 22:44:22 +00:00
parent bc30edb9e6
commit d0ee300405
4 changed files with 32 additions and 4 deletions

View File

@@ -38,7 +38,8 @@ Drawable::Drawable(const Drawable& drawable,const CopyOp& copyop):
_globjList(drawable._globjList),
_bbox(drawable._bbox),
_bbox_computed(drawable._bbox_computed),
_drawCallback(drawable._drawCallback)
_drawCallback(drawable._drawCallback),
_cullCallback(drawable._cullCallback)
{}
Drawable::~Drawable()

View File

@@ -191,6 +191,7 @@ void Texture::apply(State& state) const
if (_subloadMode == OFF)
{
glBindTexture( GL_TEXTURE_2D, handle );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _min_filter);
}
else if (_image.valid() && _image->data())
{

View File

@@ -895,11 +895,18 @@ void CullVisitor::apply(Geode& node)
Matrix* matrix = getCurrentMatrix();
for(int i=0;i<node.getNumDrawables();++i)
{
Drawable* drawable = node.getDrawable(i);
const BoundingBox &bb =drawable->getBound();
if (isCulled(bb,mode)) continue;
if( drawable->getCullCallback() )
{
if( drawable->getCullCallback()->cull( this, drawable ) == true )
continue;
}
else
{
if (isCulled(bb,mode)) continue;
}
//SandB change: