Added osg:State:have_applied_mode(mode) and have_applied_attribute(type) to make it

easier to specify which modes and attributes have been modified without
the user requiring to know to what value, or to have an equivilant attribute
to pass to the have_applied_attribute method.  The original have_applied(mode)
and have_applied(attribute) methods have been renamed have_applied_mode(),
have_applied_attribute() as this was required to prevent the mode and type
values colliding during compile (it was causing a compile error when the method
names were the same.)
This commit is contained in:
Robert Osfield
2002-03-21 12:00:10 +00:00
parent b53b3038eb
commit a364875afb
3 changed files with 46 additions and 6 deletions

View File

@@ -512,7 +512,7 @@ void State::apply()
}
/** mode has been set externally, update state to reflect this setting.*/
void State::have_applied(const StateAttribute::GLMode mode,const StateAttribute::GLModeValue value)
void State::have_applied_mode(const StateAttribute::GLMode mode,const StateAttribute::GLModeValue value)
{
ModeStack& ms = _modeMap[mode];
@@ -522,8 +522,21 @@ void State::have_applied(const StateAttribute::GLMode mode,const StateAttribute:
ms.changed = true;
}
/** mode has been set externally, update state to reflect this setting.*/
void State::have_applied_mode(const StateAttribute::GLMode mode)
{
ModeStack& ms = _modeMap[mode];
// don't know what last applied value is can't apply it.
// assume that it has changed by toggle the value of last_applied_value.
ms.last_applied_value = !ms.last_applied_value;
// will need to disable this mode on next apply so set it to changed.
ms.changed = true;
}
/** attribute has been applied externally, update state to reflect this setting.*/
void State::have_applied(const StateAttribute* attribute)
void State::have_applied_attribute(const StateAttribute* attribute)
{
if (attribute)
{
@@ -536,3 +549,17 @@ void State::have_applied(const StateAttribute* attribute)
}
}
void State::have_applied_attribute(const StateAttribute::Type type)
{
AttributeMap::iterator itr = _attributeMap.find(type);
if (itr!=_attributeMap.end())
{
AttributeStack& as = itr->second;
as.last_applied_attribute = 0L;
// will need to update this attribute on next apply so set it to changed.
as.changed = true;
}
}