Replaced readShaderFile() usage to readRefShaderFile()
This commit is contained in:
parent
4fcf8d3e86
commit
477951b924
@ -51,7 +51,7 @@ inline T* readFile(const std::string& filename, const Options* options)
|
||||
{
|
||||
osg::ref_ptr<osg::Object> object = readObjectFile(filename, options);
|
||||
osg::ref_ptr<T> t = dynamic_cast<T*>(object.get());
|
||||
object = 0;
|
||||
object = 0;
|
||||
return t.release();
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ inline osg::ref_ptr<osg::Node> readRefNodeFile(const std::string& filename)
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
* for the filename extension, and this plugin then handles the request
|
||||
* to read the specified file.*/
|
||||
extern OSGDB_EXPORT osg::ref_ptr<osg::Shader> readRefShaderFile(const std::string& filename,const Options* options);
|
||||
extern OSGDB_EXPORT osg::ref_ptr<osg::Shader> readRefShaderFile(const std::string& filename,const Options* options);
|
||||
|
||||
/** Read an osg::Shader from file.
|
||||
* Return an assigned osg::ref_ptr on success,
|
||||
@ -291,7 +291,32 @@ extern OSGDB_EXPORT osg::ref_ptr<osg::Shader> readRefShaderFile(const std::stri
|
||||
* to read the specified file.*/
|
||||
inline osg::ref_ptr<osg::Shader> readRefShaderFile(const std::string& filename)
|
||||
{
|
||||
return readRefShaderFile(filename,Registry::instance()->getOptions());
|
||||
return readRefShaderFile(filename, Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
/** Read an osg::Shader from file and set to specified shader type.
|
||||
* Return valid osg::Shader on success,
|
||||
* return NULL on failure.
|
||||
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
* for the filename extension, and this plugin then handles the request
|
||||
* to read the specified file.*/
|
||||
inline osg::ref_ptr<osg::Shader> readRefShaderFile(osg::Shader::Type type, const std::string& filename, const Options* options)
|
||||
{
|
||||
osg::ref_ptr<osg::Shader> shader = readShaderFile(filename, options);
|
||||
if (shader.valid() && type != osg::Shader::UNDEFINED) shader->setType(type);
|
||||
return shader;
|
||||
}
|
||||
|
||||
/** Read an osg::Shader from file and set to specified shader type
|
||||
* Return valid osg::Shader on success,
|
||||
* return NULL on failure.
|
||||
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
|
||||
* for the filename extension, and this plugin then handles the request
|
||||
* to read the specified file.*/
|
||||
inline osg::ref_ptr<osg::Shader> readRefShaderFile(osg::Shader::Type type, const std::string& filename)
|
||||
{
|
||||
return readRefShaderFile(type, filename, Registry::instance()->getOptions());
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,8 +205,8 @@ void RayTracedTechnique::init()
|
||||
|
||||
// get shaders from source
|
||||
|
||||
osg::Shader* vertexShader = osgDB::readShaderFile(osg::Shader::VERTEX, "shaders/volume.vert");
|
||||
if (vertexShader)
|
||||
osg::ref_ptr<osg::Shader> vertexShader = osgDB::readRefShaderFile(osg::Shader::VERTEX, "shaders/volume.vert");
|
||||
if (vertexShader.valid())
|
||||
{
|
||||
program->addShader(vertexShader);
|
||||
}
|
||||
@ -287,10 +287,10 @@ void RayTracedTechnique::init()
|
||||
|
||||
if (tf)
|
||||
{
|
||||
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_tf_mip.frag");
|
||||
if (fragmentShader)
|
||||
osg::ref_ptr<osg::Shader> fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, "shaders/volume_tf_mip.frag");
|
||||
if (fragmentShader.valid())
|
||||
{
|
||||
program->addShader(fragmentShader);
|
||||
program->addShader(fragmentShader.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -304,10 +304,10 @@ void RayTracedTechnique::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_mip.frag");
|
||||
if (fragmentShader)
|
||||
osg::ref_ptr<osg::Shader> fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, "shaders/volume_mip.frag");
|
||||
if (fragmentShader.valid())
|
||||
{
|
||||
program->addShader(fragmentShader);
|
||||
program->addShader(fragmentShader.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -325,8 +325,8 @@ void RayTracedTechnique::init()
|
||||
|
||||
if (tf)
|
||||
{
|
||||
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_tf_iso.frag");
|
||||
if (fragmentShader)
|
||||
osg::ref_ptr<osg::Shader> fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, "shaders/volume_tf_iso.frag");
|
||||
if (fragmentShader.valid())
|
||||
{
|
||||
program->addShader(fragmentShader);
|
||||
}
|
||||
@ -338,8 +338,8 @@ void RayTracedTechnique::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_iso.frag");
|
||||
if (fragmentShader)
|
||||
osg::ref_ptr<osg::Shader> fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, "shaders/volume_iso.frag");
|
||||
if (fragmentShader.valid())
|
||||
{
|
||||
OSG_INFO<<"Shader found"<<std::endl;
|
||||
|
||||
@ -360,8 +360,8 @@ void RayTracedTechnique::init()
|
||||
|
||||
if (tf)
|
||||
{
|
||||
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_lit_tf.frag");
|
||||
if (fragmentShader)
|
||||
osg::ref_ptr<osg::Shader> fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, "shaders/volume_lit_tf.frag");
|
||||
if (fragmentShader.valid())
|
||||
{
|
||||
program->addShader(fragmentShader);
|
||||
}
|
||||
@ -374,8 +374,8 @@ void RayTracedTechnique::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_lit.frag");
|
||||
if (fragmentShader)
|
||||
osg::ref_ptr<osg::Shader> fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, "shaders/volume_lit.frag");
|
||||
if (fragmentShader.valid())
|
||||
{
|
||||
program->addShader(fragmentShader);
|
||||
}
|
||||
@ -392,8 +392,8 @@ void RayTracedTechnique::init()
|
||||
|
||||
if (tf)
|
||||
{
|
||||
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume_tf.frag");
|
||||
if (fragmentShader)
|
||||
osg::ref_ptr<osg::Shader> fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, "shaders/volume_tf.frag");
|
||||
if (fragmentShader.valid())
|
||||
{
|
||||
program->addShader(fragmentShader);
|
||||
}
|
||||
@ -406,8 +406,8 @@ void RayTracedTechnique::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume.frag");
|
||||
if (fragmentShader)
|
||||
osg::ref_ptr<osg::Shader> fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, "shaders/volume.frag");
|
||||
if (fragmentShader.valid())
|
||||
{
|
||||
program->addShader(fragmentShader);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user