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)
########################################################################################################
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/Matrixf>
#define OSG_USE_DOUBLE_MATRICES 1
namespace osg {
#ifdef OSG_USE_DOUBLE_MATRICES
typedef Matrixd Matrix;
typedef RefMatrixd RefMatrix;
#else
#ifdef OSG_USE_FLOAT_MATRIX
typedef Matrixf Matrix;
typedef RefMatrixf RefMatrix;
#else
typedef Matrixd Matrix;
typedef RefMatrixd RefMatrix;
#endif
} //namespace osg

View File

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