From Cedric Pinson, "Here a patch to be able to clone stateattribute, in order to do that i

moved the StateAttribute::Callback structure to a file
StateAttributeCallback with the same behavior as NodeCallback.
"
This commit is contained in:
Robert Osfield
2009-10-22 10:33:16 +00:00
parent 8efd251b10
commit 2d38e187fd
10 changed files with 51 additions and 37 deletions

View File

@@ -122,13 +122,13 @@ bool UpdateTransform::link(osgAnimation::Channel* channel)
UpdateMaterial::UpdateMaterial(const UpdateMaterial& apc,const osg::CopyOp& copyop)
: osg::Object(apc, copyop),
AnimationUpdateCallback<osg::StateAttribute::Callback>(apc, copyop)
AnimationUpdateCallback<osg::StateAttributeCallback>(apc, copyop)
{
_diffuse = new osgAnimation::Vec4Target(apc._diffuse->getValue());
}
UpdateMaterial::UpdateMaterial(const std::string& name):
AnimationUpdateCallback<osg::StateAttribute::Callback>(name)
AnimationUpdateCallback<osg::StateAttributeCallback>(name)
{
_diffuse = new osgAnimation::Vec4Target(osg::Vec4(1,0,1,1));
}
@@ -144,6 +144,8 @@ void UpdateMaterial::operator()(osg::StateAttribute* sa, osg::NodeVisitor* nv)
}
}
osgAnimation::Vec4Target* UpdateMaterial::getDiffuse() { return _diffuse.get(); }
void UpdateMaterial::update(osg::Material& material)
{
osg::Vec4 diffuse = _diffuse->getValue();