Replaced deprecated osg::Shader::reaDShaderFile()/loadShaderFromSource() usage
This commit is contained in:
parent
5f13a3aa11
commit
284f91b3e0
@ -200,15 +200,10 @@ public:
|
|||||||
|
|
||||||
ComputeNode()
|
ComputeNode()
|
||||||
{
|
{
|
||||||
const char* envOsgFilePath = getenv("OSG_FILE_PATH");
|
_computeShaderSourcePath = "shaders/osgssboComputeShader.cs";
|
||||||
std::stringstream computeshaderpath; computeshaderpath << envOsgFilePath << "/shaders/osgssboComputeShader.cs";
|
_vertexShaderSourcePath = "shaders/osgssboVertexShader.vs";
|
||||||
_computeShaderSourcePath = computeshaderpath.str();
|
_geometryShaderSourcePath = "shaders/osgssboGeometryShader.gs";
|
||||||
std::stringstream vertexshaderpath; vertexshaderpath << envOsgFilePath << "/shaders/osgssboVertexShader.vs";
|
_fragmentShaderSourcePath = "shaders/osgssboFragmentShader.fs";
|
||||||
_vertexShaderSourcePath = vertexshaderpath.str();
|
|
||||||
std::stringstream geometryshaderpath; geometryshaderpath << envOsgFilePath << "/shaders/osgssboGeometryShader.gs";
|
|
||||||
_geometryShaderSourcePath = geometryshaderpath.str();
|
|
||||||
std::stringstream fragmentshaderpath; fragmentshaderpath << envOsgFilePath << "/shaders/osgssboFragmentShader.fs";
|
|
||||||
_fragmentShaderSourcePath = fragmentshaderpath.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -243,7 +238,7 @@ public:
|
|||||||
if (_computeNode->_computeShader.valid())
|
if (_computeNode->_computeShader.valid())
|
||||||
{
|
{
|
||||||
runningSource = _computeNode->_computeShader->getShaderSource();
|
runningSource = _computeNode->_computeShader->getShaderSource();
|
||||||
reloadedshader = osg::Shader::readShaderFile(osg::Shader::COMPUTE, _computeNode->_computeShaderSourcePath);
|
reloadedshader = osgDB::readRefShaderFile(osg::Shader::COMPUTE, _computeNode->_computeShaderSourcePath);
|
||||||
|
|
||||||
reloadedstring = reloadedshader->getShaderSource();
|
reloadedstring = reloadedshader->getShaderSource();
|
||||||
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
||||||
@ -258,7 +253,7 @@ public:
|
|||||||
{
|
{
|
||||||
|
|
||||||
runningSource = _computeNode->_vertexShader->getShaderSource();
|
runningSource = _computeNode->_vertexShader->getShaderSource();
|
||||||
reloadedshader = osg::Shader::readShaderFile(osg::Shader::VERTEX, _computeNode->_vertexShaderSourcePath);
|
reloadedshader = osgDB::readRefShaderFile(osg::Shader::VERTEX, _computeNode->_vertexShaderSourcePath);
|
||||||
|
|
||||||
reloadedstring = reloadedshader->getShaderSource();
|
reloadedstring = reloadedshader->getShaderSource();
|
||||||
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
||||||
@ -274,7 +269,7 @@ public:
|
|||||||
if (_computeNode->_geometryShader.valid())
|
if (_computeNode->_geometryShader.valid())
|
||||||
{
|
{
|
||||||
runningSource = _computeNode->_geometryShader->getShaderSource();
|
runningSource = _computeNode->_geometryShader->getShaderSource();
|
||||||
reloadedshader = osg::Shader::readShaderFile(osg::Shader::GEOMETRY, _computeNode->_geometryShaderSourcePath);
|
reloadedshader = osgDB::readRefShaderFile(osg::Shader::GEOMETRY, _computeNode->_geometryShaderSourcePath);
|
||||||
|
|
||||||
reloadedstring = reloadedshader->getShaderSource();
|
reloadedstring = reloadedshader->getShaderSource();
|
||||||
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
||||||
@ -288,7 +283,7 @@ public:
|
|||||||
if (_computeNode->_fragmentShader.valid())
|
if (_computeNode->_fragmentShader.valid())
|
||||||
{
|
{
|
||||||
runningSource = _computeNode->_fragmentShader->getShaderSource();
|
runningSource = _computeNode->_fragmentShader->getShaderSource();
|
||||||
reloadedshader = osg::Shader::readShaderFile(osg::Shader::FRAGMENT, _computeNode->_fragmentShaderSourcePath);
|
reloadedshader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, _computeNode->_fragmentShaderSourcePath);
|
||||||
|
|
||||||
reloadedstring = reloadedshader->getShaderSource();
|
reloadedstring = reloadedshader->getShaderSource();
|
||||||
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
||||||
@ -517,13 +512,13 @@ void ComputeNode::addComputationResultsRenderTree()
|
|||||||
|
|
||||||
_computationResultsRenderProgram = new osg::Program;
|
_computationResultsRenderProgram = new osg::Program;
|
||||||
|
|
||||||
_vertexShader = osg::Shader::readShaderFile(osg::Shader::VERTEX, _vertexShaderSourcePath);
|
_vertexShader = osgDB::readRefShaderFile(osg::Shader::VERTEX, _vertexShaderSourcePath);
|
||||||
_computationResultsRenderProgram->addShader(_vertexShader.get());
|
_computationResultsRenderProgram->addShader(_vertexShader.get());
|
||||||
|
|
||||||
_geometryShader = osg::Shader::readShaderFile(osg::Shader::GEOMETRY, _geometryShaderSourcePath);
|
_geometryShader = osgDB::readRefShaderFile(osg::Shader::GEOMETRY, _geometryShaderSourcePath);
|
||||||
_computationResultsRenderProgram->addShader(_geometryShader.get());
|
_computationResultsRenderProgram->addShader(_geometryShader.get());
|
||||||
|
|
||||||
_fragmentShader = osg::Shader::readShaderFile(osg::Shader::FRAGMENT, _fragmentShaderSourcePath);
|
_fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, _fragmentShaderSourcePath);
|
||||||
_computationResultsRenderProgram->addShader(_fragmentShader.get());
|
_computationResultsRenderProgram->addShader(_fragmentShader.get());
|
||||||
|
|
||||||
|
|
||||||
@ -628,7 +623,7 @@ void ComputeNode::initComputingSetup()
|
|||||||
|
|
||||||
_computeProgram = new osg::Program;
|
_computeProgram = new osg::Program;
|
||||||
_computeProgram->setComputeGroups((NUM_ELEMENTS_X / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_X / WORK_GROUP_SIZE), (NUM_ELEMENTS_Y / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_Y / WORK_GROUP_SIZE), 1);
|
_computeProgram->setComputeGroups((NUM_ELEMENTS_X / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_X / WORK_GROUP_SIZE), (NUM_ELEMENTS_Y / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_Y / WORK_GROUP_SIZE), 1);
|
||||||
_computeShader = osg::Shader::readShaderFile(osg::Shader::COMPUTE, _computeShaderSourcePath);
|
_computeShader = osgDB::readRefShaderFile(osg::Shader::COMPUTE, _computeShaderSourcePath);
|
||||||
_computeProgram->addShader(_computeShader.get());
|
_computeProgram->addShader(_computeShader.get());
|
||||||
|
|
||||||
setDataVariance(osg::Object::DYNAMIC);
|
setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
@ -87,7 +87,7 @@ struct MyRigTransformHardware : public osgAnimation::RigTransformHardware
|
|||||||
//set default source if _shader is not user setted
|
//set default source if _shader is not user setted
|
||||||
if (!vertexshader.valid())
|
if (!vertexshader.valid())
|
||||||
{
|
{
|
||||||
vertexshader = osg::Shader::readShaderFile(osg::Shader::VERTEX,"skinning.vert");
|
vertexshader = osgDB::readRefShaderFile(osg::Shader::VERTEX,"skinning.vert");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vertexshader.valid())
|
if (!vertexshader.valid())
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "GameOfLifePass.h"
|
#include "GameOfLifePass.h"
|
||||||
#include <osgDB/FileUtils>
|
#include <osgDB/FileUtils>
|
||||||
|
#include <osgDB/ReadFile>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
ProcessPass::ProcessPass(osg::TextureRectangle *in_tex,
|
ProcessPass::ProcessPass(osg::TextureRectangle *in_tex,
|
||||||
@ -110,16 +111,13 @@ void ProcessPass::setupCamera()
|
|||||||
|
|
||||||
void ProcessPass::setShader(std::string filename)
|
void ProcessPass::setShader(std::string filename)
|
||||||
{
|
{
|
||||||
std::string foundFile = osgDB::findDataFile(filename);
|
osg::ref_ptr<osg::Shader> fshader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, filename);
|
||||||
if (foundFile.empty())
|
if (!fshader)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Could not file shader file: "<<filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"Could not file shader file: "<<filename<<std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Shader> fshader = new osg::Shader( osg::Shader::FRAGMENT );
|
|
||||||
fshader->loadShaderSourceFromFile(foundFile);
|
|
||||||
|
|
||||||
_FragmentProgram = 0;
|
_FragmentProgram = 0;
|
||||||
_FragmentProgram = new osg::Program;
|
_FragmentProgram = new osg::Program;
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
#include <osg/Texture3D>
|
#include <osg/Texture3D>
|
||||||
#include <osgDB/ReadFile>
|
#include <osgDB/ReadFile>
|
||||||
#include <osgDB/FileUtils>
|
|
||||||
#include <osgUtil/Optimizer>
|
#include <osgUtil/Optimizer>
|
||||||
|
|
||||||
#include <osg/Program>
|
#include <osg/Program>
|
||||||
@ -141,10 +140,10 @@ ModelInstance()
|
|||||||
static void
|
static void
|
||||||
LoadShaderSource( osg::Shader* shader, const std::string& fileName )
|
LoadShaderSource( osg::Shader* shader, const std::string& fileName )
|
||||||
{
|
{
|
||||||
std::string fqFileName = osgDB::findDataFile(fileName);
|
osg::ref_ptr<osg::Shader> loaded_shader = osgDB::readRefShaderFile(fileName);
|
||||||
if( fqFileName.length() != 0 )
|
if (loaded_shader)
|
||||||
{
|
{
|
||||||
shader->loadShaderSourceFromFile( fqFileName.c_str() );
|
shader->setShaderSource( loaded_shader->getShaderSource() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "StereoMultipass.h"
|
#include "StereoMultipass.h"
|
||||||
#include <osgDB/FileUtils>
|
#include <osgDB/ReadFile>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
SubtractPass::SubtractPass(osg::TextureRectangle *left_tex,
|
SubtractPass::SubtractPass(osg::TextureRectangle *left_tex,
|
||||||
@ -132,8 +132,12 @@ void SubtractPass::createOutputTextures()
|
|||||||
|
|
||||||
void SubtractPass::setShader(std::string filename)
|
void SubtractPass::setShader(std::string filename)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Shader> fshader = new osg::Shader( osg::Shader::FRAGMENT );
|
osg::ref_ptr<osg::Shader> fshader = osgDB::readRefShaderFile( osg::Shader::FRAGMENT, filename);
|
||||||
fshader->loadShaderSourceFromFile(osgDB::findDataFile(filename));
|
if (!fshader)
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<"Warning: could not file shader file : "<<filename<<std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_FragmentProgram = 0;
|
_FragmentProgram = 0;
|
||||||
_FragmentProgram = new osg::Program;
|
_FragmentProgram = new osg::Program;
|
||||||
@ -259,8 +263,12 @@ void AggregatePass::setupCamera()
|
|||||||
|
|
||||||
void AggregatePass::setShader(std::string filename)
|
void AggregatePass::setShader(std::string filename)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Shader> fshader = new osg::Shader( osg::Shader::FRAGMENT );
|
osg::ref_ptr<osg::Shader> fshader = osgDB::readRefShaderFile( osg::Shader::FRAGMENT, filename);
|
||||||
fshader->loadShaderSourceFromFile(osgDB::findDataFile(filename));
|
if (!fshader)
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<"Warning: could not file shader file : "<<filename<<std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_FragmentProgram = 0;
|
_FragmentProgram = 0;
|
||||||
_FragmentProgram = new osg::Program;
|
_FragmentProgram = new osg::Program;
|
||||||
@ -375,8 +383,12 @@ void SelectPass::createOutputTextures()
|
|||||||
|
|
||||||
void SelectPass::setShader(std::string filename)
|
void SelectPass::setShader(std::string filename)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Shader> fshader = new osg::Shader( osg::Shader::FRAGMENT );
|
osg::ref_ptr<osg::Shader> fshader = osgDB::readRefShaderFile( osg::Shader::FRAGMENT, filename);
|
||||||
fshader->loadShaderSourceFromFile(osgDB::findDataFile(filename));
|
if (!fshader)
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<"Warning: could not file shader file : "<<filename<<std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_FragmentProgram = 0;
|
_FragmentProgram = 0;
|
||||||
_FragmentProgram = new osg::Program;
|
_FragmentProgram = new osg::Program;
|
||||||
@ -524,8 +536,12 @@ void StereoMultipass::createOutputTextures()
|
|||||||
|
|
||||||
void StereoMultipass::setShader(std::string filename)
|
void StereoMultipass::setShader(std::string filename)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Shader> fshader = new osg::Shader( osg::Shader::FRAGMENT );
|
osg::ref_ptr<osg::Shader> fshader = osgDB::readRefShaderFile( osg::Shader::FRAGMENT, filename);
|
||||||
fshader->loadShaderSourceFromFile(osgDB::findDataFile(filename));
|
if (!fshader)
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<"Warning: could not file shader file : "<<filename<<std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_FragmentProgram = 0;
|
_FragmentProgram = 0;
|
||||||
_FragmentProgram = new osg::Program;
|
_FragmentProgram = new osg::Program;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "StereoPass.h"
|
#include "StereoPass.h"
|
||||||
#include <osgDB/FileUtils>
|
#include <osgDB/ReadFile>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
StereoPass::StereoPass(osg::TextureRectangle *left_tex,
|
StereoPass::StereoPass(osg::TextureRectangle *left_tex,
|
||||||
@ -129,8 +129,12 @@ void StereoPass::createOutputTextures()
|
|||||||
|
|
||||||
void StereoPass::setShader(std::string filename)
|
void StereoPass::setShader(std::string filename)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Shader> fshader = new osg::Shader( osg::Shader::FRAGMENT );
|
osg::ref_ptr<osg::Shader> fshader = osgDB::readRefShaderFile( osg::Shader::FRAGMENT, filename);
|
||||||
fshader->loadShaderSourceFromFile(osgDB::findDataFile(filename));
|
if (!fshader)
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<"Warning: could not file shader file : "<<filename<<std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_FragmentProgram = 0;
|
_FragmentProgram = 0;
|
||||||
_FragmentProgram = new osg::Program;
|
_FragmentProgram = new osg::Program;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
|
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
|
||||||
// $Id: osgwidgetshader.cpp 28 2008-03-26 15:26:48Z cubicool $
|
// $Id: osgwidgetshader.cpp 28 2008-03-26 15:26:48Z cubicool $
|
||||||
|
|
||||||
#include <osgDB/FileUtils>
|
#include <osgDB/ReadFile>
|
||||||
#include <osgWidget/Util>
|
#include <osgWidget/Util>
|
||||||
#include <osgWidget/WindowManager>
|
#include <osgWidget/WindowManager>
|
||||||
#include <osgWidget/Canvas>
|
#include <osgWidget/Canvas>
|
||||||
@ -60,15 +60,9 @@ int main(int, char**)
|
|||||||
|
|
||||||
osg::Program* program = new osg::Program();
|
osg::Program* program = new osg::Program();
|
||||||
|
|
||||||
program->addShader(osg::Shader::readShaderFile(
|
|
||||||
osg::Shader::VERTEX,
|
|
||||||
osgDB::findDataFile("osgWidget/osgwidgetshader-vert.glsl")
|
|
||||||
));
|
|
||||||
|
|
||||||
program->addShader(osg::Shader::readShaderFile(
|
program->addShader(osgDB::readRefShaderFile( osg::Shader::VERTEX, "osgWidget/osgwidgetshader-vert.glsl" ) );
|
||||||
osg::Shader::FRAGMENT,
|
program->addShader(osgDB::readRefShaderFile( osg::Shader::FRAGMENT, "osgWidget/osgwidgetshader-frag.glsl" ) );
|
||||||
osgDB::findDataFile("osgWidget/osgwidgetshader-frag.glsl")
|
|
||||||
));
|
|
||||||
|
|
||||||
canvas->getGeode()->getOrCreateStateSet()->setAttribute(program);
|
canvas->getGeode()->getOrCreateStateSet()->setAttribute(program);
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <osgAnimation/MorphGeometry>
|
#include <osgAnimation/MorphGeometry>
|
||||||
#include <osgAnimation/BoneMapVisitor>
|
#include <osgAnimation/BoneMapVisitor>
|
||||||
#include <osg/TextureBuffer>
|
#include <osg/TextureBuffer>
|
||||||
|
#include <osgDB/ReadFile>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using namespace osgAnimation;
|
using namespace osgAnimation;
|
||||||
@ -137,10 +138,8 @@ bool MorphTransformHardware::init(MorphGeometry& morphGeometry)
|
|||||||
//set default source if _shader is not user setted
|
//set default source if _shader is not user setted
|
||||||
if (!vertexshader.valid())
|
if (!vertexshader.valid())
|
||||||
{
|
{
|
||||||
if (!_shader.valid())
|
if (!_shader.valid()) vertexshader = osgDB::readRefShaderFile(osg::Shader::VERTEX,"morphing.vert");
|
||||||
vertexshader = osg::Shader::readShaderFile(osg::Shader::VERTEX,"morphing.vert");
|
else vertexshader=_shader;
|
||||||
else
|
|
||||||
vertexshader=_shader;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vertexshader.valid())
|
if (!vertexshader.valid())
|
||||||
@ -157,7 +156,7 @@ bool MorphTransformHardware::init(MorphGeometry& morphGeometry)
|
|||||||
if (std::string::npos == start)
|
if (std::string::npos == start)
|
||||||
{
|
{
|
||||||
// perhaps remanance from previous init (if saved after init) so reload shader
|
// perhaps remanance from previous init (if saved after init) so reload shader
|
||||||
vertexshader = osg::Shader::readShaderFile(osg::Shader::VERTEX,"morphing.vert");
|
vertexshader = osgDB::readRefShaderFile(osg::Shader::VERTEX,"morphing.vert");
|
||||||
if (!vertexshader.valid())
|
if (!vertexshader.valid())
|
||||||
{
|
{
|
||||||
OSG_WARN << "RigTransformHardware can't load VertexShader" << std::endl;
|
OSG_WARN << "RigTransformHardware can't load VertexShader" << std::endl;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <osgAnimation/RigTransformHardware>
|
#include <osgAnimation/RigTransformHardware>
|
||||||
#include <osgAnimation/RigGeometry>
|
#include <osgAnimation/RigGeometry>
|
||||||
#include <osgAnimation/BoneMapVisitor>
|
#include <osgAnimation/BoneMapVisitor>
|
||||||
|
#include <osgDB/ReadFile>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using namespace osgAnimation;
|
using namespace osgAnimation;
|
||||||
@ -315,8 +316,7 @@ bool RigTransformHardware::init(RigGeometry& rig)
|
|||||||
//set default source if _shader is not user setted
|
//set default source if _shader is not user setted
|
||||||
if (!vertexshader.valid())
|
if (!vertexshader.valid())
|
||||||
{
|
{
|
||||||
if (!_shader.valid())
|
if (!_shader.valid()) vertexshader = osgDB::readRefShaderFile(osg::Shader::VERTEX,"skinning.vert");
|
||||||
vertexshader = osg::Shader::readShaderFile(osg::Shader::VERTEX,"skinning.vert");
|
|
||||||
else vertexshader = _shader;
|
else vertexshader = _shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <osg/io_utils>
|
#include <osg/io_utils>
|
||||||
|
|
||||||
#include <osgDB/FileUtils>
|
#include <osgDB/FileUtils>
|
||||||
|
#include <osgDB/ReadFile>
|
||||||
|
|
||||||
#include <osgUtil/CullVisitor>
|
#include <osgUtil/CullVisitor>
|
||||||
#include <osgSim/OverlayNode>
|
#include <osgSim/OverlayNode>
|
||||||
@ -1028,7 +1029,7 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv)
|
|||||||
std::string vertexShaderFile = osgDB::findDataFile("shaders/overlay_perspective_rtt.vert");
|
std::string vertexShaderFile = osgDB::findDataFile("shaders/overlay_perspective_rtt.vert");
|
||||||
if (!vertexShaderFile.empty())
|
if (!vertexShaderFile.empty())
|
||||||
{
|
{
|
||||||
program->addShader(osg::Shader::readShaderFile(osg::Shader::VERTEX, vertexShaderFile));
|
program->addShader(osgDB::readRefShaderFile(osg::Shader::VERTEX, vertexShaderFile));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1119,7 +1120,7 @@ OverlayNode::OverlayData* OverlayNode::getOverlayData(osgUtil::CullVisitor* cv)
|
|||||||
std::string fragmentShaderFile = osgDB::findDataFile("shaders/overlay_perspective_main.frag");
|
std::string fragmentShaderFile = osgDB::findDataFile("shaders/overlay_perspective_main.frag");
|
||||||
if (!fragmentShaderFile.empty())
|
if (!fragmentShaderFile.empty())
|
||||||
{
|
{
|
||||||
overlayData->_mainSubgraphProgram->addShader(osg::Shader::readShaderFile(osg::Shader::FRAGMENT, fragmentShaderFile));
|
overlayData->_mainSubgraphProgram->addShader(osgDB::readRefShaderFile(osg::Shader::FRAGMENT, fragmentShaderFile));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -47,10 +47,7 @@ bool Shader_readLocalData(Object& obj, Input& fr)
|
|||||||
{
|
{
|
||||||
|
|
||||||
osg::ref_ptr<Shader> s = osgDB::readRefShaderFile(fr[1].getStr(), fr.getOptions());
|
osg::ref_ptr<Shader> s = osgDB::readRefShaderFile(fr[1].getStr(), fr.getOptions());
|
||||||
if(s.get())
|
if(s.get()) shader.setShaderSource(s->getShaderSource());
|
||||||
shader.setShaderSource(s->getShaderSource());
|
|
||||||
else
|
|
||||||
shader.loadShaderSourceFromFile( osgDB::findDataFile(fr[1].getStr()) );
|
|
||||||
|
|
||||||
fr += 2;
|
fr += 2;
|
||||||
iteratorAdvanced = true;
|
iteratorAdvanced = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user