Added support for subsititing $VAR_NAME entries in shaders to enable writing shaders that work across GLSL versions.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace osg {
|
||||
|
||||
@@ -319,7 +320,9 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
|
||||
SHADER_GLES3
|
||||
};
|
||||
|
||||
void setShaderHint(ShaderHint hint) { _shaderHint = hint; }
|
||||
/** set the ShaderHint to tells shader generating cdoes version to create.
|
||||
* By default also OSG_GLSL_VERSION and OSG_PRECISION_FLOAT values that can get use directly in shaders using $OSG_GLSL_VERSION and $OSG_PRECISION_FLOAT respectively.*/
|
||||
void setShaderHint(ShaderHint hint, bool setShaderValues=true);
|
||||
ShaderHint getShaderHint() const { return _shaderHint; }
|
||||
|
||||
|
||||
@@ -358,6 +361,11 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
|
||||
/** helper function for computing the right eye view matrix.*/
|
||||
virtual osg::Matrixd computeRightEyeViewImplementation(const osg::Matrixd& view, double eyeSeperationScale=1.0) const;
|
||||
|
||||
|
||||
void setValue(const std::string& name, const std::string& value);
|
||||
|
||||
bool getValue(const std::string& name, std::string& value, bool use_getenv_fallback=true) const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~DisplaySettings();
|
||||
@@ -422,6 +430,11 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
|
||||
|
||||
OSXMenubarBehavior _OSXMenubarBehavior;
|
||||
|
||||
typedef std::map<std::string, std::string> ValueMap;
|
||||
|
||||
mutable OpenThreads::Mutex _valueMapMutex;
|
||||
mutable ValueMap _valueMap;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -823,9 +823,12 @@ class OSG_EXPORT State : public Referenced
|
||||
* during rendering. */
|
||||
inline void setDisplaySettings(DisplaySettings* vs) { _displaySettings = vs; }
|
||||
|
||||
/** Get the DisplaySettings */
|
||||
/** Get the const DisplaySettings */
|
||||
inline const DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); }
|
||||
|
||||
/** Get the const DisplaySettings that is current active DisplaySettings to be used by osg::State, - if DisplaySettings is not directly assigned then fallback to DisplaySettings::instance(). */
|
||||
inline const DisplaySettings* getActiveDisplaySettings() const { return _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance().get(); }
|
||||
|
||||
|
||||
|
||||
/** Set flag for early termination of the draw traversal.*/
|
||||
|
||||
Reference in New Issue
Block a user