Integrated changes for MacOSX, submitted by Phil Atkin, with small mods by
Robert Osfield to maintain compatability under Linux.
This commit is contained in:
@@ -5,7 +5,11 @@
|
||||
|
||||
// non windows, doesn't require nonsense as seen below :-)
|
||||
#ifndef __gl_h_
|
||||
#include <GL/gl.h>
|
||||
#ifdef __APPLE_CC__
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// required for compatibility with glext.h sytle function definitions of
|
||||
|
||||
10
include/osg/GLU
Normal file
10
include/osg/GLU
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef OSG_GLU
|
||||
#define OSG_GL 1
|
||||
|
||||
#ifdef __APPLE_CC__
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
#endif // __osgGL_h
|
||||
72
include/osg/Math
Normal file
72
include/osg/Math
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef __OSG_MATH
|
||||
#define __OSG_MATH
|
||||
|
||||
#include <math.h>
|
||||
|
||||
// #define USE_DEGREES_INTERNALLY
|
||||
|
||||
#if defined(WIN32) || defined (macintosh)
|
||||
#define M_E 2.7182818284590452354
|
||||
#define M_LOG2E 1.4426950408889634074
|
||||
#define M_LOG10E 0.43429448190325182765
|
||||
#define M_LN2 0.69314718055994530942
|
||||
#define M_LN10 2.30258509299404568402
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
#define M_PI_4 0.78539816339744830962
|
||||
#define M_1_PI 0.31830988618379067154
|
||||
#define M_2_PI 0.63661977236758134308
|
||||
#define M_2_SQRTPI 1.12837916709551257390
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
#define M_SQRT1_2 0.70710678118654752440
|
||||
#endif
|
||||
|
||||
// PJA MAC OSX
|
||||
// This appears to be the simplest way to get these defined under MACOSX
|
||||
// where they arent in math.h
|
||||
|
||||
#ifndef acosf
|
||||
#define acosf acos
|
||||
#endif
|
||||
|
||||
#ifndef asinf
|
||||
#define asinf asin
|
||||
#endif
|
||||
|
||||
#ifndef cosf
|
||||
#define cosf cos
|
||||
#endif
|
||||
|
||||
#ifndef sinf
|
||||
#define sinf sin
|
||||
#endif
|
||||
|
||||
#ifndef logf
|
||||
#define logf log
|
||||
#endif
|
||||
|
||||
#ifndef floorf
|
||||
#define floorf floor
|
||||
#endif
|
||||
|
||||
#ifndef powf
|
||||
#define powf pow
|
||||
#endif
|
||||
|
||||
#ifndef sqrtf
|
||||
#define sqrtf sqrt
|
||||
#endif
|
||||
|
||||
namespace osg {
|
||||
|
||||
#ifdef USE_DEGREES_INTERNALLY
|
||||
inline double inDegrees(float angle) { return angle; }
|
||||
inline double inRadians(float angle) { return angle*180.0/M_PI; }
|
||||
#else
|
||||
inline double inDegrees(float angle) { return angle*M_PI/180.0; }
|
||||
inline double inRadians(float angle) { return angle; }
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif // __OSG_MATH
|
||||
@@ -34,6 +34,12 @@ enum NotifySeverity {
|
||||
/** global notify level. */
|
||||
SG_EXPORT extern NotifySeverity g_NotifyLevel;
|
||||
|
||||
/** global notify nul stream. added for Mac OSX */
|
||||
SG_EXPORT extern ofstream *g_NotifyNulStream;
|
||||
|
||||
/** global notify nul stream. added for Mac OSX */
|
||||
SG_EXPORT extern bool g_NotifyInit;
|
||||
|
||||
/** set the notify level, overriding the default or value set by
|
||||
* the environmental variable OSGNOTIFYLEVEL.
|
||||
*/
|
||||
@@ -59,31 +65,25 @@ SG_EXPORT extern bool initNotifyLevel();
|
||||
* with your code simply use the notify function as a normal file
|
||||
* stream (like cout) i.e osg::notify(osg::DEBUG) << "Hello Bugs!"<<endl;
|
||||
*/
|
||||
inline ostream& notify(const NotifySeverity severity=INFO)
|
||||
|
||||
//
|
||||
// PJA MAC OSX 30-09-01
|
||||
// previous implementation was causing Mac OSX to misbehave. This version
|
||||
// places less stress on compiler and runs on Mac
|
||||
|
||||
inline ostream& notify(const NotifySeverity severity)
|
||||
{
|
||||
static bool s_initialized = initNotifyLevel();
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* a little hack to prevent gcc's warning message (will be optimized away) */
|
||||
if ( 0 && s_initialized )
|
||||
;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
static ofstream s_abosorbStr("nul");
|
||||
#else
|
||||
static ofstream s_abosorbStr("/dev/null");
|
||||
#endif
|
||||
if (!g_NotifyInit) initNotifyLevel();
|
||||
|
||||
if (severity<=g_NotifyLevel)
|
||||
{
|
||||
if (severity<=osg::WARN) return cerr;
|
||||
else return cout;
|
||||
}
|
||||
return s_abosorbStr;
|
||||
return *osg::g_NotifyNulStream;
|
||||
}
|
||||
|
||||
inline ostream& notify(void) { return notify(osg::INFO); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace osg {
|
||||
typedef unsigned long long Timer_t;
|
||||
#elif defined(unix)
|
||||
typedef unsigned long long Timer_t;
|
||||
#elif defined __APPLE__ // MACOSX PJA
|
||||
typedef double Timer_t;
|
||||
#else
|
||||
#include <ctime>
|
||||
typedef std::clock_t Timer_t;
|
||||
@@ -27,8 +29,14 @@ class SG_EXPORT Timer {
|
||||
Timer();
|
||||
~Timer() {}
|
||||
|
||||
inline Timer_t tick();
|
||||
|
||||
#ifdef __APPLE__
|
||||
// PJA MAC OSX - inline Tick() pollutes namespace so badly
|
||||
// we cant compile, due to Carbon.h ...
|
||||
Timer_t tick();
|
||||
#else
|
||||
inline Timer_t tick();
|
||||
#endif
|
||||
|
||||
inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*_secsPerClick; }
|
||||
inline double delta_m( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e3; }
|
||||
inline double delta_u( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e6; }
|
||||
@@ -138,7 +146,7 @@ namespace osg{
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
#elif !defined (__APPLE_CC__)
|
||||
|
||||
// no choice, always use std::clock()
|
||||
|
||||
@@ -149,4 +157,6 @@ namespace osg{
|
||||
|
||||
#endif
|
||||
|
||||
// note, MacOSX compiled in the Timer.cpp.
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,34 +8,6 @@ typedef unsigned short ushort;
|
||||
typedef unsigned char uchar;
|
||||
typedef uchar ubyte;
|
||||
|
||||
#if defined(WIN32) || defined (macintosh)
|
||||
#define M_E 2.7182818284590452354
|
||||
#define M_LOG2E 1.4426950408889634074
|
||||
#define M_LOG10E 0.43429448190325182765
|
||||
#define M_LN2 0.69314718055994530942
|
||||
#define M_LN10 2.30258509299404568402
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
#define M_PI_4 0.78539816339744830962
|
||||
#define M_1_PI 0.31830988618379067154
|
||||
#define M_2_PI 0.63661977236758134308
|
||||
#define M_2_SQRTPI 1.12837916709551257390
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
#define M_SQRT1_2 0.70710678118654752440
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#define USE_DEGREES_INTERNALLY
|
||||
|
||||
#ifdef USE_DEGREES_INTERNALLY
|
||||
inline double inDegrees(float angle) { return angle; }
|
||||
inline double inRadians(float angle) { return angle*180.0/M_PI; }
|
||||
#else
|
||||
inline double inDegrees(float angle) { return angle*M_PI/180.0; }
|
||||
inline double inRadians(float angle) { return angle; }
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef OSG_VEC2
|
||||
#define OSG_VEC2 1
|
||||
|
||||
#include <math.h>
|
||||
#include <osg/Math>
|
||||
|
||||
#ifdef OSG_USE_IO_DOT_H
|
||||
#include <iostream.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef OSG_VEC3
|
||||
#define OSG_VEC3 1
|
||||
|
||||
#include <math.h>
|
||||
#include <osg/Math>
|
||||
|
||||
#ifdef OSG_USE_IO_DOT_H
|
||||
#include <iostream.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef OSG_VEC4
|
||||
#define OSG_VEC4 1
|
||||
|
||||
#include <math.h>
|
||||
#include <osg/Math>
|
||||
|
||||
#ifdef OSG_USE_IO_DOT_H
|
||||
#include <iostream.h>
|
||||
|
||||
10
include/osgGLUT/glut
Normal file
10
include/osgGLUT/glut
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef OSG_GLU
|
||||
#define OSG_GL 1
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include </System/Library/Frameworks/GLUT.Framework/Versions/A/Headers/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
#endif // __osgGL_h
|
||||
Reference in New Issue
Block a user