2 #include "Technique.hxx"
8 #include <boost/bind.hpp>
9 #include <boost/foreach.hpp>
11 #include <osg/Drawable>
12 #include <osg/RenderInfo>
13 #include <osg/StateSet>
15 #include <osgUtil/CullVisitor>
17 #include <simgear/structure/OSGUtils.hxx>
24 using namespace osgUtil;
26 Effect::Effect(const Effect& rhs, const CopyOp& copyop)
29 using namespace boost;
30 transform(rhs.techniques.begin(), rhs.techniques.end(),
31 backRefInsertIterator(techniques),
32 bind(simgear::clone_ref<Technique>, _1, copyop));
34 // There should always be a valid technique in an effect.
36 Technique* Effect::chooseTechnique(RenderInfo* info)
38 BOOST_FOREACH(ref_ptr<Technique>& technique, techniques)
40 if (technique->valid(info) == Technique::VALID)
41 return technique.get();
46 void Effect::resizeGLObjectBuffers(unsigned int maxSize)
48 BOOST_FOREACH(const ref_ptr<Technique>& technique, techniques)
50 technique->resizeGLObjectBuffers(maxSize);
54 void Effect::releaseGLObjects(osg::State* state) const
56 BOOST_FOREACH(const ref_ptr<Technique>& technique, techniques)
58 technique->releaseGLObjects(state);