diff --git a/src/osgPlugins/osg/Shader.cpp b/src/osgPlugins/osg/Shader.cpp index fd7291396..11de40d97 100644 --- a/src/osgPlugins/osg/Shader.cpp +++ b/src/osgPlugins/osg/Shader.cpp @@ -1,10 +1,13 @@ #include "osg/Shader" +#include "osg/Notify" #include #include + #include "osgDB/Registry" #include "osgDB/Input" #include "osgDB/Output" +#include "osgDB/FileUtils" using namespace osg; using namespace osgDB; @@ -37,6 +40,22 @@ bool Shader_readLocalData(Object& obj, Input& fr) fr+=2; iteratorAdvanced = true; } + + if (fr.matchSequence("file %w") || fr.matchSequence("file %s") ) + { + std::string fileName = osgDB::findDataFile(fr[1].getStr()); + if (!fileName.empty()) + { + shader.loadShaderSourceFromFile( fileName.c_str() ); + } + else + { + osg::notify(osg::NOTICE)<<"Warning: could not find shader file \""<