Checked in Macro Jez's additions to osgText to support .osg IO make it

a fully functioning NodeKit.

Also reimplement notify() to try an prevent a crash which has been caused by
to objects in notify.cpp being initiliazed twice, the second time the auto_ptr
holding the dev/null ofstream was being initilized to 0.
This commit is contained in:
Robert Osfield
2002-06-11 18:41:57 +00:00
parent e1ba8a6292
commit 247cb3ff7e
21 changed files with 958 additions and 149 deletions

View File

@@ -30,13 +30,13 @@ enum NotifySeverity {
};
/** global notify level. */
SG_EXPORT extern NotifySeverity g_NotifyLevel;
//SG_EXPORT extern NotifySeverity g_NotifyLevel;
/** global notify nul stream. added for Mac OSX */
SG_EXPORT extern std::auto_ptr<std::ofstream> g_NotifyNulStream;
//SG_EXPORT extern std::auto_ptr<std::ofstream> g_NotifyNulStream;
/** global notify nul stream. added for Mac OSX */
SG_EXPORT extern bool g_NotifyInit;
//SG_EXPORT extern bool g_NotifyInit;
/** set the notify level, overriding the default or value set by
* the environmental variable OSGNOTIFYLEVEL.
@@ -69,17 +69,21 @@ SG_EXPORT extern bool initNotifyLevel();
// previous implementation was causing Mac OSX to misbehave. This version
// places less stress on compiler and runs on Mac
inline std::ostream& notify(const NotifySeverity severity)
{
if (!g_NotifyInit) initNotifyLevel();
if (severity<=g_NotifyLevel)
{
if (severity<=osg::WARN) return std::cerr;
else return std::cout;
}
return *osg::g_NotifyNulStream;
}
SG_EXPORT extern std::ostream& notify(const NotifySeverity severity);
// {
// static bool initilized = false;
// if (!initilized) initilized = initNotifyLevel();
//
// if (severity<=g_NotifyLevel)
// {
// if (severity<=osg::WARN) return std::cerr;
// else return std::cout;
// }
// cout << "doing a notify to null stream "<<osg::g_NotifyLevel<<" "<<osg::g_NotifyNulStream.get()<<" "<<osg::g_NotifyInit<<endl;
// //if (osg::g_NotifyNulStream.get()==0L) abort();
// return std::cout;
// //return *osg::g_NotifyNulStream;
// }
inline std::ostream& notify(void) { return notify(osg::INFO); }

View File

@@ -93,8 +93,6 @@ class OSGGLUT_EXPORT Viewer : public Window, public osgGA::GUIActionAdapter
osg::DisplaySettings* getDisplaySettings() { return _displaySettings.get(); }
const osg::DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); }
typedef std::vector<osg::ref_ptr<osgGA::CameraManipulator> > CameraManipList;
protected:
virtual void clear();

View File

@@ -85,7 +85,10 @@ class OSGTEXT_EXPORT Font : public osg::Object
int getPointSize(void) const { return _pointSize; }
int getTextureSize(void) const { return _textureSize; }
const std::string& getFontName();
const std::string& getFontName() const { return _fontName; }
/// Transfer font settings to another Font object and invalidate this one.
void copyAndInvalidate(Font &dest);
FTFont* getFont(void) { return _font; }

View File

@@ -36,7 +36,7 @@ class OSGTEXT_EXPORT Paragraph : public osg::Geode
const osg::Vec3& getPosition() const { return _position; }
void setAlignment(int alignment);
int getAlignment() { return _alignment; }
int getAlignment() const { return _alignment; }
float getHeight() const;

View File

@@ -72,6 +72,7 @@ class OSGTEXT_EXPORT Text : public osg::Drawable
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new Text(*this,copyop); }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Text*>(obj)!=NULL; }
virtual const char* className() const { return "Text"; }
virtual const char* libraryName() const { return "osgText"; }
void setPosition(const osg::Vec2& pos);
void setPosition(const osg::Vec3& pos);

View File

@@ -15,6 +15,7 @@
#include <osg/Transform>
#include <osg/Projection>
#include <osg/Impostor>
#include <osg/OccluderNode>
#include <osgUtil/Export>
@@ -34,18 +35,19 @@ class OSGUTIL_EXPORT AppVisitor : public osg::NodeVisitor
virtual void reset();
virtual void apply(osg::Node& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Node& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Geode& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Billboard& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::LightSource& node){ handle_callbacks_and_traverse(node); }
virtual void apply(osg::Geode& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Billboard& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::LightSource& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Group& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Transform& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Projection& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Switch& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::LOD& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Impostor& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Group& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Transform& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Projection& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Switch& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::LOD& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Impostor& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::OccluderNode& node) { handle_callbacks_and_traverse(node); }
protected: