From 8b30807ef11bfd4f6d6898d10b96804ef5c1eaf3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 19 Nov 2012 11:25:52 +0000 Subject: [PATCH] From Paul Martz, build fixes --- applications/present3D/present3D.cpp | 16 +++++++++++-- examples/osgframerenderer/EventProperty.cpp | 4 ++-- .../osgframerenderer/gscframerenderer.cpp | 8 +++---- .../osgmultiplemovies/osgmultiplemovies.cpp | 24 +++++++++---------- include/osg/ImageUtils | 2 +- src/osgPresentation/SlideShowConstructor.cpp | 2 +- 6 files changed, 34 insertions(+), 22 deletions(-) diff --git a/applications/present3D/present3D.cpp b/applications/present3D/present3D.cpp index 29c509342..738c998e3 100644 --- a/applications/present3D/present3D.cpp +++ b/applications/present3D/present3D.cpp @@ -428,11 +428,23 @@ int main( int argc, char **argv ) std::string device; while (arguments.read("--device", device)) { - osg::ref_ptr dev = osgDB::readFile(device); + osg::ref_ptr obj = osgDB::readObjectFile(device); + + osg::ref_ptr dev = dynamic_cast(obj.get()); if (dev.valid()) { + OSG_NOTICE<<"Adding Device : "<(obj.get()); + if (handler) + { + OSG_NOTICE<<"Adding Device event handler : "< device_options = new osgDB::Options("documentRegisteredHandlers"); - osg::ref_ptr rest_http_device = osgDB::readFile(server_address+":"+server_port+"/"+document_root+".resthttp", device_options); + osg::ref_ptr rest_http_device = osgDB::readFile(server_address+":"+server_port+"/"+document_root+".resthttp", device_options.get()); if (rest_http_device.valid()) { viewer.addDevice(rest_http_device.get()); diff --git a/examples/osgframerenderer/EventProperty.cpp b/examples/osgframerenderer/EventProperty.cpp index 5300d4a57..5130b8ec3 100644 --- a/examples/osgframerenderer/EventProperty.cpp +++ b/examples/osgframerenderer/EventProperty.cpp @@ -7,7 +7,7 @@ void EventProperty::update(osgViewer::View* view) { if (view && view->getEventQueue() && _event.valid()) { - view->getEventQueue()->addEvent(_event); + view->getEventQueue()->addEvent(_event.get()); } } @@ -38,4 +38,4 @@ namespace B } -} \ No newline at end of file +} diff --git a/examples/osgframerenderer/gscframerenderer.cpp b/examples/osgframerenderer/gscframerenderer.cpp index 4a03e2b73..85b3e4433 100644 --- a/examples/osgframerenderer/gscframerenderer.cpp +++ b/examples/osgframerenderer/gscframerenderer.cpp @@ -274,7 +274,7 @@ int main( int argc, char **argv ) viewer.getCamera()->setGraphicsContext(gc.get()); - viewer.getCamera()->setDisplaySettings(ds); + viewer.getCamera()->setDisplaySettings(ds.get()); osgViewer::GraphicsWindow* gw = dynamic_cast(gc.get()); if (gw) @@ -322,14 +322,14 @@ int main( int argc, char **argv ) ++itr, ++cameraNum) { osg::Camera* camera = *itr; - camera->setFinalDrawCallback(screenShot); + camera->setFinalDrawCallback(screenShot.get()); screenShot->_cameraNumMap[camera] = cameraNum; } } else if (cameras.size()==1) { osg::Camera* camera = cameras.front(); - camera->setFinalDrawCallback(screenShot); + camera->setFinalDrawCallback(screenShot.get()); } else { @@ -379,4 +379,4 @@ int main( int argc, char **argv ) osg::ref_ptr ss = dynamic_cast(object.get()); return 0; -} \ No newline at end of file +} diff --git a/examples/osgmultiplemovies/osgmultiplemovies.cpp b/examples/osgmultiplemovies/osgmultiplemovies.cpp index 4231bf75f..e1251cbfb 100644 --- a/examples/osgmultiplemovies/osgmultiplemovies.cpp +++ b/examples/osgmultiplemovies/osgmultiplemovies.cpp @@ -383,7 +383,7 @@ static osg::Node* readImageStream(const std::string& file_name, osg::Vec3& p, fl if (img_stream) { - tex = new osg::Texture2D(img_stream); + tex = new osg::Texture2D(img_stream.get()); tex->setResizeNonPowerOfTwoHint(false); } @@ -402,7 +402,7 @@ static osg::Node* readImageStream(const std::string& file_name, osg::Vec3& p, fl osgText::Text* text = new osgText::Text(); text->setFont("arial.ttf"); text->setDataVariance(osg::Object::DYNAMIC); - text->setUpdateCallback(new ImageStreamStateCallback(text, img)); + text->setUpdateCallback(new ImageStreamStateCallback(text, img.get())); text->setCharacterSize(24); text->setPosition(p + osg::Vec3(10,-10,10)); text->setAxisAlignment(osgText::TextBase::XZ_PLANE); @@ -424,7 +424,7 @@ static osg::Node* readImageStream(const std::string& file_name, osg::Vec3& p, fl geode->addDrawable(geo); - geo->getOrCreateStateSet()->setTextureAttributeAndModes(0, tex); + geo->getOrCreateStateSet()->setTextureAttributeAndModes(0, tex.get()); osg::Vec4Array* colors = new osg::Vec4Array(); colors->push_back(osg::Vec4(0.7, 0.7, 0.7, 1)); @@ -434,7 +434,7 @@ static osg::Node* readImageStream(const std::string& file_name, osg::Vec3& p, fl p[0] += w + 10; - img->addDimensionsChangedCallback(new MyDimensionsChangedCallback(tex, geo)); + img->addDimensionsChangedCallback(new MyDimensionsChangedCallback(tex.get(), geo)); return geode; } @@ -476,7 +476,7 @@ public: void apply(osg::StateSet* ss) { if (ss && ss->getTextureAttribute(0, osg::StateAttribute::TEXTURE)) - ss->setTextureAttribute(0, _tex); + ss->setTextureAttribute(0, _tex.get()); } private: osg::ref_ptr _tex; @@ -531,16 +531,16 @@ private: else if (_currentFile >= static_cast(_files.size())) _currentFile = 0; - osg::ref_ptr obj = osgDB::readRefObjectFile(_files[_currentFile], _options); + osg::ref_ptr obj = osgDB::readRefObjectFile(_files[_currentFile], _options.get()); osg::ref_ptr tex = dynamic_cast(obj.get()); if (!tex) { osg::ref_ptr stream = dynamic_cast(obj.get()); if (!stream) - stream = dynamic_cast(osgDB::readImageFile(_files[_currentFile], _options)); + stream = dynamic_cast(osgDB::readImageFile(_files[_currentFile], _options.get())); if (stream) { - tex = new osg::Texture2D(stream); + tex = new osg::Texture2D(stream.get()); tex->setResizeNonPowerOfTwoHint(false); } } @@ -548,7 +548,7 @@ private: osg::ref_ptr stream = dynamic_cast(tex->getImage(0)); if (stream) stream->play(); - ReplaceTextureVisitor v(tex); + ReplaceTextureVisitor v(tex.get()); _node->accept(v); } } @@ -643,9 +643,9 @@ int main(int argc, char** argv) if (slide_show) { - osg::Node* node = readImageStream(files[0], pos, desired_height, options); + osg::Node* node = readImageStream(files[0], pos, desired_height, options.get()); group->addChild(node); - movie_event_handler = new SlideShowEventHandler(node, files, options); + movie_event_handler = new SlideShowEventHandler(node, files, options.get()); } else { @@ -657,7 +657,7 @@ int main(int argc, char** argv) unsigned int num_videos = 0; for(osgDB::DirectoryContents::iterator i = files.begin(); (i != files.end()) && (num_videos < max_videos); ++i) { - osg::Node* node = readImageStream(*i, pos, desired_height, options); + osg::Node* node = readImageStream(*i, pos, desired_height, options.get()); if (node) group->addChild(node); diff --git a/include/osg/ImageUtils b/include/osg/ImageUtils index 2d1db317a..ba3ab70c6 100644 --- a/include/osg/ImageUtils +++ b/include/osg/ImageUtils @@ -171,7 +171,7 @@ enum ColorSpaceOperation }; /** Convert the RGBA values in a Image based on a ColorSpaceOperation defined scheme.*/ -extern osg::Image* colorSpaceConversion(ColorSpaceOperation op, osg::Image* image, const osg::Vec4& colour); +extern OSG_EXPORT osg::Image* colorSpaceConversion(ColorSpaceOperation op, osg::Image* image, const osg::Vec4& colour); } diff --git a/src/osgPresentation/SlideShowConstructor.cpp b/src/osgPresentation/SlideShowConstructor.cpp index 54cc4d949..eebcb47d0 100644 --- a/src/osgPresentation/SlideShowConstructor.cpp +++ b/src/osgPresentation/SlideShowConstructor.cpp @@ -887,7 +887,7 @@ osg::Geometry* SlideShowConstructor::createTexturedQuadGeometry(const osg::Vec3& stateset = pictureQuad->getOrCreateStateSet(); stateset->setTextureAttributeAndModes(0, - texture, + texture.get(), osg::StateAttribute::ON); }