Changed the KeySwichCameraManipulator::setNode() so it set all camera's

attached to it.
This commit is contained in:
Robert Osfield
2003-04-08 13:10:47 +00:00
parent cbd0fad400
commit 5f8411ac5c
4 changed files with 23 additions and 6 deletions

View File

@@ -32,8 +32,10 @@ static Producer::CameraConfig *BuildConfig(void)
camera2->setOffset( -1.0, 0.0 );
Producer::InputArea *ia = new Producer::InputArea;
ia->addInputRectangle( rs1, Producer::InputRectangle(0.0,0.5,0.0,1.0));
ia->addInputRectangle( rs2, Producer::InputRectangle(0.5,1.0,0.0,1.0));
// ia->addInputRectangle( rs1, Producer::InputRectangle(0.0,0.5,0.0,1.0));
// ia->addInputRectangle( rs2, Producer::InputRectangle(0.5,1.0,0.0,1.0));
ia->addInputRectangle( rs1, Producer::InputRectangle(-1.0,0.0,-1.0,1.0));
ia->addInputRectangle( rs2, Producer::InputRectangle(0.0,1.0,-1.0,1.0));
Producer::CameraConfig *cfg = new Producer::CameraConfig;

View File

@@ -71,7 +71,7 @@ public:
virtual osg::Camera * getCamera() { return _current->getCamera(); }
virtual void setNode(osg::Node* n) { _current->setNode(n); }
virtual void setNode(osg::Node* n);
virtual const osg::Node* getNode() const { return _current->getNode(); }

View File

@@ -35,13 +35,26 @@ void KeySwitchCameraManipulator::selectCameraManipulator(unsigned int num)
{
if (_current.valid())
{
itr->second.second->setNode(_current->getNode());
if ( !itr->second.second->getNode() ) {
itr->second.second->setNode(_current->getNode());
}
itr->second.second->setCamera(_current->getCamera());
}
_current = itr->second.second;
}
}
void KeySwitchCameraManipulator::setNode(osg::Node* node)
{
for(KeyManipMap::iterator itr=_manips.begin();
itr!=_manips.end();
++itr)
{
itr->second.second->setNode(node);
}
}
CameraManipulator* KeySwitchCameraManipulator::getCameraManipulator(unsigned int num)
{
KeyManipMap::iterator itr = _manips.find(num);
@@ -63,7 +76,9 @@ bool KeySwitchCameraManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapt
KeyManipMap::iterator it=_manips.find(ea.getKey());
if(it != _manips.end()){
osg::notify(osg::INFO)<<"Switching to manipulator: "<<(*it).second.first<<std::endl;
it->second.second->setNode(_current->getNode());
if ( !it->second.second->getNode() ) {
it->second.second->setNode(_current->getNode());
}
it->second.second->setCamera(_current->getCamera());
it->second.second->init(ea,aa);
_current = it->second.second;

View File

@@ -839,7 +839,7 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio
// have already been recording so switch of recording.
viewer->setRecordingAnimationPath(false);
osg::notify(osg::NOTICE) << "Finished recording camera animation, press 'Z' to reply."<< std::endl;
osg::notify(osg::NOTICE) << "To finished recording camera animation, press 'Z' to reply."<< std::endl;
if (viewer->getAnimationPath())
{