From dd796df02accf7433cabec3a677cdf5a49579baa Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 20 May 2007 11:45:09 +0000 Subject: [PATCH] Added support for SG_USE_FLOAT_MATRIX and OSG_USE_FLOAT_PLANE in CMake build and include/osg/Matrix and include/osg/Plane. --- CMakeLists.txt | 11 +++++++++++ include/osg/Matrix | 11 ++++------- include/osg/Plane | 14 ++++++-------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80e3aeb15..497b8802f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) ################################################################################ diff --git a/include/osg/Matrix b/include/osg/Matrix index 6ac8f5462..18d923b19 100644 --- a/include/osg/Matrix +++ b/include/osg/Matrix @@ -17,17 +17,14 @@ #include #include -#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 diff --git a/include/osg/Plane b/include/osg/Plane index c6ce44ee2..278716fa4 100644 --- a/include/osg/Plane +++ b/include/osg/Plane @@ -23,8 +23,6 @@ #include -#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. */