Fixes for IRIX build.

Updates to the osg::Transform, adding preMult and postMult methods and
deprecating the old preRotate,preTranslate,preScale.

Updated the rest of the OSG so that it nolonger uses the deprecated
osg::Transform nodes.

Renamed osgUtil::SceneView::setGlobalState() to
osgUtil::SceneView::setGlobalStateSet() so that the name reflects its
functionality better.  Updated osgGLUT::Viewer etc to cope with new
name change.
This commit is contained in:
Robert Osfield
2001-11-14 14:09:07 +00:00
parent 34555f61d6
commit a434abafd7
22 changed files with 1420 additions and 1444 deletions

View File

@@ -71,26 +71,32 @@
namespace osg {
#ifdef USE_DEGREES_INTERNALLY
inline double inDegrees(double angle) { return angle; }
inline double inRadians(double angle) { return angle*180.0/M_PI; }
inline double inDegrees(double angle) { return angle; }
inline double inRadians(double angle) { return angle*180.0/M_PI; }
#else
inline double inDegrees(double angle) { return angle*M_PI/180.0; }
inline double inRadians(double angle) { return angle; }
inline double inDegrees(double angle) { return angle*M_PI/180.0; }
inline double inRadians(double angle) { return angle; }
#endif
inline double DegreesToRadians(double angle) { return angle*M_PI/180.0; }
inline double RadiansToDegrees(double angle) { return angle*180.0/M_PI; }
#ifdef WIN32
inline bool isNaN(float v) { return ::_isnan(v)!=0; }
inline bool isNaN(double v) { return ::_isnan(v)!=0; }
inline bool isInfinite(float v) { return !::_finite(v); }
inline bool isInfinite(double v) { return !::_finite(v); }
inline bool isNaN(float v) { return ::_isnan(v)!=0; }
inline bool isNaN(double v) { return ::_isnan(v)!=0; }
inline bool isInfinite(float v) { return !::_finite(v); }
inline bool isInfinite(double v) { return !::_finite(v); }
#elseif __sgi
inline bool isNaN(float v) { return ::isnan(v); }
inline bool isNaN(double v) { return ::isnan(v); }
// can't find a function to test for infiniting on sgi yet..
inline bool isInfinite(float v) { return false; }
inline bool isInfinite(double v) { return false; }
#else
inline bool isNaN(float v) { return ::isnan(v); }
inline bool isNaN(double v) { return ::isnan(v); }
inline bool isInfinite(float v) { return ::isinf(v); }
inline bool isInfinite(double v) { return ::isinf(v); }
inline bool isNaN(float v) { return ::isnan(v); }
inline bool isNaN(double v) { return ::isnan(v); }
inline bool isInfinite(float v) { return ::isinf(v); }
inline bool isInfinite(double v) { return ::isinf(v); }
#endif
};

View File

@@ -17,7 +17,7 @@ using namespace std;
#endif
// temporary #define to keep backwards compatibility.
#define USE_DEPRECATED_MATRIX_METHODS
//#define USE_DEPRECATED_MATRIX_METHODS
namespace osg {

View File

@@ -41,15 +41,34 @@ class SG_EXPORT Transform : public Group
/** Get the Transform Type.*/
inline const Type getType() const { return _type; }
void setMatrix(const Matrix& mat );
inline Matrix& getMatrix() { return *_matrix; }
inline const Matrix& getMatrix() const { return *_matrix; }
void preMult( const Matrix& mat );
inline void setMatrix(const Matrix& mat )
{
(*_matrix) = mat;
dirtyBound();
}
/** preMult trasforms relative to the childrens coordinate system.*/
inline void preMult( const Matrix& mat )
{
(*_matrix) = mat * (*_matrix);
dirtyBound();
}
/** postMult trasforms relative to the parents coordinate system.*/
inline void postMult( const Matrix& mat )
{
(*_matrix) = (*_matrix) * mat;
dirtyBound();
}
#ifdef USE_DEPRECATED_MATRIX_METHODS
void preScale( const float sx, const float sy, const float sz );
void preTranslate( const float tx, const float ty, const float tz );
void preRotate( const float deg, const float x, const float y, const float z );
#endif
protected :

View File

@@ -45,14 +45,14 @@ class OSGDB_EXPORT ReaderWriter : public osg::Referenced
{
public:
enum Status
enum ReadStatus
{
FILE_NOT_HANDLED,
FILE_LOADED,
ERROR_IN_READING_FILE
};
ReadResult(Status status=FILE_NOT_HANDLED):_status(status) {}
ReadResult(ReadStatus status=FILE_NOT_HANDLED):_status(status) {}
ReadResult(const std::string& m):_status(ERROR_IN_READING_FILE),_message(m) {}
ReadResult(osg::Object* obj):_status(FILE_LOADED),_object(obj) {}
@@ -73,14 +73,14 @@ class OSGDB_EXPORT ReaderWriter : public osg::Referenced
const std::string& message() const { return _message; }
const Status status() const { return _status; }
const ReadStatus status() const { return _status; }
const bool success() const { return _status==FILE_LOADED; }
const bool error() const { return _status==ERROR_IN_READING_FILE; }
const bool notHandled() const { return _status==FILE_NOT_HANDLED; }
protected:
Status _status;
ReadStatus _status;
std::string _message;
osg::ref_ptr<osg::Object> _object;
};
@@ -89,14 +89,14 @@ class OSGDB_EXPORT ReaderWriter : public osg::Referenced
{
public:
enum Status
enum WriteStatus
{
FILE_NOT_HANDLED,
FILE_SAVED,
ERROR_IN_WRITING_FILE
};
WriteResult(Status status=FILE_NOT_HANDLED):_status(status) {}
WriteResult(WriteStatus status=FILE_NOT_HANDLED):_status(status) {}
WriteResult(const std::string& m):_status(ERROR_IN_WRITING_FILE),_message(m) {}
WriteResult(const WriteResult& rr):_status(rr._status),_message(rr._message) {}
@@ -104,14 +104,14 @@ class OSGDB_EXPORT ReaderWriter : public osg::Referenced
const std::string& message() const { return _message; }
const Status status() const { return _status; }
const WriteStatus status() const { return _status; }
const bool success() const { return _status==FILE_SAVED; }
const bool error() const { return _status==ERROR_IN_WRITING_FILE; }
const bool notHandled() const { return _status==FILE_NOT_HANDLED; }
protected:
Status _status;
WriteStatus _status;
std::string _message;
};

View File

@@ -37,9 +37,10 @@ class OSGTEXT_EXPORT Paragraph : public osg::Geode
void setAlignment(int alignment);
int getAlignment() { return _alignment; }
float getHeight() const;
static bool createFormatedText(unsigned int noCharsPerLine,const std::string& str,std::vector<std::string>& formatedText);
protected:
virtual ~Paragraph() {}

View File

@@ -84,9 +84,9 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
/** Get the background color.*/
const osg::Vec4& getBackgroundColor() const { return _backgroundColor; }
void setGlobalState(osg::StateSet* state) { _globalState = state; }
osg::StateSet* getGlobalState() { return _globalState.get(); }
const osg::StateSet* getGlobalState() const { return _globalState.get(); }
void setGlobalStateSet(osg::StateSet* state) { _globalState = state; }
osg::StateSet* getGlobalStateSet() { return _globalState.get(); }
const osg::StateSet* getGlobalStateSet() const { return _globalState.get(); }
enum LightingMode {
HEADLIGHT, // default