141
141
rhs_uitr != rhs._uniformList.end();
144
const std::string& name = rhs_uitr->first;
145
const RefUniformPair& rup = rhs_uitr->second;
146
Uniform* uni = copyop(rup.first.get());
144
const std::string& name = rhs_uitr->first;
145
const RefUniformPair& rup = rhs_uitr->second;
146
Uniform* uni = copyop(rup.first.get());
149
149
_uniformList[name] = RefUniformPair(uni, rup.second);
150
150
uni->addParent(this);
607
607
ModeList::iterator lhs_mitr = _modeList.find(rhs_mitr->first);
608
608
if (lhs_mitr!=_modeList.end())
610
if (!(lhs_mitr->second & StateAttribute::OVERRIDE))
610
// take the rhs mode unless the lhs is override and the rhs is not protected
611
if (!(lhs_mitr->second & StateAttribute::OVERRIDE ) ||
612
(rhs_mitr->second & StateAttribute::PROTECTED))
612
// override isn't on in rhs, so overrite it with incomming
614
// override isn't on in rhs, so override it with incoming
614
616
lhs_mitr->second = rhs_mitr->second;
630
632
AttributeList::iterator lhs_aitr = _attributeList.find(rhs_aitr->first);
631
633
if (lhs_aitr!=_attributeList.end())
633
if (!(lhs_aitr->second.second & StateAttribute::OVERRIDE))
635
// take the rhs attribute unless the lhs is override and the rhs is not protected
636
if (!(lhs_aitr->second.second & StateAttribute::OVERRIDE) ||
637
(rhs_aitr->second.second & StateAttribute::PROTECTED))
635
// override isn't on in rhs, so overrite it with incomming
639
// override isn't on in rhs, so override it with incoming
637
641
if (lhs_aitr->second.first!=rhs_aitr->second.first)
639
643
// new attribute so need to remove self from outgoing attribute
640
644
lhs_aitr->second.first->removeParent(this);
642
// override isn't on in rhs, so overrite it with incomming
646
// override isn't on in rhs, so override it with incoming
644
648
lhs_aitr->second = rhs_aitr->second;
645
649
lhs_aitr->second.first->addParent(this);
675
679
ModeList::iterator lhs_mitr = lhs_modeList.find(rhs_mitr->first);
676
680
if (lhs_mitr!=lhs_modeList.end())
678
if (!(lhs_mitr->second & StateAttribute::OVERRIDE))
682
// take the rhs mode unless the lhs is override and the rhs is not protected
683
if (!(lhs_mitr->second & StateAttribute::OVERRIDE) ||
684
(rhs_mitr->second & StateAttribute::PROTECTED))
680
// override isn't on in rhs, so overrite it with incomming
686
// override isn't on in rhs, so override it with incoming
682
688
lhs_mitr->second = rhs_mitr->second;
705
711
AttributeList::iterator lhs_aitr = lhs_attributeList.find(rhs_aitr->first);
706
712
if (lhs_aitr!=lhs_attributeList.end())
708
if (!(lhs_aitr->second.second & StateAttribute::OVERRIDE))
714
// take the rhs attribute unless the lhs is override and the rhs is not protected
715
if (!(lhs_aitr->second.second & StateAttribute::OVERRIDE) ||
716
(rhs_aitr->second.second & StateAttribute::PROTECTED))
710
// override isn't on in rhs, so overrite it with incomming
718
// override isn't on in rhs, so override it with incoming
713
721
if (lhs_aitr->second.first!=rhs_aitr->second.first)
739
747
UniformList::iterator lhs_uitr = _uniformList.find(rhs_uitr->first);
740
748
if (lhs_uitr!=_uniformList.end())
742
if (!(lhs_uitr->second.second & StateAttribute::OVERRIDE))
750
// take the rhs uniform unless the lhs is override and the rhs is not protected
751
if (!(lhs_uitr->second.second & StateAttribute::OVERRIDE) ||
752
(rhs_uitr->second.second & StateAttribute::PROTECTED))
744
// override isn't on in rhs, so overrite it with incomming
754
// override isn't on in rhs, so override it with incoming
747
757
if (lhs_uitr->second.first!=rhs_uitr->second.first)
1461
1471
unsigned int _unit;
1474
class RemoveAssociateModesHelper : public StateAttribute::ModeUsage
1477
RemoveAssociateModesHelper(StateSet* stateset, unsigned int unit=0):
1478
_stateset(stateset),
1481
virtual ~RemoveAssociateModesHelper() {}
1483
virtual void usesMode(StateAttribute::GLMode mode)
1485
_stateset->removeMode(mode);
1488
virtual void usesTextureMode(StateAttribute::GLMode mode)
1490
_stateset->removeTextureMode(_unit, mode);
1495
StateSet* _stateset;
1464
1499
void StateSet::setAssociatedModes(const StateAttribute* attribute, StateAttribute::GLModeValue value)
1466
1501
SetAssociateModesHelper helper(this,value);
1467
1502
attribute->getModeUsage(helper);
1505
void StateSet::removeAssociatedModes(const StateAttribute* attribute)
1507
RemoveAssociateModesHelper helper(this);
1508
attribute->getModeUsage(helper);
1470
1511
void StateSet::setAssociatedTextureModes(unsigned int unit,const StateAttribute* attribute, StateAttribute::GLModeValue value)
1472
1513
SetAssociateModesHelper helper(this,value,unit);
1473
1514
attribute->getModeUsage(helper);
1517
void StateSet::removeAssociatedTextureModes(unsigned int unit,const StateAttribute* attribute)
1519
RemoveAssociateModesHelper helper(this,unit);
1520
attribute->getModeUsage(helper);
1476
1523
void StateSet::setAttribute(AttributeList& attributeList,StateAttribute *attribute, const StateAttribute::OverrideValue value)
1744
1791
// the number of callbacks has changed, need to pass this
1745
1792
// on to parents so they know whether app traversal is
1746
// reqired on this subgraph.
1793
// required on this subgraph.
1747
1794
for(ParentList::iterator itr =_parents.begin();
1748
1795
itr != _parents.end();
1789
1836
// the number of callbacks has changed, need to pass this
1790
1837
// on to parents so they know whether app traversal is
1791
// reqired on this subgraph.
1838
// required on this subgraph.
1792
1839
for(ParentList::iterator itr =_parents.begin();
1793
1840
itr != _parents.end();