Ejemplo n.º 1
0
void DrawEnv::activate(State         *pState,
                       StateOverride *pOverride)
{
    MFUnrecStateChunkPtr::const_iterator cIt  = pState->getMFChunks()->begin();
    MFUnrecStateChunkPtr::const_iterator cEnd = pState->getMFChunks()->end  (); 

    StateOverride::ChunkStoreConstIt     overIt = pOverride->begin();

    Int32                     ind    = 0;
    UInt32                    cind   = osgMin(State::SkipNumChunks, 
                                              pState->getMFChunks()->size32());

    UInt32 const              climit = pState->getCoreGLChunkLimit();

    OSG_SKIP_IT    (cIt, cind);

    for(; (cIt != cEnd) && (cind < climit); ++cIt, ++cind)
    {
        if(overIt != pOverride->end() && overIt->first == cind)
        {
            if(overIt->second->getIgnore() == false)
            {
                overIt->second->activate(this, UInt32(ind));
            }

            ++overIt;
        }
        else
        {
            if(*cIt != NULL && (*cIt)->getIgnore() == false)
            {
                (*cIt)->activate(this, UInt32(ind));
            }
        }

        if(++ind >= StateChunkClass::getNumSlots(cind))
            ind = 0;
    }

    while(overIt != pOverride->end())
    {
        if(overIt->first >= climit)
            break;

        if(overIt->second->getIgnore() == false)
        {
            overIt->second->activate(this,
                                     UInt32(overIt->first -
                                            overIt->second->getClassId()));
        }

        ++overIt;
    }

    ++_uiNumStateChanges;
}
Ejemplo n.º 2
0
void State::changeFrom(DrawEnv *pEnv, State *pOld) const
{
    MFChunksType::const_iterator cIt    = _mfChunks.begin();
    MFChunksType::const_iterator cEnd   = _mfChunks.end  ();
    Int32                        ind    = 0;
    UInt32                       i;
    UInt32                       cind   = osgMin(State::SkipNumChunks,
                                                 _mfChunks.size32()  );
    UInt32 const                 climit = _uiCoreGLChunkLimit;

    OSG_SKIP_IT(cIt, cind);

    for(; (cIt != cEnd) && (cind < climit); ++cIt, ++cind)
    {
        StateChunk *o = pOld->getChunk(cind);
        StateChunk *n = *cIt;

        if(n != NULL && n->getIgnore() == false)
        {
            if(o != NULL && o->getIgnore() == false)
            {
                n->changeFrom(pEnv, o, UInt32(ind));
            }
            else
            {
                n->activate(pEnv, UInt32(ind));
            }
        }
        else if(o != NULL && o->getIgnore() == false)
        {
            o->deactivate(pEnv, UInt32(ind));
        }

        if(++ind >= StateChunkClass::getNumSlots(cind))
            ind = 0;
    }

    if(ind >= StateChunkClass::getNumSlots(cind))
        ind = 0;

    for(i = cind; (i < pOld->getMFChunks()->size()) && (i < climit); ++i)
    {
        StateChunk *o = pOld->getChunk(i);

        if(o != NULL && o->getIgnore() == false)
        {
            o->deactivate(pEnv, UInt32(ind));
        }

        if(++ind >= StateChunkClass::getNumSlots(i))
        {
            ind = 0;
        }
    }
}
Ejemplo n.º 3
0
void DrawEnv::deactivate(State         *pState,
                         StateOverride *pOverride  )
{
    MFUnrecStateChunkPtr::const_iterator cIt  = pState->getMFChunks()->begin();
    MFUnrecStateChunkPtr::const_iterator cEnd = pState->getMFChunks()->end  ();

    StateOverride::ChunkStoreIt          overIt = pOverride->begin();

    Int32                     ind  = 0;
    SizeT                     cind = osgMin(State::SkipNumChunks, 
                                            pState->getMFChunks()->size());

    OSG_SKIP_IT(cIt, cind);

    for(; cIt != cEnd; ++cIt, ++cind)
    {
        if(overIt != pOverride->end() && overIt->first == cind)
        {
            if(overIt->second->getIgnore() == false)
            {
                overIt->second->deactivate(this, UInt32(ind));
            }

            ++overIt;
        }
        else
        {
            if(*cIt != NULL && (*cIt)->getIgnore() == false)
            {
                (*cIt)->deactivate(this, UInt32(ind));
            }
        }

        if(++ind >= StateChunkClass::getNumSlots(cind))
            ind = 0;
    }

    while(overIt !=  pOverride->end())
    {
        if(overIt->second->getIgnore() == false)
        {
            overIt->second->deactivate(this,
                                       UInt32(overIt->first -
                                              overIt->second->getClassId()));
        }

        ++overIt;
    }
}
Ejemplo n.º 4
0
void State::deactivate(DrawEnv *pEnv) const
{
    MFChunksType::const_iterator cIt    = _mfChunks.begin();
    MFChunksType::const_iterator cEnd   = _mfChunks.end  ();
    Int32                        ind    = 0;
    UInt32                       cind   = osgMin(State::SkipNumChunks,
                                                 _mfChunks.size32()  );
    UInt32 const                 climit = _uiCoreGLChunkLimit;

    OSG_SKIP_IT(cIt, cind);

    for(; (cIt != cEnd) && (cind < climit); ++cIt, ++cind)
    {
        if(*cIt != NULL && (*cIt)->getIgnore() == false)
            (*cIt)->deactivate(pEnv, UInt32(ind));

        if(++ind >= StateChunkClass::getNumSlots(cind))
            ind = 0;
    }
}
Ejemplo n.º 5
0
void DrawEnv::update(State         *pState,
                     StateOverride *pOverride)
{
#if 0
    MFUnrecStateChunkPtr::const_iterator cIt  = pState->getMFChunks()->begin();
    MFUnrecStateChunkPtr::const_iterator cEnd = pState->getMFChunks()->end  ();

    StateOverride::ChunkStoreIt          overIt = pOverride->begin();

    Int32                     ind  = 0;
    UInt32                    cind = osgMin(State::SkipNumChunks, 
                                            pState->getMFChunks()->size());
    StateChunk               *c    = NULL;

    OSG_SKIP_IT(cIt, cind);

    for(; cIt != cEnd && cind < State::UpdateBelow; ++cIt, ++cind)
    {
        if(overIt != pOverride->end() && overIt->first == cind)
        {
            c = overIt->second;
            ++overIt;
        }
        else
        {
            c = *cIt;
        }

        if(c != NULL && c->getIgnore() == false)
        {
            c->changeFrom(this, c, UInt32(ind));
        }

        if(++ind >= StateChunkClass::getNumSlots(cind))
            ind = 0;
    }
#endif
}
Ejemplo n.º 6
0
void DrawEnv::update(State *pState)
{
#if 0
    MFUnrecStateChunkPtr::const_iterator cIt  = pState->getMFChunks()->begin();
    MFUnrecStateChunkPtr::const_iterator cEnd = pState->getMFChunks()->end  ();

    Int32                     ind  = 0;
    UInt32                    cind = osgMin(State::SkipNumChunks, 
                                            pState->getMFChunks()->size());

    OSG_SKIP_IT(cIt, cind);

    for(; cIt != cEnd && cind < State::UpdateBelow; ++cIt, ++cind)
    {
        if(*cIt != NULL && (*cIt)->getIgnore() == false)
        {
            (*cIt)->changeFrom(this, *cIt, UInt32(ind));
        }

        if(++ind >= StateChunkClass::getNumSlots(cind))
            ind = 0;
    }
#endif
}
Ejemplo n.º 7
0
void DrawEnv::changeTo(State         *pState,
                       StateOverride *pOverride,
                       State         *pOld,
                       StateOverride *pOldOverride)
{
    MFUnrecStateChunkPtr::const_iterator cIt  = pState->getMFChunks()->begin();
    MFUnrecStateChunkPtr::const_iterator cEnd = pState->getMFChunks()->end  (); 

    StateOverride::ChunkStoreIt          newOverIt = pOverride  ->begin();
    StateOverride::ChunkStoreIt          oldOverIt = pOldOverride->begin();

    Int32                     ind  = 0;
    UInt32                    i;
    SizeT                     cind = osgMin(State::SkipNumChunks, 
                                            pState->getMFChunks()->size());
    StateChunk               *n    = NULL;

    OSG_SKIP_IT(cIt, cind);

    for(; cIt != cEnd; ++cIt, ++cind)
    {
        StateChunk *o = pOld->getChunk(cind);
                    n = *cIt;

        if(oldOverIt != pOldOverride->end() && oldOverIt->first == cind)
        {
            o = oldOverIt->second;
            ++oldOverIt;
        }

        if(newOverIt != pOverride->end() && newOverIt->first == cind)
        {
            n = newOverIt->second;
            ++newOverIt;
        }

        if(n != NULL && n->getIgnore() == false)
        {
            if(o != NULL && o->getIgnore() == false)
            {
                n->changeFrom(this, o, UInt32(ind));
            }
            else
            {
                n->activate(this, UInt32(ind));
            }
        }
        else if(o != NULL && o->getIgnore() == false)
        {
            o->deactivate(this, UInt32(ind));
        }

        if(++ind >= StateChunkClass::getNumSlots(cind))
        {
            ind = 0;
        }
    }


    if(ind >= StateChunkClass::getNumSlots(cind))
        ind = 0;

    cind = osgMax(cind, State::SkipNumChunks);

    for(i = cind; i < pOld->getMFChunks()->size(); ++i)
    {
        StateChunk *o = pOld->getChunk(i);
        n = NULL;

        if(oldOverIt != pOldOverride->end() && oldOverIt->first == cind)
        {
            o = oldOverIt->second;
            ++oldOverIt;
        }

        if(newOverIt != pOverride->end() && newOverIt->first == cind)
        {
            n = newOverIt->second;
            ++newOverIt;
        }

        if(n != NULL && n->getIgnore() == false)
        {
            if(o != NULL && o->getIgnore() == false)
            {
                n->changeFrom(this, o, UInt32(ind));
            }
            else
            {
                n->activate(this, UInt32(ind));
            }
        }
        else if(o != NULL && o->getIgnore() == false)
        {
            o->deactivate(this, UInt32(ind));
        }

        if(++ind >= StateChunkClass::getNumSlots(i))
        {
            ind = 0;
        }
    }

    while(oldOverIt != pOldOverride->end())
    {
        n = NULL;

        if(newOverIt        != pOverride->end() &&
           newOverIt->first == oldOverIt->first  )
        {
            n = newOverIt->second;
            ++newOverIt;
        }

        if(n != NULL && n->getIgnore() == false)
        {
            if(oldOverIt->second->getIgnore() == false)
            {
                n->changeFrom(this,
                              oldOverIt->second,
                              UInt32(oldOverIt->first -
                                     oldOverIt->second->getClassId()));
            }
            else
            {
                n->activate(this,
                            UInt32(oldOverIt->first -
                                   oldOverIt->second->getClassId()));
            }
        }
        else if(oldOverIt->second->getIgnore() == false)
        {
            oldOverIt->second->deactivate(
                this,
                  UInt32(oldOverIt->first -
                         oldOverIt->second->getClassId()));
        }

        ++oldOverIt;
    }


    while(newOverIt != pOverride->end())
    {
        if(newOverIt->second->getIgnore() == false)
        {
            newOverIt->second->activate(this,
                                        UInt32(
                                            newOverIt->first -
                                            newOverIt->second->getClassId()));
        }

        ++newOverIt;
    }

    ++_uiNumStateChanges;
}
Ejemplo n.º 8
0
void DrawEnv::changeTo(State         *pState,
                       StateOverride *pOverride,
                       State         *pOld)
{
    MFUnrecStateChunkPtr::const_iterator cIt  = pState->getMFChunks()->begin();
    MFUnrecStateChunkPtr::const_iterator cEnd = pState->getMFChunks()->end  (); 

    StateOverride::ChunkStoreConstIt     overIt = pOverride->begin();

    Int32                     ind    = 0;
    UInt32                    i;
    UInt32                    cind   = osgMin(State::SkipNumChunks, 
                                              pState->getMFChunks()->size32());

    UInt32 const              climit = pState->getCoreGLChunkLimit();

    StateChunk               *n      = NULL;

    OSG_SKIP_IT(cIt, cind);

    for(; (cIt != cEnd) && (cind < climit); ++cIt, ++cind)
    {
        StateChunk *o = pOld->getChunk(cind);
                    n = *cIt;

        if(overIt != pOverride->end() && overIt->first == cind)
        {
            n = overIt->second;
            ++overIt;
        }

        if(n != NULL && n->getIgnore() == false)
        {
            if(o != NULL && o->getIgnore() == false)
            {
                n->changeFrom(this, o, UInt32(ind));
            }
            else
            {
                n->activate(this, UInt32(ind));
            }
        }
        else if(o != NULL && o->getIgnore() == false)
        {
            o->deactivate(this, UInt32(ind));
        }

        if(++ind >= StateChunkClass::getNumSlots(cind))
        {
            ind = 0;
        }
    }

    if(ind >= StateChunkClass::getNumSlots(cind))
        ind = 0;

    cind = osgMax(cind, State::SkipNumChunks);

    for(i = cind; (i < pOld->getMFChunks()->size32()) && (i < climit); ++i)
    {
        StateChunk *o = pOld->getChunk(i);

        n = NULL;

        if(overIt != pOverride->end() && overIt->first == cind)
        {
            n = overIt->second;
            ++overIt;
        }

        if(n != NULL && n->getIgnore() == false)
        {
            if(o != NULL && o->getIgnore() == false)
            {
                n->changeFrom(this, o, UInt32(ind));
            }
            else
            {
                n->activate(this, UInt32(ind));
            }
        }
        else if(o != NULL && o->getIgnore() == false)
        {
            o->deactivate(this, UInt32(ind));
        }

        if(++ind >= StateChunkClass::getNumSlots(i))
        {
            ind = 0;
        }
    }

    while(overIt != pOverride->end())
    {
        if(overIt->first >= climit)
            break;

        if(overIt->second->getIgnore() == false)
        {
            overIt->second->activate(this,
                                     UInt32(overIt->first -
                                            overIt->second->getClassId()));
        }

        ++overIt;
    }

    ++_uiNumStateChanges;
}