Cleaned up the spacing and const of various method parameters.

Added non const versions of StateSet::getAttributePair() and getTextureAttributePair()
This commit is contained in:
Robert Osfield 2016-09-20 17:01:26 +01:00
parent 57f9257f32
commit b0df75e674
2 changed files with 57 additions and 25 deletions

View File

@ -191,6 +191,10 @@ class OSG_EXPORT StateSet : public Object
* Returns NULL if no type is contained within const StateSet.*/
const StateAttribute* getAttribute(StateAttribute::Type type, unsigned int member = 0) const;
/** Get specified RefAttributePair for specified type.
* Returns NULL if no type is contained within StateSet.*/
RefAttributePair* getAttributePair(StateAttribute::Type type, unsigned int member = 0);
/** Get specified RefAttributePair for specified type.
* Returns NULL if no type is contained within StateSet.*/
const RefAttributePair* getAttributePair(StateAttribute::Type type, unsigned int member = 0) const;
@ -258,15 +262,19 @@ class OSG_EXPORT StateSet : public Object
/** Get specified Texture related StateAttribute for specified type.
* Returns NULL if no type is contained within StateSet.*/
StateAttribute* getTextureAttribute(unsigned int unit,StateAttribute::Type type);
StateAttribute* getTextureAttribute(unsigned int unit, StateAttribute::Type type);
/** Get specified Texture related const StateAttribute for specified type.
* Returns NULL if no type is contained within const StateSet.*/
const StateAttribute* getTextureAttribute(unsigned int unit,StateAttribute::Type type) const;
const StateAttribute* getTextureAttribute(unsigned int unit, StateAttribute::Type type) const;
/** Get specified Texture related RefAttributePair for specified type.
* Returns NULL if no type is contained within StateSet.*/
const RefAttributePair* getTextureAttributePair(unsigned int unit,StateAttribute::Type type) const;
RefAttributePair* getTextureAttributePair(unsigned int unit, StateAttribute::Type type);
/** Get specified Texture related RefAttributePair for specified type.
* Returns NULL if no type is contained within StateSet.*/
const RefAttributePair* getTextureAttributePair(unsigned int unit, StateAttribute::Type type) const;
/** Set the list of all Texture related StateAttributes contained in this StateSet.*/
inline void setTextureAttributeList(TextureAttributeList& tal) { _textureAttributeList=tal; }
@ -284,8 +292,8 @@ class OSG_EXPORT StateSet : public Object
void setAssociatedModes(const StateAttribute* attribute, StateAttribute::GLModeValue value);
void removeAssociatedModes(const StateAttribute* attribute);
void setAssociatedTextureModes(unsigned int unit,const StateAttribute* attribute, StateAttribute::GLModeValue value);
void removeAssociatedTextureModes(unsigned int unit,const StateAttribute* attribute);
void setAssociatedTextureModes(unsigned int unit, const StateAttribute* attribute, StateAttribute::GLModeValue value);
void removeAssociatedTextureModes(unsigned int unit, const StateAttribute* attribute);
@ -548,19 +556,21 @@ class OSG_EXPORT StateSet : public Object
return _textureAttributeList[unit];
}
int compareModes(const ModeList& lhs,const ModeList& rhs);
int compareAttributePtrs(const AttributeList& lhs,const AttributeList& rhs);
int compareAttributeContents(const AttributeList& lhs,const AttributeList& rhs);
int compareModes(const ModeList& lhs, const ModeList& rhs);
int compareAttributePtrs(const AttributeList& lhs, const AttributeList& rhs);
int compareAttributeContents(const AttributeList& lhs, const AttributeList& rhs);
void setMode(ModeList& modeList,StateAttribute::GLMode mode, StateAttribute::GLModeValue value);
void setModeToInherit(ModeList& modeList,StateAttribute::GLMode mode);
StateAttribute::GLModeValue getMode(const ModeList& modeList,StateAttribute::GLMode mode) const;
void setModeToInherit(ModeList& modeList, StateAttribute::GLMode mode);
StateAttribute::GLModeValue getMode(const ModeList& modeList, StateAttribute::GLMode mode) const;
void setAttribute(AttributeList& attributeList,StateAttribute *attribute, const StateAttribute::OverrideValue value=StateAttribute::OFF);
void setAttribute(AttributeList& attributeList,StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF);
StateAttribute* getAttribute(AttributeList& attributeList,const StateAttribute::Type type, unsigned int member);
const StateAttribute* getAttribute(const AttributeList& attributeList,const StateAttribute::Type type, unsigned int member) const;
const RefAttributePair* getAttributePair(const AttributeList& attributeList,const StateAttribute::Type type, unsigned int member) const;
StateAttribute* getAttribute(AttributeList& attributeList, StateAttribute::Type type, unsigned int member);
const StateAttribute* getAttribute(const AttributeList& attributeList, StateAttribute::Type type, unsigned int member) const;
RefAttributePair* getAttributePair(AttributeList& attributeList, StateAttribute::Type type, unsigned int member);
const RefAttributePair* getAttributePair(const AttributeList& attributeList, StateAttribute::Type type, unsigned int member) const;
int _renderingHint;

View File

@ -1031,6 +1031,11 @@ const StateAttribute* StateSet::getAttribute(StateAttribute::Type type, unsigned
return getAttribute(_attributeList,type,member);
}
StateSet::RefAttributePair* StateSet::getAttributePair(StateAttribute::Type type, unsigned int member)
{
return getAttributePair(_attributeList,type,member);
}
const StateSet::RefAttributePair* StateSet::getAttributePair(StateAttribute::Type type, unsigned int member) const
{
return getAttributePair(_attributeList,type,member);
@ -1255,7 +1260,7 @@ StateAttribute::GLModeValue StateSet::getTextureMode(unsigned int unit,StateAttr
}
}
void StateSet::setTextureAttribute(unsigned int unit,StateAttribute *attribute, const StateAttribute::OverrideValue value)
void StateSet::setTextureAttribute(unsigned int unit,StateAttribute *attribute, StateAttribute::OverrideValue value)
{
if (attribute)
{
@ -1302,7 +1307,7 @@ void StateSet::setTextureAttributeAndModes(unsigned int unit,StateAttribute *att
}
void StateSet::removeTextureAttribute(unsigned int unit,StateAttribute::Type type)
void StateSet::removeTextureAttribute(unsigned int unit, StateAttribute::Type type)
{
if (unit>=_textureAttributeList.size()) return;
AttributeList& attributeList = _textureAttributeList[unit];
@ -1372,7 +1377,13 @@ const StateAttribute* StateSet::getTextureAttribute(unsigned int unit,StateAttri
}
const StateSet::RefAttributePair* StateSet::getTextureAttributePair(unsigned int unit,StateAttribute::Type type) const
StateSet::RefAttributePair* StateSet::getTextureAttributePair(unsigned int unit, StateAttribute::Type type)
{
if (unit>=_textureAttributeList.size()) return 0;
return getAttributePair(_textureAttributeList[unit],type,0);
}
const StateSet::RefAttributePair* StateSet::getTextureAttributePair(unsigned int unit, StateAttribute::Type type) const
{
if (unit>=_textureAttributeList.size()) return 0;
return getAttributePair(_textureAttributeList[unit],type,0);
@ -1552,7 +1563,7 @@ void StateSet::setMode(ModeList& modeList,StateAttribute::GLMode mode, StateAttr
else modeList[mode] = value;
}
void StateSet::setModeToInherit(ModeList& modeList,StateAttribute::GLMode mode)
void StateSet::setModeToInherit(ModeList& modeList, StateAttribute::GLMode mode)
{
ModeList::iterator itr = modeList.find(mode);
if (itr!=modeList.end())
@ -1561,7 +1572,7 @@ void StateSet::setModeToInherit(ModeList& modeList,StateAttribute::GLMode mode)
}
}
StateAttribute::GLModeValue StateSet::getMode(const ModeList& modeList,StateAttribute::GLMode mode) const
StateAttribute::GLModeValue StateSet::getMode(const ModeList& modeList, StateAttribute::GLMode mode) const
{
ModeList::const_iterator itr = modeList.find(mode);
if (itr!=modeList.end())
@ -1636,19 +1647,19 @@ void StateSet::removeAssociatedModes(const StateAttribute* attribute)
attribute->getModeUsage(helper);
}
void StateSet::setAssociatedTextureModes(unsigned int unit,const StateAttribute* attribute, StateAttribute::GLModeValue value)
void StateSet::setAssociatedTextureModes(unsigned int unit, const StateAttribute* attribute, StateAttribute::GLModeValue value)
{
SetAssociateModesHelper helper(this,value,unit);
attribute->getModeUsage(helper);
}
void StateSet::removeAssociatedTextureModes(unsigned int unit,const StateAttribute* attribute)
void StateSet::removeAssociatedTextureModes(unsigned int unit, const StateAttribute* attribute)
{
RemoveAssociateModesHelper helper(this,unit);
attribute->getModeUsage(helper);
}
void StateSet::setAttribute(AttributeList& attributeList,StateAttribute *attribute, const StateAttribute::OverrideValue value)
void StateSet::setAttribute(AttributeList& attributeList,StateAttribute *attribute, StateAttribute::OverrideValue value)
{
if (attribute)
{
@ -1707,7 +1718,7 @@ void StateSet::setAttribute(AttributeList& attributeList,StateAttribute *attribu
}
StateAttribute* StateSet::getAttribute(AttributeList& attributeList,StateAttribute::Type type, unsigned int member)
StateAttribute* StateSet::getAttribute(AttributeList& attributeList, StateAttribute::Type type, unsigned int member)
{
AttributeList::iterator itr = attributeList.find(StateAttribute::TypeMemberPair(type,member));
if (itr!=attributeList.end())
@ -1718,7 +1729,7 @@ StateAttribute* StateSet::getAttribute(AttributeList& attributeList,StateAttribu
return NULL;
}
const StateAttribute* StateSet::getAttribute(const AttributeList& attributeList,StateAttribute::Type type, unsigned int member) const
const StateAttribute* StateSet::getAttribute(const AttributeList& attributeList, StateAttribute::Type type, unsigned int member) const
{
AttributeList::const_iterator itr = attributeList.find(StateAttribute::TypeMemberPair(type,member));
if (itr!=attributeList.end())
@ -1729,7 +1740,18 @@ const StateAttribute* StateSet::getAttribute(const AttributeList& attributeList,
return NULL;
}
const StateSet::RefAttributePair* StateSet::getAttributePair(const AttributeList& attributeList,StateAttribute::Type type, unsigned int member) const
StateSet::RefAttributePair* StateSet::getAttributePair(AttributeList& attributeList, StateAttribute::Type type, unsigned int member)
{
AttributeList::iterator itr = attributeList.find(StateAttribute::TypeMemberPair(type,member));
if (itr!=attributeList.end())
{
return &(itr->second);
}
else
return NULL;
}
const StateSet::RefAttributePair* StateSet::getAttributePair(const AttributeList& attributeList, StateAttribute::Type type, unsigned int member) const
{
AttributeList::const_iterator itr = attributeList.find(StateAttribute::TypeMemberPair(type,member));
if (itr!=attributeList.end())