Added new getMember() method and TypeMemberPair into StateAttribute and

support for the unsigned int member to be paired with types in osg::StateSet
so that lights, clipplanes and other attributes that have a type group but
then need to differentiate within that group via a member uint.
This commit is contained in:
Robert Osfield
2004-10-13 11:15:50 +00:00
parent 4192ef796b
commit edb15e17bc
7 changed files with 116 additions and 95 deletions

View File

@@ -313,9 +313,9 @@ void State::haveAppliedAttribute(const StateAttribute* attribute)
haveAppliedAttribute(_attributeMap,attribute);
}
void State::haveAppliedAttribute(StateAttribute::Type type)
void State::haveAppliedAttribute(StateAttribute::Type type, unsigned int member)
{
haveAppliedAttribute(_attributeMap,type);
haveAppliedAttribute(_attributeMap,type,member);
}
bool State::getLastAppliedMode(StateAttribute::GLMode mode) const
@@ -323,9 +323,9 @@ bool State::getLastAppliedMode(StateAttribute::GLMode mode) const
return getLastAppliedMode(_modeMap,mode);
}
const StateAttribute* State::getLastAppliedAttribute(StateAttribute::Type type) const
const StateAttribute* State::getLastAppliedAttribute(StateAttribute::Type type, unsigned int member) const
{
return getLastAppliedAttribute(_attributeMap,type);
return getLastAppliedAttribute(_attributeMap,type,member);
}
@@ -344,9 +344,9 @@ void State::haveAppliedTextureAttribute(unsigned int unit,const StateAttribute*
haveAppliedAttribute(getOrCreateTextureAttributeMap(unit),attribute);
}
void State::haveAppliedTextureAttribute(unsigned int unit,StateAttribute::Type type)
void State::haveAppliedTextureAttribute(unsigned int unit,StateAttribute::Type type, unsigned int member)
{
haveAppliedAttribute(getOrCreateTextureAttributeMap(unit),type);
haveAppliedAttribute(getOrCreateTextureAttributeMap(unit),type,member);
}
bool State::getLastAppliedTextureMode(unsigned int unit,StateAttribute::GLMode mode) const
@@ -355,10 +355,10 @@ bool State::getLastAppliedTextureMode(unsigned int unit,StateAttribute::GLMode m
return getLastAppliedMode(_textureModeMapList[unit],mode);
}
const StateAttribute* State::getLastAppliedTextureAttribute(unsigned int unit,StateAttribute::Type type) const
const StateAttribute* State::getLastAppliedTextureAttribute(unsigned int unit,StateAttribute::Type type, unsigned int member) const
{
if (unit>=_textureAttributeMapList.size()) return false;
return getLastAppliedAttribute(_textureAttributeMapList[unit],type);
return getLastAppliedAttribute(_textureAttributeMapList[unit],type,member);
}
@@ -390,7 +390,7 @@ void State::haveAppliedAttribute(AttributeMap& attributeMap,const StateAttribute
{
if (attribute)
{
AttributeStack& as = attributeMap[attribute->getType()];
AttributeStack& as = attributeMap[attribute->getTypeMemberPair()];
as.last_applied_attribute = attribute;
@@ -399,10 +399,10 @@ void State::haveAppliedAttribute(AttributeMap& attributeMap,const StateAttribute
}
}
void State::haveAppliedAttribute(AttributeMap& attributeMap,StateAttribute::Type type)
void State::haveAppliedAttribute(AttributeMap& attributeMap,StateAttribute::Type type, unsigned int member)
{
AttributeMap::iterator itr = attributeMap.find(type);
AttributeMap::iterator itr = attributeMap.find(StateAttribute::TypeMemberPair(type,member));
if (itr!=attributeMap.end())
{
AttributeStack& as = itr->second;
@@ -427,9 +427,9 @@ bool State::getLastAppliedMode(const ModeMap& modeMap,StateAttribute::GLMode mod
}
}
const StateAttribute* State::getLastAppliedAttribute(const AttributeMap& attributeMap,StateAttribute::Type type) const
const StateAttribute* State::getLastAppliedAttribute(const AttributeMap& attributeMap,StateAttribute::Type type, unsigned int member) const
{
AttributeMap::const_iterator itr = attributeMap.find(type);
AttributeMap::const_iterator itr = attributeMap.find(StateAttribute::TypeMemberPair(type,member));
if (itr!=attributeMap.end())
{
const AttributeStack& as = itr->second;