#include "EffectGeode.hxx"
#include <simgear/structure/SGAtomic.hxx>
+#include <simgear/structure/SGExpression.hxx>
#include <map>
#include <vector>
{
public:
META_Object(simgear,Technique);
- Technique();
+ Technique(bool alwaysValid = false);
Technique(const Technique& rhs,
const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
virtual ~Technique();
bool isCullingActive);
std::vector<osg::ref_ptr<Pass> > passes;
osg::StateSet* getShadowingStateSet() { return _shadowingStateSet.get(); }
+ const osg::StateSet* getShadowingStateSet() const
+ {
+ return _shadowingStateSet.get();
+ }
void setShadowingStateSet(osg::StateSet* ss) { _shadowingStateSet = ss; }
virtual void resizeGLObjectBuffers(unsigned int maxSize);
virtual void releaseGLObjects(osg::State* state = 0) const;
- // Initial validity testing. Either the minimum OpenGL version
- // must be supported, or the list of extensions must be supported.
- float getGLVersion() { return _glVersion; }
- void setGLVersion(float glVersion) { _glVersion = glVersion; }
- std::vector<std::string> glExtensions;
+ bool getAlwaysValid() const { return _alwaysValid; }
+ void setAlwaysValid(bool val) { _alwaysValid = val; }
+ void setValidExpression(SGExpressionb* exp,
+ const simgear::expression::BindingLayout&);
+ void setGLExtensionsPred(float glVersion,
+ const std::vector<std::string>& extensions);
+ void refreshValidity();
protected:
// Validity of technique in a graphics context.
struct ContextInfo : public osg::Referenced
ContextInfo(const ContextInfo& rhs) : valid(rhs.valid()) {}
ContextInfo& operator=(const ContextInfo& rhs)
{
- valid = rhs.valid();
+ valid = rhs.valid;
+ return *this;
}
Swappable<Status> valid;
};
typedef osg::buffered_object<ContextInfo> ContextMap;
mutable ContextMap _contextMap;
+ bool _alwaysValid;
osg::ref_ptr<osg::StateSet> _shadowingStateSet;
- float _glVersion;
+ SGSharedPtr<SGExpressionb> _validExpression;
+ int _contextIdLocation;
+};
+
+class TechniquePredParser : public expression::ExpressionParser
+{
+public:
+ void setTechnique(Technique* tniq) { _tniq = tniq; }
+ Technique* getTechnique() { return _tniq.get(); }
+// void setEffect(Effect* effect) { _effect = effect; }
+// Effect* getEffect() { return _effect.get(); }
+protected:
+ osg::ref_ptr<Technique> _tniq;
+ // osg::ref_ptr<Effect> _effect;
};
}
#endif