void ShaderProgramVariableChunk::changed(ConstFieldMaskArg whichField, 
                                         UInt32            origin,
                                         BitVector         details)
{
    if(0x0000 != (whichField & VariablesFieldMask))
    {
        ShaderProgramVariables *pVars = _sfVariables.getValue();

        if(pVars != NULL)
        {
            if(details == 0x0001)
            {
                MFParentFieldContainerPtr::const_iterator parentsIt  = 
                    this->_mfParents.begin();
        
                MFParentFieldContainerPtr::const_iterator parentsEnd = 
                    this->_mfParents.end();
            
                for(; parentsIt != parentsEnd; ++parentsIt)
                {
                    (*parentsIt)->changed(
                        TypeTraits<BitVector>::One << 
                                               parentsIt.getParentFieldPos(),
                        ChangedOrigin::Child,
                        VariablesFieldMask);
                
                }
            }
        }
    }

    Inherited::changed(whichField, origin, details);
}
Пример #2
0
void ShaderProgram::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    if(0x0000 != (whichField & VariablesFieldMask))
    {
        if(details ==  0x0001)
        {
            MFParentFieldContainerPtr::const_iterator parentsIt  = 
                this->_mfParents.begin();
        
            MFParentFieldContainerPtr::const_iterator parentsEnd = 
                this->_mfParents.end();
            
            while(parentsIt != parentsEnd)
            {
                (*parentsIt)->changed(
                    TypeTraits<BitVector>::One << parentsIt.getParentFieldPos(),
                    ChangedOrigin::Child,
                    VariablesFieldMask);
                
                ++parentsIt;
            }
        }
    }

    if(0x0000 != (whichField & ProgramFieldMask))
    {
        MFParentFieldContainerPtr::const_iterator parentsIt  = 
            this->_mfParents.begin();
        
        MFParentFieldContainerPtr::const_iterator parentsEnd = 
            this->_mfParents.end();
        
        while(parentsIt != parentsEnd)
        {
            (*parentsIt)->changed(
                TypeTraits<BitVector>::One << parentsIt.getParentFieldPos(),
                ChangedOrigin::Child,
                ProgramFieldMask);
            
            ++parentsIt;
        }


        Window::reinitializeGLObject(this->getGLId());
    }
}
void ShaderParameter::changed(ConstFieldMaskArg whichField, 
                              UInt32            origin,
                              BitVector         details)
{
    const ShaderParameter *pThis = this;

    MFParentFieldContainerPtr::const_iterator parentsIt  = 
        pThis->_mfParents.begin();

    MFParentFieldContainerPtr::const_iterator parentsEnd = 
        pThis->_mfParents.end();
    
    while(parentsIt != parentsEnd)
    {
        (*parentsIt)->changed(
            TypeTraits<BitVector>::One << parentsIt.getParentFieldPos(),
            ChangedOrigin::Child,
            0);
        
        ++parentsIt;
    }

    Inherited::changed(whichField, origin, details);
}
void ShaderProgramVariables::changed(ConstFieldMaskArg whichField, 
                                     UInt32            origin,
                                     BitVector         details)
{
    if(0x0000 != (whichField & VariablesFieldMask))
    {
        BitVector d;

        if(origin != ChangedOrigin::Child)
        {
            d = 0x0001;
        }
        else
        {
            d = 0x0002;

            OSG_ASSERT(details < _mfVariableChanged.size());

            editVariableChanged(details) = true;
        }

        MFParentFieldContainerPtr::const_iterator parentsIt  = 
            this->_mfParents.begin();
        
        MFParentFieldContainerPtr::const_iterator parentsEnd = 
            this->_mfParents.end();
        
        while(parentsIt != parentsEnd)
        {
            (*parentsIt)->changed(
                TypeTraits<BitVector>::One << parentsIt.getParentFieldPos(),
                ChangedOrigin::Child,
                d);
            
            ++parentsIt;
        }
    }

    if(0x0000 != (whichField & ProceduralVariablesFieldMask))
    {
        BitVector d;

        if(origin != ChangedOrigin::Child)
        {
            d = 0x0001;
        }
        else
        {
            d = 0x0002;
        }

        MFParentFieldContainerPtr::const_iterator parentsIt  = 
            this->_mfParents.begin();
        
        MFParentFieldContainerPtr::const_iterator parentsEnd = 
            this->_mfParents.end();
        
        while(parentsIt != parentsEnd)
        {
            (*parentsIt)->changed(
                TypeTraits<BitVector>::One << parentsIt.getParentFieldPos(),
                ChangedOrigin::Child,
                d);
                
            ++parentsIt;
        }
    }

    Inherited::changed(whichField, origin, details);
}