Further migration to using RenderInfo

This commit is contained in:
Robert Osfield
2006-11-14 12:51:31 +00:00
parent b5bb541cca
commit d0cc014f1b
11 changed files with 45 additions and 34 deletions

View File

@@ -450,13 +450,13 @@ void Drawable::dirtyBound()
}
}
void Drawable::compileGLObjects(State& state) const
void Drawable::compileGLObjects(RenderInfo& renderInfo) const
{
if (!_useDisplayList) return;
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
unsigned int contextID = state.getContextID();
unsigned int contextID = renderInfo.getContextID();
// get the globj for the current contextID.
GLuint& globj = _globjList[contextID];
@@ -471,9 +471,9 @@ void Drawable::compileGLObjects(State& state) const
glNewList( globj, GL_COMPILE );
if (_drawCallback.valid())
_drawCallback->drawImplementation(state,this);
_drawCallback->drawImplementation(renderInfo,this);
else
drawImplementation(state);
drawImplementation(renderInfo);
glEndList();

View File

@@ -199,13 +199,13 @@ BoundingSphere Geode::computeBound() const
return bsphere;
}
void Geode::compileDrawables(State& state)
void Geode::compileDrawables(RenderInfo& renderInfo)
{
for(DrawableList::iterator itr = _drawables.begin();
itr!=_drawables.end();
++itr)
{
(*itr)->compileGLObjects(state);
(*itr)->compileGLObjects(renderInfo);
}
}

View File

@@ -867,6 +867,9 @@ void DatabasePager::compileGLObjects(osg::State& state, double& availableTime)
{
// osg::notify(osg::NOTICE)<<"DatabasePager::compileGLObjects "<<_frameNumber<<std::endl;
osg::RenderInfo renderInfo;
renderInfo.setState(&state);
if (availableTime>0.0)
{
@@ -971,7 +974,7 @@ void DatabasePager::compileGLObjects(osg::State& state, double& availableTime)
{
//osg::notify(osg::INFO)<<" Compiling drawable "<<(*itr).get()<<std::endl;
double startCompileTime = timer.delta_s(start_tick,timer.tick());
(*itr)->compileGLObjects(state);
(*itr)->compileGLObjects(renderInfo);
elapsedTime = timer.delta_s(start_tick,timer.tick());
// estimate the duration of the compile based on current compile duration.

View File

@@ -19,17 +19,17 @@
using namespace osgParticle;
ConnectedParticleSystem::ConnectedParticleSystem():
_startParticle(Particle::INVALID_INDEX),
_lastParticleCreated(Particle::INVALID_INDEX),
_maxNumberOfParticlesToSkip(200)
_maxNumberOfParticlesToSkip(200),
_startParticle(Particle::INVALID_INDEX)
{
}
ConnectedParticleSystem::ConnectedParticleSystem(const ConnectedParticleSystem& copy, const osg::CopyOp& copyop):
ParticleSystem(copy,copyop),
_startParticle(copy._startParticle),
_lastParticleCreated(copy._lastParticleCreated),
_maxNumberOfParticlesToSkip(200)
_maxNumberOfParticlesToSkip(200),
_startParticle(copy._startParticle)
{
}

View File

@@ -168,24 +168,24 @@ PrecipitationEffect::PrecipitationEffect(const PrecipitationEffect& copy, const
update();
}
void PrecipitationEffect::compileGLObjects(osg::State& state) const
void PrecipitationEffect::compileGLObjects(osg::RenderInfo& renderInfo) const
{
if (_quadGeometry.valid())
{
_quadGeometry->compileGLObjects(state);
if (_quadGeometry->getStateSet()) _quadGeometry->getStateSet()->compileGLObjects(state);
_quadGeometry->compileGLObjects(renderInfo);
if (_quadGeometry->getStateSet()) _quadGeometry->getStateSet()->compileGLObjects(*renderInfo.getState());
}
if (_lineGeometry.valid())
{
_lineGeometry->compileGLObjects(state);
if (_lineGeometry->getStateSet()) _lineGeometry->getStateSet()->compileGLObjects(state);
_lineGeometry->compileGLObjects(renderInfo);
if (_lineGeometry->getStateSet()) _lineGeometry->getStateSet()->compileGLObjects(*renderInfo.getState());
}
if (_pointGeometry.valid())
{
_pointGeometry->compileGLObjects(state);
if (_pointGeometry->getStateSet()) _pointGeometry->getStateSet()->compileGLObjects(state);
_pointGeometry->compileGLObjects(renderInfo);
if (_pointGeometry->getStateSet()) _pointGeometry->getStateSet()->compileGLObjects(*renderInfo.getState());
}
}
@@ -217,7 +217,7 @@ void PrecipitationEffect::traverse(osg::NodeVisitor& nv)
{
if (globjVisitor->getMode() & osgUtil::GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES)
{
compileGLObjects(*(globjVisitor->getState()));
compileGLObjects(globjVisitor->getRenderInfo());
}
}

View File

@@ -23,7 +23,6 @@ GLObjectsVisitor::GLObjectsVisitor(Mode mode)
_mode = mode;
_state = NULL;
}
@@ -74,14 +73,14 @@ void GLObjectsVisitor::apply(osg::Drawable& drawable)
drawable.setUseDisplayList(true);
}
if (_mode&COMPILE_DISPLAY_LISTS && _state.valid())
if (_mode&COMPILE_DISPLAY_LISTS && _renderInfo.getState())
{
drawable.compileGLObjects(*_state);
drawable.compileGLObjects(_renderInfo);
}
if (_mode&RELEASE_DISPLAY_LISTS)
{
drawable.releaseGLObjects(_state.get());
drawable.releaseGLObjects(_renderInfo.getState());
}
if (_mode&SWITCH_ON_VERTEX_BUFFER_OBJECTS)
@@ -101,18 +100,18 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset)
_stateSetAppliedSet.insert(&stateset);
if (_mode & COMPILE_STATE_ATTRIBUTES && _state.valid())
if (_mode & COMPILE_STATE_ATTRIBUTES && _renderInfo.getState())
{
stateset.compileGLObjects(*_state);
stateset.compileGLObjects(*_renderInfo.getState());
}
if (_mode & RELEASE_STATE_ATTRIBUTES)
{
stateset.releaseGLObjects(_state.get());
stateset.releaseGLObjects(_renderInfo.getState());
}
if (_mode & CHECK_BLACK_LISTED_MODES)
{
stateset.checkValidityOfAssociatedModes(*_state.get());
stateset.checkValidityOfAssociatedModes(*_renderInfo.getState());
}
}