Name change and const change of Drawable::drawImmediateMode(State&) to
Drawable::drawImplementation(State&) const. Various updates to the rest of the OSG to accomodate this.
This commit is contained in:
@@ -71,11 +71,11 @@ class CullCallback : public osg::NodeCallback
|
||||
|
||||
class DrawableDrawCallback : public osg::Drawable::DrawCallback
|
||||
{
|
||||
virtual void drawImmediateMode(osg::State& state,osg::Drawable* drawable) const
|
||||
virtual void drawImplementation(osg::State& state,const osg::Drawable* drawable) const
|
||||
{
|
||||
std::cout<<"draw call back - pre drawImmediateMode"<<drawable<<std::endl;
|
||||
drawable->drawImmediateMode(state);
|
||||
std::cout<<"draw call back - post drawImmediateMode"<<drawable<<std::endl;
|
||||
std::cout<<"draw call back - pre drawImplementation"<<drawable<<std::endl;
|
||||
drawable->drawImplementation(state);
|
||||
std::cout<<"draw call back - post drawImplementation"<<drawable<<std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ class Teapot : public osg::Drawable
|
||||
|
||||
// the draw immediate mode method is where the OSG wraps up the drawing of
|
||||
// of OpenGL primitives.
|
||||
virtual void drawImmediateMode(osg::State&)
|
||||
virtual void drawImplementation(osg::State&) const
|
||||
{
|
||||
// teapot(..) doens't use vertex arrays at all so we don't need to toggle their state
|
||||
// if we did we'd need to something like following call
|
||||
|
||||
@@ -77,7 +77,7 @@ bool DrawPixels::computeBound() const
|
||||
return true;
|
||||
}
|
||||
|
||||
void DrawPixels::drawImmediateMode(State&)
|
||||
void DrawPixels::drawImplementation(State&) const
|
||||
{
|
||||
glRasterPos3f(_position.x(),_position.y(),_position.z());
|
||||
|
||||
|
||||
@@ -112,9 +112,9 @@ void Drawable::compile(State& state)
|
||||
glNewList( globj, GL_COMPILE );
|
||||
|
||||
if (_drawCallback.valid())
|
||||
_drawCallback->drawImmediateMode(state,this);
|
||||
_drawCallback->drawImplementation(state,this);
|
||||
else
|
||||
drawImmediateMode(state);
|
||||
drawImplementation(state);
|
||||
|
||||
glEndList();
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ void GeoSet::setTextureBinding( BindingType binding )
|
||||
set_fast_path();
|
||||
}
|
||||
|
||||
void GeoSet::drawImmediateMode(State& state)
|
||||
void GeoSet::drawImplementation(State& state) const
|
||||
{
|
||||
if( _coords == (Vec3 *)0 && _iaformat == IA_OFF ) return;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ void GeoSet::set_fast_path( void )
|
||||
}
|
||||
|
||||
|
||||
void GeoSet::draw_fast_path( State& state )
|
||||
void GeoSet::draw_fast_path( State& state ) const
|
||||
{
|
||||
IndexPointer ocindex = _cindex;
|
||||
|
||||
@@ -264,7 +264,7 @@ void GeoSet::draw_fast_path( State& state )
|
||||
}
|
||||
|
||||
|
||||
void GeoSet::draw_alternate_path( State& state )
|
||||
void GeoSet::draw_alternate_path( State& state ) const
|
||||
{
|
||||
if( (_color_binding == BIND_PERVERTEX) && (_colindex.null() || _colindex ==_cindex) && (_flat_shaded_skip == 0) )
|
||||
{
|
||||
|
||||
@@ -360,7 +360,7 @@ bool Geometry::areFastPathsUsed() const
|
||||
return _fastPath;
|
||||
}
|
||||
|
||||
void Geometry::drawImmediateMode(State& state)
|
||||
void Geometry::drawImplementation(State& state) const
|
||||
{
|
||||
if (!_vertexArray.valid() || _vertexArray->getNumElements()==0) return;
|
||||
if (_vertexIndices.valid() && _vertexIndices->getNumElements()==0) return;
|
||||
@@ -449,7 +449,7 @@ void Geometry::drawImmediateMode(State& state)
|
||||
unsigned int unit;
|
||||
for(unit=0;unit<_texCoordList.size();++unit)
|
||||
{
|
||||
Array* array = _texCoordList[unit].first.get();
|
||||
const Array* array = _texCoordList[unit].first.get();
|
||||
if (array)
|
||||
state.setTexCoordPointer(unit,array->getDataSize(),array->getDataType(),0,array->getDataPointer());
|
||||
else
|
||||
@@ -472,7 +472,7 @@ void Geometry::drawImmediateMode(State& state)
|
||||
//
|
||||
// draw the primitives themselves.
|
||||
//
|
||||
for(PrimitiveSetList::iterator itr=_primitives.begin();
|
||||
for(PrimitiveSetList::const_iterator itr=_primitives.begin();
|
||||
itr!=_primitives.end();
|
||||
++itr)
|
||||
{
|
||||
@@ -590,7 +590,7 @@ void Geometry::drawImmediateMode(State& state)
|
||||
//
|
||||
// draw the primitives themselves.
|
||||
//
|
||||
for(PrimitiveSetList::iterator itr=_primitives.begin();
|
||||
for(PrimitiveSetList::const_iterator itr=_primitives.begin();
|
||||
itr!=_primitives.end();
|
||||
++itr)
|
||||
{
|
||||
@@ -599,7 +599,7 @@ void Geometry::drawImmediateMode(State& state)
|
||||
if (secondaryColorBinding==BIND_PER_PRIMITIVE_SET) drawSecondaryColor(secondaryColorIndex++);
|
||||
if (fogCoordBinding==BIND_PER_PRIMITIVE_SET) drawFogCoord(fogCoordIndex++);
|
||||
|
||||
PrimitiveSet* primitiveset = itr->get();
|
||||
const PrimitiveSet* primitiveset = itr->get();
|
||||
GLenum mode=primitiveset->getMode();
|
||||
|
||||
unsigned int primLength;
|
||||
|
||||
@@ -61,7 +61,7 @@ float ImpostorSprite::calcPixelError(const Matrix& MVPW) const
|
||||
|
||||
return sqrtf(max_error_sqrd);
|
||||
}
|
||||
void ImpostorSprite::drawImmediateMode(State&)
|
||||
void ImpostorSprite::drawImplementation(State&) const
|
||||
{
|
||||
// when the tex env is set to REPLACE, and the
|
||||
// texture is set up correctly the color has no effect.
|
||||
|
||||
@@ -1251,7 +1251,7 @@ ShapeDrawable::~ShapeDrawable()
|
||||
{
|
||||
}
|
||||
|
||||
void ShapeDrawable::drawImmediateMode(State& state)
|
||||
void ShapeDrawable::drawImplementation(State& state) const
|
||||
{
|
||||
if (_shape.valid())
|
||||
{
|
||||
|
||||
@@ -142,7 +142,7 @@ void Window::keyboardCB(unsigned char key, int x, int y)
|
||||
s_theWindow->check_if_exit();
|
||||
}
|
||||
|
||||
void Window::specialCB(int key, int x, int y)
|
||||
void Window::specialCB(int, int, int)
|
||||
{
|
||||
// s_theWindow->special(key,x,y);
|
||||
// s_theWindow->check_if_exit();
|
||||
|
||||
@@ -87,7 +87,7 @@ void osgParticle::ParticleSystem::update(double dt)
|
||||
dirtyBound();
|
||||
}
|
||||
|
||||
void osgParticle::ParticleSystem::drawImmediateMode(osg::State &state)
|
||||
void osgParticle::ParticleSystem::drawImplementation(osg::State &state) const
|
||||
{
|
||||
// update the frame count, so other objects can detect when
|
||||
// this particle system is culled
|
||||
@@ -160,14 +160,14 @@ void osgParticle::ParticleSystem::setDefaultAttributes(const std::string &textur
|
||||
}
|
||||
|
||||
|
||||
void osgParticle::ParticleSystem::single_pass_render(osg::State & /*state*/, const osg::Matrix &modelview)
|
||||
void osgParticle::ParticleSystem::single_pass_render(osg::State & /*state*/, const osg::Matrix &modelview) const
|
||||
{
|
||||
draw_count_ = 0;
|
||||
if (particles_.size() <= 0) return;
|
||||
|
||||
Particle_vector::iterator i;
|
||||
Particle_vector::iterator i0 = particles_.begin();
|
||||
Particle_vector::iterator end = particles_.end();
|
||||
Particle_vector::const_iterator i;
|
||||
Particle_vector::const_iterator i0 = particles_.begin();
|
||||
Particle_vector::const_iterator end = particles_.end();
|
||||
|
||||
i0->beginRender();
|
||||
|
||||
|
||||
@@ -602,10 +602,10 @@ osg::Group *ac_load_object(FILE *f,const ACObject *parent)
|
||||
(*vgeom).push_back((*vertpool)[i1]);
|
||||
(*tgeom).push_back((*tcs)[i]);
|
||||
}
|
||||
GLenum poltype=osg::Primitive::POLYGON;
|
||||
if (asurf.flags & SURFACE_TYPE_CLOSEDLINE) poltype=osg::Primitive::LINE_LOOP;
|
||||
if (asurf.flags & SURFACE_TYPE_LINE) poltype=osg::Primitive::LINE_STRIP;
|
||||
geom->addPrimitive(new osg::DrawArrays(poltype,nstart,asurf.num_vertref));
|
||||
GLenum poltype=osg::PrimitiveSet::POLYGON;
|
||||
if (asurf.flags & SURFACE_TYPE_CLOSEDLINE) poltype=osg::PrimitiveSet::LINE_LOOP;
|
||||
if (asurf.flags & SURFACE_TYPE_LINE) poltype=osg::PrimitiveSet::LINE_STRIP;
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(poltype,nstart,asurf.num_vertref));
|
||||
if (asurf.flags & 0x10) needSmooth++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ class ReaderWriterGEO : public ReaderWriter
|
||||
ia.push_back(txidx); // look up table for which texture corresponds to which geom
|
||||
}
|
||||
int nv=getprim((*itr)->getchildren(),vinf);
|
||||
geom[igeom]->addPrimitive(new osg::DrawArrays(osg::Primitive::POLYGON,nstart,nv));
|
||||
geom[igeom]->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,nstart,nv));
|
||||
nstart+=nv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class Logos: public osg::Drawable
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Logos*>(obj)!=NULL; }
|
||||
virtual const char* className() const { return "Logos"; }
|
||||
|
||||
virtual void drawImmediateMode( osg::State &state )
|
||||
virtual void drawImplementation(osg::State &state ) const
|
||||
{
|
||||
if( state.getContextID() != _contextID ) return;
|
||||
|
||||
@@ -100,7 +100,7 @@ class Logos: public osg::Drawable
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
std::vector <osg::Image *>::iterator p;
|
||||
std::vector <osg::Image *>::const_iterator p;
|
||||
float th = 0.0;
|
||||
for( p = logos[Center].begin(); p != logos[Center].end(); p++ )
|
||||
th += (*p)->t();
|
||||
|
||||
@@ -174,12 +174,17 @@ bool Font::create(osg::State& state)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Font::output(osg::State& state,const char* text)
|
||||
void Font::output(osg::State& state,const char* text) const
|
||||
{
|
||||
if(_created)
|
||||
_font->render(text,state.getContextID());
|
||||
else
|
||||
create(state,_pointSize);
|
||||
{
|
||||
// ahhhh, this is bit doddy, the draw is potentially
|
||||
// modifying the text object, this isn't thread safe.
|
||||
Font* this_non_const = const_cast<Font*>(this);
|
||||
this_non_const->create(state,_pointSize);
|
||||
}
|
||||
}
|
||||
|
||||
void Font::clear()
|
||||
|
||||
@@ -168,19 +168,23 @@ bool Text::computeBound() const
|
||||
return true;
|
||||
}
|
||||
|
||||
void Text::drawImmediateMode(State& state)
|
||||
void Text::drawImplementation(State& state) const
|
||||
{
|
||||
if(!_init)
|
||||
return;
|
||||
|
||||
// ahhhh, this is bit doddy, the draw is potentially
|
||||
// modifying the text object, this isn't thread safe.
|
||||
Text* this_non_const = const_cast<Text*>(this);
|
||||
|
||||
if(!_font->isCreated())
|
||||
{
|
||||
_font->create(state);
|
||||
dirtyBound();
|
||||
this_non_const->_font->create(state);
|
||||
this_non_const->dirtyBound();
|
||||
}
|
||||
|
||||
if(!_initAlignment)
|
||||
initAlignment();
|
||||
this_non_const->initAlignment();
|
||||
|
||||
// we must disable all the vertex arrays to prevent any state
|
||||
// propagating into text.
|
||||
@@ -229,8 +233,7 @@ void Text::drawImmediateMode(State& state)
|
||||
}
|
||||
}
|
||||
|
||||
void Text::
|
||||
drawBoundingBox(void)
|
||||
void Text::drawBoundingBox(void) const
|
||||
{
|
||||
if(!_init)
|
||||
return;
|
||||
@@ -247,8 +250,7 @@ drawBoundingBox(void)
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
void Text::
|
||||
drawAlignment(void)
|
||||
void Text::drawAlignment(void) const
|
||||
{
|
||||
if(!_init)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user