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

@@ -101,12 +101,14 @@ class SG_EXPORT StateSet : public Object
/** Simple pairing between an attribute and its override flag.*/
typedef std::pair<ref_ptr<StateAttribute>,StateAttribute::OverrideValue> RefAttributePair;
/** a container to map StateAttribyte::Types to their respective RefAttributePair.*/
typedef std::map<StateAttribute::Type,RefAttributePair> AttributeList;
typedef std::pair<ref_ptr<StateAttribute>,StateAttribute::OverrideValue> RefAttributePair;
/** a container to map <StateAttribyte::Types,Member> to their respective RefAttributePair.*/
typedef std::map<StateAttribute::TypeMemberPair,RefAttributePair> AttributeList;
/** Set this StateSet to contain specified attribute and override flag.*/
void setAttribute(StateAttribute *attribute, StateAttribute::OverrideValue value=StateAttribute::OFF);
/** Set this StateSet to contain specified attribute and set the associated GLMode's to specified value.*/
void setAttributeAndModes(StateAttribute *attribute, StateAttribute::GLModeValue value=StateAttribute::ON);
@@ -116,22 +118,22 @@ class SG_EXPORT StateSet : public Object
void setAttributeToInherit(StateAttribute::Type type) { removeAttribute(type); }
#endif
/** remove attribute of specified type from StateSet.*/
void removeAttribute(StateAttribute::Type type);
void removeAttribute(StateAttribute::Type type, unsigned int member=0);
/** remove attribute from StateSet.*/
void removeAttribute(StateAttribute *attribute);
/** Get specified StateAttribute for specified type.
* Returns NULL if no type is contained within StateSet.*/
StateAttribute* getAttribute(StateAttribute::Type type);
StateAttribute* getAttribute(StateAttribute::Type type, unsigned int member = 0);
/** Get specified const StateAttribute for specified type.
* Returns NULL if no type is contained within const StateSet.*/
const StateAttribute* getAttribute(StateAttribute::Type type) const;
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.*/
const RefAttributePair* getAttributePair(StateAttribute::Type type) const;
const RefAttributePair* getAttributePair(StateAttribute::Type type, unsigned int member = 0) const;
/** return the list of all StateAttributes contained in this StateSet.*/
inline AttributeList& getAttributeList() { return _attributeList; }
@@ -292,9 +294,9 @@ class SG_EXPORT StateSet : public Object
void setAttribute(AttributeList& attributeList,StateAttribute *attribute, const StateAttribute::OverrideValue value=StateAttribute::OFF);
StateAttribute* getAttribute(AttributeList& attributeList,const StateAttribute::Type type);
const StateAttribute* getAttribute(const AttributeList& attributeList,const StateAttribute::Type type) const;
const RefAttributePair* getAttributePair(const AttributeList& attributeList,const StateAttribute::Type type) const;
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;
int _renderingHint;