From 03eee3b700c11a6699428cbe41367286937b0cc4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 30 Jan 2003 16:11:39 +0000 Subject: [PATCH] Fixed warning in osgText Added getBound() to begining of osgProducer::CameraGroup::frame() to ensure that the parallel cull traversals don't all do a getBound(). Added osgProducer::CameraGroup::getTopMostSceneData() convinience method. --- include/osgProducer/CameraGroup | 4 ++++ src/osgGLUT/Viewer.cpp | 2 +- src/osgProducer/CameraGroup.cpp | 19 +++++++++++++++++++ src/osgText/Text.cpp | 20 +++++++++++++++++++- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/include/osgProducer/CameraGroup b/include/osgProducer/CameraGroup index 98b4cd76a..3afc789cf 100644 --- a/include/osgProducer/CameraGroup +++ b/include/osgProducer/CameraGroup @@ -57,6 +57,10 @@ class OSGPRODUCER_EXPORT CameraGroup : public Producer::CameraGroup const osg::Group* getSceneDecorator() const { return _scene_decorator.get(); } + osg::Node* getTopMostSceneData(); + + const osg::Node* getTopMostSceneData() const; + void setDisplaySettings( osg::DisplaySettings *ds ) { _ds = ds; } diff --git a/src/osgGLUT/Viewer.cpp b/src/osgGLUT/Viewer.cpp index 7e97abae1..8432f5f55 100644 --- a/src/osgGLUT/Viewer.cpp +++ b/src/osgGLUT/Viewer.cpp @@ -1191,7 +1191,7 @@ void Viewer::keyboard(int key, int x, int y, bool keydown ) { osg::ref_ptr viewport = new osg::Viewport; viewport->setViewport(_wx,_wy,_ww,_wh); - std::string filename("screenshot.bmp"); + std::string filename("screenshot.rgb"); glReadBuffer(GL_FRONT); osg::ref_ptr image = new osg::Image; diff --git a/src/osgProducer/CameraGroup.cpp b/src/osgProducer/CameraGroup.cpp index 74fa51637..9eed83e22 100644 --- a/src/osgProducer/CameraGroup.cpp +++ b/src/osgProducer/CameraGroup.cpp @@ -183,8 +183,27 @@ void CameraGroup::realize( ThreadingModel thread_model) _initialized = true; } +osg::Node* CameraGroup::getTopMostSceneData() +{ + if (_scene_decorator.valid()) + return _scene_decorator.get(); + else + return _scene_data.get(); +} + +const osg::Node* CameraGroup::getTopMostSceneData() const +{ + if (_scene_decorator.valid()) + return _scene_decorator.get(); + else + return _scene_data.get(); +} + void CameraGroup::frame() { + osg::Node* node = getTopMostSceneData(); + if (node) node->getBound(); + Producer::CameraGroup::frame(); _frameStamp->setFrameNumber( _frameStamp->getFrameNumber() + 1 ); } diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index 6e28ece95..9443ac2cd 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -24,6 +24,7 @@ #include "FTGLPolygonFont.h" #include "FTGLTextureFont.h" +//#define BUILD_NO_TEXT using namespace osg; using namespace osgText; @@ -135,6 +136,7 @@ setDefaults() bool Text::computeBound() const { +#ifndef BUILD_NO_TEXT if(!_init) { _bbox_computed=false; @@ -171,6 +173,11 @@ bool Text::computeBound() const _bbox_computed=true; } +#else + _bbox.init(); + _bbox_computed=true; +#endif + return true; } @@ -181,6 +188,7 @@ bool Text::supports(PrimitiveFunctor&) const void Text::accept(PrimitiveFunctor& functor) const { +#ifndef BUILD_NO_TEXT Vec3 boundingVertices[4]; boundingVertices[0].set(_bbox._min._v[0],_bbox._max._v[1],_bbox._min._v[2]); boundingVertices[1] = _bbox._min; @@ -189,10 +197,12 @@ void Text::accept(PrimitiveFunctor& functor) const functor.setVertexArray(4,boundingVertices); functor.drawArrays( GL_QUADS, 0, 4); +#endif } void Text::compile(State& state) const { +#ifndef BUILD_NO_TEXT // ahhhh, this is bit doddy, the draw is potentially // modifying the text object, this isn't thread safe. Text* this_non_const = const_cast(this); @@ -207,10 +217,13 @@ void Text::compile(State& state) const { this_non_const->initAlignment(); } +#endif } void Text::drawImplementation(State& state) const { +#ifndef BUILD_NO_TEXT + if(!_init) return; @@ -280,6 +293,8 @@ void Text::drawImplementation(State& state) const }; glPopMatrix(); } + +#endif } void Text::drawBoundingBox(void) const @@ -350,6 +365,7 @@ calcBounds(Vec3* min,Vec3* max) const bool Text:: initAlignment(void) { +#ifndef BUILD_NO_TEXT if(!_init) return false; @@ -378,13 +394,14 @@ initAlignment(void) _bbox_computed=true; } - +#endif return true; } void Text:: initAlignment(Vec3* min,Vec3* max) { +#ifndef BUILD_NO_TEXT if(!_init) return; @@ -487,6 +504,7 @@ initAlignment(Vec3* min,Vec3* max) break; }; +#endif }