Warning fixes

This commit is contained in:
Robert Osfield 2009-05-03 18:51:13 +00:00
parent cd5fa24696
commit 602d83a486
5 changed files with 61 additions and 25 deletions

View File

@ -214,7 +214,7 @@ void DataConverter::read(CameraPacket& cameraPacket)
_swapBytes = !_swapBytes;
}
cameraPacket._masterKilled = bool(readUInt());
cameraPacket._masterKilled = readUInt()!=0;
read(cameraPacket._matrix);
read(cameraPacket._frameStamp);
@ -355,8 +355,8 @@ void Receiver::sync( void )
// saddr.sin_port = htons( _port );
recvfrom( _so, (char *)_buffer, _buffer_size, 0, (sockaddr*)&saddr, &size );
// recvfrom(sock_Receive, szMessage, 256, 0, (sockaddr*)&addr_Cli, &clilen)
int err = WSAGetLastError ();
int *dum = (int*) _buffer;
//int err = WSAGetLastError ();
//int *dum = (int*) _buffer;
while( select( _so+1, &fdset, 0L, 0L, &tv ) )
{

View File

@ -656,7 +656,7 @@ SlideEventHandler::SlideEventHandler(osgViewer::Viewer* viewer):
_updateOpacityActive(false),
_previousX(0), _previousY(0),
_cursorOn(true),
_releaseAndCompileOnEachNewSlide(true),
_releaseAndCompileOnEachNewSlide(false),
_firstSlideOrLayerChange(true),
_tickAtFirstSlideOrLayerChange(0),
_tickAtLastSlideOrLayerChange(0),
@ -701,7 +701,7 @@ void SlideEventHandler::set(osg::Node* model)
_timePerSlide = duration;
}
selectSlide(0);
//selectSlide(0);
}
else
{
@ -718,7 +718,7 @@ void SlideEventHandler::set(osg::Node* model)
osg::notify(osg::INFO)<<"Found presentation slide"<<findSlide._switch->getName()<<std::endl;
_slideSwitch = findSlide._switch;
selectLayer(0);
//selectLayer(0);
}
else
{
@ -753,8 +753,38 @@ double SlideEventHandler::getCurrentTimeDelayBetweenSlides() const
}
void SlideEventHandler::operator()(osg::Node* node, osg::NodeVisitor* nv)
{
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
if (ev)
{
if (node->getNumChildrenRequiringEventTraversal()>0) traverse(node,nv);
if (ev->getActionAdapter() && !ev->getEvents().empty())
{
for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin();
itr != ev->getEvents().end();
++itr)
{
handleWithCheckAgainstIgnoreHandledEventsMask(*(*itr), *(ev->getActionAdapter()), node, nv);
}
}
}
}
bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
{
if (!_viewer)
{
_viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
selectSlide(0);
home();
osg::notify(osg::NOTICE)<<"Assigned viewer. to SlideEventHandler"<<std::endl;
}
// else osg::notify(osg::NOTICE)<<"SlideEventHandler::handle()"<<std::endl;
if (ea.getHandled()) return false;
switch(ea.getEventType())
@ -1201,8 +1231,11 @@ void SlideEventHandler::updateOperators()
_activeOperators.collect(_slideSwitch.get());
_activeOperators.process();
UpdateLightVisitor uav(_viewer->getCamera()->getViewMatrix(),0.0f,0.0f);
_viewer->getSceneData()->accept(uav);
if (_viewer.valid())
{
UpdateLightVisitor uav(_viewer->getCamera()->getViewMatrix(),0.0f,0.0f);
_viewer->getSceneData()->accept(uav);
}
}
bool SlideEventHandler::home(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)

View File

@ -205,6 +205,9 @@ public:
virtual void accept(osgGA::GUIEventHandlerVisitor& v) { v.visit(*this); }
/** Event traversal node callback method.*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
virtual void getUsage(osg::ApplicationUsage& usage) const;
@ -280,13 +283,13 @@ protected:
osg::observer_ptr<osgViewer::Viewer> _viewer;
osg::ref_ptr<osg::Switch> _showSwitch;
unsigned int _activePresentation;
osg::observer_ptr<osg::Switch> _showSwitch;
int _activePresentation;
osg::ref_ptr<osg::Switch> _presentationSwitch;
osg::observer_ptr<osg::Switch> _presentationSwitch;
int _activeSlide;
osg::ref_ptr<osg::Switch> _slideSwitch;
osg::observer_ptr<osg::Switch> _slideSwitch;
int _activeLayer;
bool _firstTraversal;

View File

@ -733,7 +733,7 @@ double SlideEventHandler::getCurrentTimeDelayBetweenSlides() const
if (_slideSwitch.valid())
{
double duration = -1.0;
if (_activeLayer<_slideSwitch->getNumChildren())
if (_activeLayer<static_cast<int>(_slideSwitch->getNumChildren()))
{
duration = getDuration(_slideSwitch->getChild(_activeLayer));
}
@ -1021,7 +1021,7 @@ unsigned int SlideEventHandler::getNumSlides()
}
bool SlideEventHandler::selectSlide(unsigned int slideNum,unsigned int layerNum)
bool SlideEventHandler::selectSlide(int slideNum,int layerNum)
{
if (!_presentationSwitch) return false;
@ -1032,7 +1032,7 @@ bool SlideEventHandler::selectSlide(unsigned int slideNum,unsigned int layerNum)
slideNum = _presentationSwitch->getNumChildren()-1;
}
if (slideNum>=_presentationSwitch->getNumChildren()) return false;
if (slideNum>=static_cast<int>(_presentationSwitch->getNumChildren())) return false;
osg::Timer_t tick = osg::Timer::instance()->tick();
@ -1110,7 +1110,7 @@ bool SlideEventHandler::selectSlide(unsigned int slideNum,unsigned int layerNum)
}
bool SlideEventHandler::selectLayer(unsigned int layerNum)
bool SlideEventHandler::selectLayer(int layerNum)
{
if (!_slideSwitch) return false;
@ -1119,7 +1119,7 @@ bool SlideEventHandler::selectLayer(unsigned int layerNum)
layerNum = _slideSwitch->getNumChildren()-1;
}
if (layerNum>=_slideSwitch->getNumChildren()) return false;
if (layerNum>=static_cast<int>(_slideSwitch->getNumChildren())) return false;
_activeLayer = layerNum;
_slideSwitch->setSingleChildOn(_activeLayer);

View File

@ -217,7 +217,7 @@ public:
enum WhichPosition
{
FIRST_POSITION = 0,
LAST_POSITION = 0xffffffff
LAST_POSITION = -1
};
void compileSlide(unsigned int slideNum);
@ -225,11 +225,11 @@ public:
unsigned int getNumSlides();
unsigned int getActiveSlide() const { return _activeSlide; }
unsigned int getActiveLayer() const { return _activeLayer; }
int getActiveSlide() const { return _activeSlide; }
int getActiveLayer() const { return _activeLayer; }
bool selectSlide(unsigned int slideNum,unsigned int layerNum=FIRST_POSITION);
bool selectLayer(unsigned int layerNum);
bool selectSlide(int slideNum,int layerNum=FIRST_POSITION);
bool selectLayer(int layerNum);
bool nextLayerOrSlide();
bool previousLayerOrSlide();
@ -284,13 +284,13 @@ protected:
osg::observer_ptr<osgViewer::Viewer> _viewer;
osg::observer_ptr<osg::Switch> _showSwitch;
unsigned int _activePresentation;
int _activePresentation;
osg::observer_ptr<osg::Switch> _presentationSwitch;
unsigned int _activeSlide;
int _activeSlide;
osg::observer_ptr<osg::Switch> _slideSwitch;
unsigned int _activeLayer;
int _activeLayer;
bool _firstTraversal;
double _previousTime;