diff --git a/Make/makedefs.freebsd b/Make/makedefs.freebsd index 38326133b..73cafc8f0 100644 --- a/Make/makedefs.freebsd +++ b/Make/makedefs.freebsd @@ -32,6 +32,7 @@ TARGET_DIRS = \ /usr/include/osgDB \ /usr/include/osgGLUT \ /usr/include/osgUtil \ + /usr/include/osgText \ /usr/share/OpenSceneGraph\ /usr/share/OpenSceneGraph/data\ /usr/share/OpenSceneGraph/data/Images\ diff --git a/Make/makedefs.irix.nonstd b/Make/makedefs.irix.nonstd index a64509f53..0308dcb7f 100644 --- a/Make/makedefs.irix.nonstd +++ b/Make/makedefs.irix.nonstd @@ -34,6 +34,7 @@ TARGET_DIRS = \ /usr/include/osgDB \ /usr/include/osgGLUT \ /usr/include/osgUtil \ + /usr/include/osgText \ /usr/share/OpenSceneGraph\ /usr/share/OpenSceneGraph/data\ /usr/share/OpenSceneGraph/data/Images\ diff --git a/Make/makedefs.irix.std b/Make/makedefs.irix.std index 5ffbda176..77d70cb02 100644 --- a/Make/makedefs.irix.std +++ b/Make/makedefs.irix.std @@ -34,6 +34,7 @@ TARGET_DIRS = \ /usr/include/osgDB \ /usr/include/osgGLUT \ /usr/include/osgUtil \ + /usr/include/osgText \ /usr/share/OpenSceneGraph\ /usr/share/OpenSceneGraph/data\ /usr/share/OpenSceneGraph/data/Images\ diff --git a/Make/makedefs.linux b/Make/makedefs.linux index f5b509be3..1515cb78a 100644 --- a/Make/makedefs.linux +++ b/Make/makedefs.linux @@ -34,6 +34,7 @@ TARGET_DIRS = \ /usr/include/osgDB \ /usr/include/osgGLUT \ /usr/include/osgUtil \ + /usr/include/osgText \ /usr/share/OpenSceneGraph\ /usr/share/OpenSceneGraph/data\ /usr/share/OpenSceneGraph/data/Images\ diff --git a/Make/makedefs.macosx b/Make/makedefs.macosx index b0580e4db..b04f97790 100644 --- a/Make/makedefs.macosx +++ b/Make/makedefs.macosx @@ -34,6 +34,7 @@ TARGET_DIRS = \ /usr/include/osgDB \ /usr/include/osgGLUT \ /usr/include/osgUtil \ + /usr/include/osgText \ /usr/share/OpenSceneGraph\ /usr/share/OpenSceneGraph/data\ /usr/share/OpenSceneGraph/data/Images\ diff --git a/Makefile b/Makefile index c10fe1f7f..699b54e34 100644 --- a/Makefile +++ b/Makefile @@ -122,11 +122,13 @@ instcheck : diff -q include/osg/ /usr/include/osg/ diff -q include/osgUtil/ /usr/include/osgUtil/ diff -q include/osgDB/ /usr/include/osgDB/ + diff -q include/osgText/ /usr/include/osgText/ diff -q include/osgGLUT/ /usr/include/osgGLUT/ diff -q lib/libosg.so /usr/lib/libosg.so diff -q lib/libosgUtil.so /usr/lib/libosgUtil.so diff -q lib/libosgDB.so /usr/lib/libosgDB.so diff -q lib/libosgGLUT.so /usr/lib/libosgGLUT.so + diff -q lib/libosgText.so /usr/lib/libosgText.so diff -q lib/osgPlugins/ /usr/lib/osgPlugins/ stats : diff --git a/include/osg/Matrix b/include/osg/Matrix index 3e90c6f41..2bf267916 100644 --- a/include/osg/Matrix +++ b/include/osg/Matrix @@ -293,7 +293,7 @@ inline ostream& operator<< (ostream& os, const Matrix& m ) for(int row=0; row<4; ++row) { os << "\t"; for(int col=0; col<4; ++col) - os << m(col,row) << " "; + os << m(row,col) << " "; os << endl; } os << "}" << endl; diff --git a/include/osg/Node b/include/osg/Node index fa1fd282d..0f7ef49f3 100644 --- a/include/osg/Node +++ b/include/osg/Node @@ -24,10 +24,10 @@ class Group; * and accept methods. Use when subclassing from Node to make it * more convinient to define the required pure virtual methods.*/ #define META_Node(name) \ - virtual Object* clone() const { return new name (); } \ - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } \ + virtual osg::Object* clone() const { return new name (); } \ + virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } \ virtual const char* className() const { return #name; } \ - virtual void accept(NodeVisitor& nv) { if (nv.validNodeMask(*this)) nv.apply(*this); } \ + virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) nv.apply(*this); } \ /** Base class for all internal nodes in the scene graph. diff --git a/include/osg/Object b/include/osg/Object index d8935470b..72dd3e4a2 100644 --- a/include/osg/Object +++ b/include/osg/Object @@ -14,8 +14,8 @@ namespace osg { * the standard pure virtual clone, isSameKindAs and className methods * which are required for all Object subclasses.*/ #define META_Object(name) \ - virtual Object* clone() const { return new name (); } \ - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } \ + virtual osg::Object* clone() const { return new name (); } \ + virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } \ virtual const char* className() const { return #name; } diff --git a/include/osgText/Text b/include/osgText/Text index d29d31951..d76f69a73 100644 --- a/include/osgText/Text +++ b/include/osgText/Text @@ -36,11 +36,9 @@ class FTFont; namespace osgText { -using namespace osg; - /////////////////////////////////////////////////////////////////////////////// // Font - FontBaseClass -class OSGTEXT_EXPORT Font:public Object +class OSGTEXT_EXPORT Font : public osg::Object { public: @@ -232,7 +230,7 @@ protected: /////////////////////////////////////////////////////////////////////////////// // Text -class OSGTEXT_EXPORT Text:public Drawable +class OSGTEXT_EXPORT Text:public osg::Drawable { public: @@ -270,31 +268,32 @@ public: META_Object(Text); - void setPosition(const Vec3& pos); - void setPosition(const Vec2& pos); + void setPosition(const osg::Vec2& pos); + void setPosition(const osg::Vec3& pos); + const osg::Vec3& getPosition() const { return _pos; } - void setDrawMode(int mode) { _drawMode=mode; } - int getDrawMode(void) { return _drawMode; } + void setDrawMode(int mode) { _drawMode=mode; } + int getDrawMode() const { return _drawMode; } - void setBoundingBox(int mode); - int getBoundingBox(void) { return _boundingBoxType; } + void setBoundingBox(int mode); + int getBoundingBox() const { return _boundingBoxType; } - void setAlignement(int alignement); - int getAlignement(void) { return _alignement; } + void setAlignement(int alignement); + int getAlignement() const { return _alignement; } - void setFont(Font* font); - Font* getFont(void); + void setFont(Font* font); + Font* getFont() { return _font.get(); } + const Font* getFont() const { return _font.get(); } - void setText(const char* text) { _text=text; } - void setText(const std::string& text) { _text=text; } - const std::string& getText() const { return _text; } + void setText(const char* text) { _text=text; } + void setText(const std::string& text) { _text=text; } + const std::string& getText() const { return _text; } - virtual void drawImmediateMode(State& state); - virtual void drawBoundingBox(void); - virtual void drawAlignement(void); + virtual void drawImmediateMode(osg::State& state); + virtual void drawBoundingBox(void); + virtual void drawAlignement(void); - const Vec3& getPosition() { return _pos; } - const Vec3& getAlignementPos() { return _alignementPos; }; + const osg::Vec3& getAlignementPos() const { return _alignementPos; }; protected: @@ -312,23 +311,23 @@ protected: virtual ~Text(); virtual void setDefaults(void); - virtual const bool computeBound(void) const; - virtual void calcBounds(Vec3* min,Vec3* max) const; - void initAlignement(Vec3* min,Vec3* max); + virtual const bool computeBound(void) const; + virtual void calcBounds(osg::Vec3* min,osg::Vec3* max) const; + void initAlignement(osg::Vec3* min,osg::Vec3* max); bool initAlignement(void); - ref_ptr _font; + osg::ref_ptr _font; - bool _init; - bool _initAlignement; - std::string _text; - int _fontType; - int _alignement; - int _drawMode; - int _boundingBoxType; + bool _init; + bool _initAlignement; + std::string _text; + int _fontType; + int _alignement; + int _drawMode; + int _boundingBoxType; - Vec3 _pos; - Vec3 _alignementPos; + osg::Vec3 _pos; + osg::Vec3 _alignementPos; }; // Text /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Demos/Makefile b/src/Demos/Makefile index 871b5c577..47acfa330 100644 --- a/src/Demos/Makefile +++ b/src/Demos/Makefile @@ -1,7 +1,7 @@ #!smake SHELL=/bin/sh -DIRS = sgv osgconv osgcube osgreflect osgtexture osgimpostor osgviews hangglide osgcluster +DIRS = sgv osgconv osgcube osgreflect osgtexture osgimpostor osgviews osgtext hangglide osgcluster all : for f in $(DIRS) ; do cd $$f; $(MAKE) || exit 1; cd ..; done diff --git a/src/Makefile b/src/Makefile index 2e37ea70c..bc7c205df 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,7 @@ SHELL=/bin/sh -DIRS = osg osgDB osgUtil osgGLUT Demos osgPlugins +DIRS = osg osgDB osgUtil osgText osgGLUT Demos osgPlugins all : for f in $(DIRS) ; do cd $$f; $(MAKE) || exit 1; cd ..; done @@ -21,6 +21,7 @@ docs : (cd osgUtil; $(MAKE) docs; ) (cd osgDB; $(MAKE) docs; ) (cd osgGLUT; $(MAKE) docs; ) + (cd osgText; $(MAKE) docs; ) to_unix : for f in $(DIRS) ; do cd $$f; to_unix Makefile Makefile; cd ..; done diff --git a/src/osg/Makefile b/src/osg/Makefile index f14f7e6f9..d1d845e14 100644 --- a/src/osg/Makefile +++ b/src/osg/Makefile @@ -77,6 +77,7 @@ TARGET_INCLUDE_FILES = \ osg/FrontFace\ osg/GL\ osg/GLExtensions\ + osg/GLU\ osg/GeoSet\ osg/Geode\ osg/Group\ diff --git a/src/osgGLUT/Makefile b/src/osgGLUT/Makefile index 13ee5a95c..156bb3d27 100644 --- a/src/osgGLUT/Makefile +++ b/src/osgGLUT/Makefile @@ -22,6 +22,8 @@ TARGET_INCLUDE_FILES = \ osgGLUT/Version\ osgGLUT/Window\ osgGLUT/Viewer\ + osgGLUT/glut\ + C++FLAGS += -I ../../include diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index 3ca1af5ac..1266b7ebc 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -25,6 +25,7 @@ #include "FTGLTextureFont.h" +using namespace osg; using namespace osgText; // define the default paths to look for fonts. @@ -356,6 +357,32 @@ Text:: { } +void Text::setFont(Font* font) +{ + if (_font==font) return; + + if(font && font->isOk()) + { + _init=true; + _font=font; + + if(dynamic_cast(_font.get())) + _fontType=POLYGON; + else if(dynamic_cast(_font.get())) + _fontType=BITMAP; + else if(dynamic_cast(_font.get())) + _fontType=PIXMAP; + else if(dynamic_cast(_font.get())) + _fontType=TEXTURE; + else if(dynamic_cast(_font.get())) + _fontType=OUTLINE; + + _initAlignement = false; + dirtyBound(); + + } +} + void Text:: setDefaults() { @@ -415,8 +442,7 @@ computeBound() const return true; } -void Text:: -drawImmediateMode(State& state) +void Text::drawImmediateMode(State& state) { if(!_init) return;