Skip to content

Commit

Permalink
From Paul Martz, build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
robertosfield committed Nov 19, 2012
1 parent a558dc1 commit 42c492a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 22 deletions.
16 changes: 14 additions & 2 deletions applications/present3D/present3D.cpp
Expand Up @@ -428,11 +428,23 @@ int main( int argc, char **argv )
std::string device;
while (arguments.read("--device", device))
{
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device);
osg::ref_ptr<osg::Object> obj = osgDB::readObjectFile(device);

osg::ref_ptr<osgGA::Device> dev = dynamic_cast<osgGA::Device*>(obj.get());
if (dev.valid())
{
OSG_NOTICE<<"Adding Device : "<<device<<std::endl;
viewer.addDevice(dev.get());
}
else
{
osgGA::GUIEventHandler* handler = dynamic_cast<osgGA::GUIEventHandler*>(obj.get());
if (handler)
{
OSG_NOTICE<<"Adding Device event handler : "<<device<<std::endl;
viewer.getEventHandlers().push_front(handler);
}
}
}

if (arguments.read("--http-control"))
Expand All @@ -448,7 +460,7 @@ int main( int argc, char **argv )

osg::ref_ptr<osgDB::Options> device_options = new osgDB::Options("documentRegisteredHandlers");

osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options);
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options.get());
if (rest_http_device.valid())
{
viewer.addDevice(rest_http_device.get());
Expand Down
4 changes: 2 additions & 2 deletions examples/osgframerenderer/EventProperty.cpp
Expand Up @@ -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());
}
}

Expand Down Expand Up @@ -38,4 +38,4 @@ namespace B

}

}
}
8 changes: 4 additions & 4 deletions examples/osgframerenderer/gscframerenderer.cpp
Expand Up @@ -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<osgViewer::GraphicsWindow*>(gc.get());
if (gw)
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -379,4 +379,4 @@ int main( int argc, char **argv )
osg::ref_ptr<osgGA::StateSetManipulator> ss = dynamic_cast<osgGA::StateSetManipulator*>(object.get());

return 0;
}
}
24 changes: 12 additions & 12 deletions examples/osgmultiplemovies/osgmultiplemovies.cpp
Expand Up @@ -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);

}
Expand All @@ -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);
Expand All @@ -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));
Expand All @@ -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;
}
Expand Down Expand Up @@ -476,7 +476,7 @@ class ReplaceTextureVisitor : public osg::NodeVisitor {
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<osg::Texture> _tex;
Expand Down Expand Up @@ -531,24 +531,24 @@ class SlideShowEventHandler : public osgGA::GUIEventHandler {
else if (_currentFile >= static_cast<int>(_files.size()))
_currentFile = 0;

osg::ref_ptr<osg::Object> obj = osgDB::readRefObjectFile(_files[_currentFile], _options);
osg::ref_ptr<osg::Object> obj = osgDB::readRefObjectFile(_files[_currentFile], _options.get());
osg::ref_ptr<osg::Texture> tex = dynamic_cast<osg::Texture*>(obj.get());
if (!tex) {
osg::ref_ptr<osg::ImageStream> stream = dynamic_cast<osg::ImageStream*>(obj.get());
if (!stream)
stream = dynamic_cast<osg::ImageStream*>(osgDB::readImageFile(_files[_currentFile], _options));
stream = dynamic_cast<osg::ImageStream*>(osgDB::readImageFile(_files[_currentFile], _options.get()));

if (stream)
{
tex = new osg::Texture2D(stream);
tex = new osg::Texture2D(stream.get());
tex->setResizeNonPowerOfTwoHint(false);
}
}
if (tex) {
osg::ref_ptr<osg::ImageStream> stream = dynamic_cast<osg::ImageStream*>(tex->getImage(0));
if (stream)
stream->play();
ReplaceTextureVisitor v(tex);
ReplaceTextureVisitor v(tex.get());
_node->accept(v);
}
}
Expand Down Expand Up @@ -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
{
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion include/osg/ImageUtils
Expand Up @@ -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);


}
Expand Down
2 changes: 1 addition & 1 deletion src/osgPresentation/SlideShowConstructor.cpp
Expand Up @@ -887,7 +887,7 @@ osg::Geometry* SlideShowConstructor::createTexturedQuadGeometry(const osg::Vec3&

stateset = pictureQuad->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(0,
texture,
texture.get(),
osg::StateAttribute::ON);
}

Expand Down

0 comments on commit 42c492a

Please sign in to comment.