From David Callu, added findSlaveIndexForCamera method
This commit is contained in:
@@ -118,23 +118,25 @@ class OSG_EXPORT View : public osg::Object
|
||||
bool addSlave(osg::Camera* camera, const osg::Matrix& projectionOffset, const osg::Matrix& viewOffse, bool useMastersSceneData=true);
|
||||
|
||||
bool removeSlave(unsigned int pos);
|
||||
|
||||
|
||||
unsigned int getNumSlaves() const { return _slaves.size(); }
|
||||
|
||||
Slave& getSlave(unsigned int pos) { return _slaves[pos]; }
|
||||
const Slave& getSlave(unsigned int pos) const { return _slaves[pos]; }
|
||||
|
||||
Slave* findSlaveForCamera(osg::Camera* camera);
|
||||
|
||||
unsigned int findSlaveIndexForCamera(osg::Camera* camera);
|
||||
|
||||
Slave * findSlaveForCamera(osg::Camera* camera);
|
||||
|
||||
void updateSlaves();
|
||||
|
||||
|
||||
void updateSlave(unsigned int i);
|
||||
|
||||
|
||||
protected :
|
||||
|
||||
|
||||
virtual ~View();
|
||||
|
||||
|
||||
virtual osg::GraphicsOperation* createRenderer(osg::Camera*) { return 0; }
|
||||
|
||||
osg::ref_ptr<osg::Stats> _stats;
|
||||
|
||||
@@ -190,15 +190,25 @@ bool View::removeSlave(unsigned int pos)
|
||||
return true;
|
||||
}
|
||||
|
||||
View::Slave* View::findSlaveForCamera(osg::Camera* camera)
|
||||
|
||||
View::Slave * View::findSlaveForCamera(osg::Camera* camera)
|
||||
{
|
||||
if (_camera == camera) return 0;
|
||||
unsigned int i = findSlaveIndexForCamera(camera);
|
||||
|
||||
if (i >= getNumSlaves()) return (NULL);
|
||||
|
||||
return &(_slaves[i]);
|
||||
}
|
||||
|
||||
unsigned int View::findSlaveIndexForCamera(osg::Camera* camera)
|
||||
{
|
||||
if (_camera == camera) return _slaves.size();
|
||||
|
||||
for(unsigned int i=0; i<_slaves.size(); ++i)
|
||||
{
|
||||
if (_slaves[i]._camera == camera) return &(_slaves[i]);
|
||||
if (_slaves[i]._camera == camera) return (i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return _slaves.size();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user