ActionBase::ResultE TestMultiPartitionStage::renderLeave(Action *action)
{
#ifdef OSG_DUMP_TRAVERSAL
    FDEBUG_GV(("Leave TestMultiPartStage %p\n", &(*pCore)));
#endif

    RenderAction      *a      = 
        dynamic_cast<RenderAction *>(action);

#ifdef OSG_DEBUGX
    if(this != NULL && this->getMessage().size() != 0)
    {
        fprintf(stderr, "StartLeave MPTS %s\n",
                this->getMessage().c_str());
    }
#endif

    /*StageValidator::ValidationStatus eStatus = */ this->validateOnLeave(a);

#ifdef OSG_DEBUGX
    a->dumpPartitionList();
#endif
    
    return ActionBase::Continue;
}
예제 #2
0
bool StateChunkClass::initialize(void)
{
    std::stable_sort(_initClasses->begin    (),
                     _initClasses->end      (),
                      StateChunkClassCompare());

    _classes  = new std::vector<StateChunkClass *>;
    _numslots = new std::vector<     UInt32      >;

    for(UInt32 i = 0; i < _initClasses->size(); ++i)
    {
        (*_initClasses)[i]->_classId = UInt32(_classes->size());

        for(UInt32 j = 0; j < (*_initClasses)[i]->_numSlots; ++j)
        {
            _classes ->push_back((*_initClasses)[i]);
            _numslots->push_back((*_initClasses)[i]->_numSlots);
        }
    }

    for(UInt32 i = 0; i < _classes->size(); ++i)
    {
        FDEBUG_GV(("[%d/%d][%d] %s %d %d\n",
                   i,
                   StateChunkClass::getUsedSlots(),
                   (*_classes)[i]->_classId,
                   (*_classes)[i]->_className.c_str(),
                   (*_classes)[i]->_priority,
                   (*_classes)[i]->_numSlots));
    }

    return true;
}
bool IntersectAction::terminateLeave(void)
{
    FDEBUG_GV(("Terminate IntersectAction Leave\n"));

    delete _defaultLeaveFunctors;

    _defaultLeaveFunctors = NULL;

    return true;
}
bool IntersectAction::terminateEnter(void)
{
    FDEBUG_GV(("Terminate IntersectAction Enter\n"));

    delete _defaultEnterFunctors;

    _defaultEnterFunctors = NULL;

    return true;
}
bool RenderAction::terminateLeave(void)
{
    FDEBUG_GV(("Terminate RenderAction Leave\n"));

    delete _vDefaultLeaveFunctors;

    _vDefaultLeaveFunctors = NULL;

    return true;
}
bool RenderAction::terminateEnter(void)
{
    FDEBUG_GV(("Terminate RenderAction Enter\n"));

    delete _vDefaultEnterFunctors;

    _vDefaultEnterFunctors = NULL;

    return true;
}
void RenderAction::registerLeaveDefault(
    const FieldContainerType &type,
    const Action::Functor    &func)
{
    if(_vDefaultLeaveFunctors == NULL)
    {
        _vDefaultLeaveFunctors = new Action::FunctorStore;

        addPostFactoryExitFunction(&RenderAction::terminateLeave);
    }

    while(type.getId() >= _vDefaultLeaveFunctors->size())
    {
        _vDefaultLeaveFunctors->push_back(&Action::_defaultLeaveFunction);
    }

    FDEBUG_GV(("Register rendertrav leave for %s\n", type.getCName()));

    (*_vDefaultLeaveFunctors)[type.getId()] = func;
}
ActionBase::ResultE TestMultiPartitionStage::renderEnter(Action *action)
{
#ifdef OSG_DUMP_TRAVERSAL
    FDEBUG_GV(("Enter TestMultiPartStage %p\n", &(*pCore)));
#endif

    RenderAction *a = dynamic_cast<RenderAction *>(action);

#ifdef OSG_DEBUGX
    if(this != NULL && this->getMessage().size() != 0)
    {
        fprintf(stderr, "StartEnter MPTS %s\n",
                this->getMessage().c_str());
    }
#endif

    TraversalValidator::ValidationStatus eStatus = this->validateOnEnter(a);

    if(eStatus == TraversalValidator::Run)
    {
        if(this->getUseGroup() == true)
        {
            this->beginPartitionGroup(a);
        }
        else
        {
            this->beginPartitions(a);
        }

        for(Int32 i = 0; i < this->getNumPartitions(); ++i)
        {
            this->pushPartition(a);
            {
#ifdef OSG_DEBUG
                RenderPartition *pPart  = a->getActivePartition();
            
                if(this != NULL && this->getMessage().size() != 0)
                {
                    char szNum[16];
                    
                    std::string szMessage = this->getMessage();
                    
                    sprintf(szNum, "%d", i);
                    
                    szMessage += " | Partition ";
                    szMessage += szNum;
                    
                    pPart->setDebugString(szMessage);
                }
#endif

                this->recurseFromThis(a);
            }
            this->popPartition(a);
        }
        
        if(this->getUseGroup() == true)
        {
            this->endPartitionGroup(a);
        }
        else
        {
            this->endPartitions(a);
        }
    }

#ifdef OSG_DEBUGX
    if(this != NULL && this->getMessage().size() != 0)
    {
        fprintf(stderr, "FinishedEnter MPTS %s\n",
                this->getMessage().c_str());
    }
#endif

    return ActionBase::Continue;
}