Fixed build issues when compiling with OSG_PROVIDE_READFILE to OFF

This commit is contained in:
Robert Osfield 2017-11-27 11:05:31 +00:00
parent 93a5213b99
commit a72a929d12
3 changed files with 10 additions and 8 deletions

View File

@ -188,12 +188,12 @@ osg::ref_ptr<osg::Group> createSceneRoom()
{
// Room.
osg::ref_ptr<osg::MatrixTransform> room = new osg::MatrixTransform;
osg::ref_ptr<osg::Node> roomModel = osgDB::readNodeFile("simpleroom.osgt");
osg::ref_ptr<osg::Node> roomModel = osgDB::readRefNodeFile("simpleroom.osgt");
room->addChild(roomModel);
room->setMatrix(osg::Matrix::translate(0, 0, 1));
// Torus.
osg::ref_ptr<osg::MatrixTransform> torus = new osg::MatrixTransform;
osg::ref_ptr<osg::Node> torusModel = osgDB::readNodeFile("torus.osgt");
osg::ref_ptr<osg::Node> torusModel = osgDB::readRefNodeFile("torus.osgt");
torus->addChild(torusModel);
setAnimationPath(torus, osg::Vec3(0, 0, 15), 6, 16);
// Torus2.
@ -240,7 +240,7 @@ osg::Geode *createScreenQuad(float width,
osg::Texture2D *createTexture(const std::string &fileName)
{
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
texture->setImage(osgDB::readImageFile(fileName));
texture->setImage(osgDB::readRefImageFile(fileName));
texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::REPEAT);
texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::REPEAT);
texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
@ -292,8 +292,8 @@ osg::ref_ptr<osg::StateSet> setShaderProgram(osg::ref_ptr<osg::Camera> pass,
const std::string& frag)
{
osg::ref_ptr<osg::Program> program = new osg::Program;
program->addShader(osgDB::readShaderFile(vert));
program->addShader(osgDB::readShaderFile(frag));
program->addShader(osgDB::readRefShaderFile(vert));
program->addShader(osgDB::readRefShaderFile(frag));
osg::ref_ptr<osg::StateSet> ss = pass->getOrCreateStateSet();
ss->setAttributeAndModes(
program.get(),
@ -313,7 +313,7 @@ int main()
// Shadowed scene.
osg::ref_ptr<osgShadow::SoftShadowMap> shadowMap = new osgShadow::SoftShadowMap;
shadowMap->setJitteringScale(16);
shadowMap->addShader(osgDB::readShaderFile("shaders/pass1Shadow.frag"));
shadowMap->addShader(osgDB::readRefShaderFile("shaders/pass1Shadow.frag"));
shadowMap->setLight(light.get());
osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene = new osgShadow::ShadowedScene;
shadowedScene->setShadowTechnique(shadowMap.get());

View File

@ -250,7 +250,9 @@ int main(int argc, char** argv)
}
if (arguments.read("--add-axes"))
group->addChild(osgDB::readNodeFile("axes.osgt"));
{
group->addChild(osgDB::readRefNodeFile("axes.osgt"));
}
std::string mode;
if (arguments.read("--character-size-mode", mode))

View File

@ -140,7 +140,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc, argv);
// load the scene.
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
if (!loadedModel)
{
std::cout << argv[0] <<": No data loaded." << std::endl;