X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscene%2Fmaterial%2FTechnique.hxx;h=b2ce020f07166d26f0d536fbff6c6f66c352f2f4;hb=0d419aba8a1ea9c67b1982f4d68fe1fe7bd79033;hp=8b18aeaccbfa8c684c6aee70a644498e9a68e948;hpb=d320a6facba71227454375c3dea80df330b31ca9;p=simgear.git diff --git a/simgear/scene/material/Technique.hxx b/simgear/scene/material/Technique.hxx index 8b18aeac..b2ce020f 100644 --- a/simgear/scene/material/Technique.hxx +++ b/simgear/scene/material/Technique.hxx @@ -20,6 +20,7 @@ #include "EffectGeode.hxx" #include +#include #include #include @@ -52,7 +53,7 @@ class Technique : public osg::Object { public: META_Object(simgear,Technique); - Technique(); + Technique(bool alwaysValid = false); Technique(const Technique& rhs, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); virtual ~Technique(); @@ -83,14 +84,20 @@ public: bool isCullingActive); std::vector > 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 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& extensions); + void refreshValidity(); protected: // Validity of technique in a graphics context. struct ContextInfo : public osg::Referenced @@ -99,14 +106,29 @@ protected: ContextInfo(const ContextInfo& rhs) : valid(rhs.valid()) {} ContextInfo& operator=(const ContextInfo& rhs) { - valid = rhs.valid(); + valid = rhs.valid; + return *this; } Swappable valid; }; typedef osg::buffered_object ContextMap; mutable ContextMap _contextMap; + bool _alwaysValid; osg::ref_ptr _shadowingStateSet; - float _glVersion; + SGSharedPtr _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 _tniq; + // osg::ref_ptr _effect; }; } #endif