Added support for SG_USE_FLOAT_MATRIX and OSG_USE_FLOAT_PLANE in CMake build and

include/osg/Matrix and include/osg/Plane.
This commit is contained in:
Robert Osfield 2007-05-20 11:45:09 +00:00
parent 732685d125
commit dd796df02a
3 changed files with 21 additions and 15 deletions

View File

@ -108,6 +108,17 @@ ENDIF(WIN32)
#luigi#ENDIF(UNIX) #luigi#ENDIF(UNIX)
######################################################################################################## ########################################################################################################
OPTION(OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float matrix instead of double." OFF)
MARK_AS_ADVANCED(OSG_USE_FLOAT_MATRIX)
IF(OSG_USE_FLOAT_MATRIX)
ADD_DEFINITIONS(-DOSG_USE_FLOAT_MATRIX)
ENDIF(OSG_USE_FLOAT_MATRIX)
OPTION(OSG_USE_FLOAT_PLANE "Set to ON to build OpenSceneGraph with float matrix instead of double." OFF)
MARK_AS_ADVANCED(OSG_USE_FLOAT_PLANE)
IF(OSG_USE_FLOAT_PLANE)
ADD_DEFINITIONS(-DOSG_USE_FLOAT_PLANE)
ENDIF(OSG_USE_FLOAT_PLANE)
################################################################################ ################################################################################

View File

@ -17,17 +17,14 @@
#include <osg/Matrixd> #include <osg/Matrixd>
#include <osg/Matrixf> #include <osg/Matrixf>
#define OSG_USE_DOUBLE_MATRICES 1
namespace osg { namespace osg {
#ifdef OSG_USE_DOUBLE_MATRICES #ifdef OSG_USE_FLOAT_MATRIX
typedef Matrixd Matrix;
typedef RefMatrixd RefMatrix;
#else
typedef Matrixf Matrix; typedef Matrixf Matrix;
typedef RefMatrixf RefMatrix; typedef RefMatrixf RefMatrix;
#else
typedef Matrixd Matrix;
typedef RefMatrixd RefMatrix;
#endif #endif
} //namespace osg } //namespace osg

View File

@ -23,8 +23,6 @@
#include <vector> #include <vector>
#define OSG_USE_DOUBLE_PLANE 1
namespace osg { namespace osg {
/** A plane class. It can be used to represent an infinite plane.*/ /** A plane class. It can be used to represent an infinite plane.*/
@ -33,16 +31,16 @@ class OSG_EXPORT Plane
public: public:
#ifdef OSG_USE_DOUBLE_PLANE #ifdef OSG_USE_FLOAT_PLANE
/** Type of Plane class.*/
typedef double value_type;
typedef Vec3d Vec3_type;
typedef Vec4d Vec4_type;
#else
/** Type of Plane class.*/ /** Type of Plane class.*/
typedef float value_type; typedef float value_type;
typedef Vec3f Vec3_type; typedef Vec3f Vec3_type;
typedef Vec4f Vec4_type; typedef Vec4f Vec4_type;
#else
/** Type of Plane class.*/
typedef double value_type;
typedef Vec3d Vec3_type;
typedef Vec4d Vec4_type;
#endif #endif
/** Number of vector components. */ /** Number of vector components. */