Changeset 8038

Show
Ignore:
Timestamp:
04/03/08 20:36:50 (4 years ago)
Author:
robert
Message:

Introduced CMake build option for compiling double or float versions of osg::BoundingSphere? and osg::BoundingBox?.

Introduced code in BoundgingSphere?, BoundingBox?, ProxyNode? and LOD to utilise the above settings.

Added Matrix::value_type, Plane::value_type, BoundingSphere::value_type and BoundingBox::value_type command line
options that report where the types of floats or doubles.

Location:
OpenSceneGraph/trunk
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/CMakeLists.txt

    r8019 r8038  
    178178######################################################################################################## 
    179179 
    180 OPTION(OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float matrix instead of double." OFF) 
     180OPTION(OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float Matrix instead of double." OFF) 
    181181MARK_AS_ADVANCED(OSG_USE_FLOAT_MATRIX) 
    182182IF(OSG_USE_FLOAT_MATRIX)         
     
    184184ENDIF(OSG_USE_FLOAT_MATRIX)         
    185185 
    186 OPTION(OSG_USE_FLOAT_PLANE "Set to ON to build OpenSceneGraph with float matrix instead of double." OFF) 
     186OPTION(OSG_USE_FLOAT_PLANE "Set to ON to build OpenSceneGraph with float Plane instead of double." OFF) 
    187187MARK_AS_ADVANCED(OSG_USE_FLOAT_PLANE) 
    188188IF(OSG_USE_FLOAT_PLANE)         
     
    190190ENDIF(OSG_USE_FLOAT_PLANE)         
    191191 
     192OPTION(OSG_USE_FLOAT_BOUNDINGSPHERE "Set to ON to build OpenSceneGraph with float BoundingSphere instead of double." ON) 
     193MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGSPHERE) 
     194IF(NOT OSG_USE_FLOAT_BOUNDINGSPHERE)         
     195    ADD_DEFINITIONS(-DOSG_USE_DOUBLE_BOUNDINGSPHERE) 
     196ENDIF(NOT OSG_USE_FLOAT_BOUNDINGSPHERE)         
     197 
     198OPTION(OSG_USE_FLOAT_BOUNDINGBOX "Set to ON to build OpenSceneGraph with float BoundingBox instead of double." ON) 
     199MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGBOX) 
     200IF(NOT OSG_USE_FLOAT_BOUNDINGBOX)       
     201    ADD_DEFINITIONS(-DOSG_USE_DOUBLE_BOUNDINGBOX) 
     202ENDIF(NOT OSG_USE_FLOAT_BOUNDINGBOX)         
    192203 
    193204################################################################################ 
  • OpenSceneGraph/trunk/applications/osgversion/osgversion.cpp

    r8025 r8038  
    22#include <osg/ArgumentParser> 
    33#include <osg/ApplicationUsage> 
     4 
     5#include <osg/Matrix> 
     6#include <osg/Plane> 
     7#include <osg/BoundingBox> 
     8#include <osg/BoundingSphere> 
     9 
     10 
    411#include <OpenThreads/Version> 
    512 
     
    720727    arguments.getApplicationUsage()->addCommandLineOption("--openthreads-version-number","Print out version number for OpenThreads only"); 
    721728    arguments.getApplicationUsage()->addCommandLineOption("--openthreads-soversion-number","Print out shared object version number for OpenThreads only"); 
     729    arguments.getApplicationUsage()->addCommandLineOption("Matrix::value_type","Print the value of Matrix::value_type"); 
     730    arguments.getApplicationUsage()->addCommandLineOption("Plane::value_type","Print the value of Plane::value_type"); 
     731    arguments.getApplicationUsage()->addCommandLineOption("BoundingSphere::value_type","Print the value of BoundingSphere::value_type"); 
     732    arguments.getApplicationUsage()->addCommandLineOption("BoundingBox::value_type","Print the value of BoundingBox::value_type"); 
    722733    arguments.getApplicationUsage()->addCommandLineOption("-r <file> or --read <file>","Read the ChangeLog to generate an estimated contributors list."); 
    723734 
     
    777788        return 0; 
    778789    } 
    779      
    780790 
    781791    if (arguments.read("--openthreads-soversion-number")) 
    782792    { 
    783793        std::cout<<OpenThreadsGetSOVersion()<<std::endl; 
     794        return 0; 
     795    } 
     796 
     797 
     798    if (arguments.read("Matrix::value_type")) 
     799    { 
     800        std::cout<<((sizeof(osg::Matrix::value_type)==4)?"float":"double")<<std::endl; 
     801        return 0; 
     802    } 
     803 
     804    if (arguments.read("Plane::value_type")) 
     805    { 
     806        std::cout<<((sizeof(osg::Plane::value_type)==4)?"float":"double")<<std::endl; 
     807        return 0; 
     808    } 
     809 
     810    if (arguments.read("BoundingSphere::value_type")) 
     811    { 
     812        std::cout<<((sizeof(osg::BoundingSphere::value_type)==4)?"float":"double")<<std::endl; 
     813        return 0; 
     814    } 
     815    if (arguments.read("BoundingBox::value_type")) 
     816    { 
     817        std::cout<<((sizeof(osg::BoundingBox::value_type)==4)?"float":"double")<<std::endl; 
    784818        return 0; 
    785819    } 
  • OpenSceneGraph/trunk/include/osg/BoundingBox

    r7648 r8038  
    1717#include <osg/Export> 
    1818#include <osg/Vec3> 
     19#include <osg/Vec3d> 
    1920#include <float.h> 
    2021 
     
    3132    public: 
    3233     
     34#ifdef OSG_USE_DOUBLE_BOUNDINGBOX 
     35        typedef Vec3d vec_type; 
     36        typedef doulbe value_type; 
     37#else 
     38        typedef Vec3f vec_type; 
     39        typedef float value_type; 
     40#endif 
     41 
     42     
    3343        /** Minimum extent. (Smallest X, Y, and Z values of all coordinates.) */ 
    34         Vec3 _min; 
     44        vec_type _min; 
    3545        /** Maximum extent. (Greatest X, Y, and Z values of all coordinates.) */ 
    36         Vec3 _max; 
     46        vec_type _max; 
    3747 
    3848        /** Creates an uninitialized bounding box. */ 
     
    4151     
    4252        /** Creates a bounding box initialized to the given extents. */ 
    43         inline BoundingBox(float xmin,float ymin,float zmin, 
    44                     float xmax,float ymax,float zmax) : 
    45                     _min(xmin,ymin,zmin), 
    46                     _max(xmax,ymax,zmax) {} 
     53        inline BoundingBox(value_type xmin, value_type ymin, value_type zmin, 
     54                           value_type xmax, value_type ymax, value_type zmax) : 
     55                           _min(xmin,ymin,zmin), 
     56                           _max(xmax,ymax,zmax) {} 
    4757 
    4858        /** Creates a bounding box initialized to the given extents. */ 
    49         inline BoundingBox(const Vec3& min,const Vec3& max) :  
     59        inline BoundingBox(const vec_type& min,const vec_type& max) :  
    5060                    _min(min), 
    5161                    _max(max) {} 
     
    6575 
    6676        /** Sets the bounding box extents. */ 
    67         inline void set (float xmin,float ymin,float zmin, 
    68                          float xmax,float ymax,float zmax) 
     77        inline void set (value_type xmin, value_type ymin, value_type zmin, 
     78                         value_type xmax, value_type ymax, value_type zmax) 
    6979        { 
    7080            _min.set(xmin,ymin,zmin); 
     
    7383 
    7484        /** Sets the bounding box extents. */ 
    75         inline void set(const Vec3& min,const Vec3& max) 
     85        inline void set(const vec_type& min,const vec_type& max) 
    7686        { 
    7787            _min = min; 
     
    8090 
    8191 
    82         inline float& xMin() { return _min.x(); } 
    83         inline float xMin() const { return _min.x(); } 
    84   
    85         inline float& yMin() { return _min.y(); } 
    86         inline float yMin() const { return _min.y(); } 
    87   
    88         inline float& zMin() { return _min.z(); } 
    89         inline float zMin() const { return _min.z(); } 
    90  
    91         inline float& xMax() { return _max.x(); } 
    92         inline float xMax() const { return _max.x(); } 
    93   
    94         inline float& yMax() { return _max.y(); } 
    95         inline float yMax() const { return _max.y(); } 
    96   
    97         inline float& zMax() { return _max.z(); } 
    98         inline float zMax() const { return _max.z(); } 
     92        inline value_type& xMin() { return _min.x(); } 
     93        inline value_type xMin() const { return _min.x(); } 
     94  
     95        inline value_type& yMin() { return _min.y(); } 
     96        inline value_type yMin() const { return _min.y(); } 
     97  
     98        inline value_type& zMin() { return _min.z(); } 
     99        inline value_type zMin() const { return _min.z(); } 
     100 
     101        inline value_type& xMax() { return _max.x(); } 
     102        inline value_type xMax() const { return _max.x(); } 
     103  
     104        inline value_type& yMax() { return _max.y(); } 
     105        inline value_type yMax() const { return _max.y(); } 
     106  
     107        inline value_type& zMax() { return _max.z(); } 
     108        inline value_type zMax() const { return _max.z(); } 
    99109 
    100110        /** Calculates and returns the bounding box center. */ 
    101         inline const Vec3 center() const 
    102         { 
    103             return (_min+_max)*0.5f; 
     111        inline const vec_type center() const 
     112        { 
     113            return (_min+_max)*0.5; 
    104114        } 
    105115 
    106116        /** Calculates and returns the bounding box radius. */ 
    107         inline float radius() const 
    108         { 
    109             return sqrtf(radius2()); 
     117        inline value_type radius() const 
     118        { 
     119            return sqrt(radius2()); 
    110120        } 
    111121 
    112122        /** Calculates and returns the squared length of the bounding box radius. 
    113123          * Note, radius2() is faster to calculate than radius(). */ 
    114         inline float radius2() const 
    115         { 
    116             return 0.25f*((_max-_min).length2()); 
     124        inline value_type radius2() const 
     125        { 
     126            return 0.25*((_max-_min).length2()); 
    117127        } 
    118128 
     
    122132          * most-significant. Unset bits select the minimum value 
    123133          * for that axis, and set bits select the maximum. */ 
    124         inline const Vec3 corner(unsigned int pos) const 
    125         { 
    126             return Vec3(pos&1?_max.x():_min.x(),pos&2?_max.y():_min.y(),pos&4?_max.z():_min.z()); 
     134        inline const vec_type corner(unsigned int pos) const 
     135        { 
     136            return vec_type(pos&1?_max.x():_min.x(),pos&2?_max.y():_min.y(),pos&4?_max.z():_min.z()); 
    127137        } 
    128138 
    129139        /** Expands the bounding box to include the given coordinate. 
    130140          * If the box is uninitialized, set its min and max extents to v. */ 
    131         inline void expandBy(const Vec3& v) 
     141        inline void expandBy(const vec_type& v) 
    132142        { 
    133143            if(v.x()<_min.x()) _min.x() = v.x(); 
     
    144154          * If the box is uninitialized, set its min and max extents to 
    145155          * Vec3(x,y,z). */ 
    146         inline void expandBy(float x,float y,float z) 
     156        inline void expandBy(value_type x,value_type y,value_type z) 
    147157        { 
    148158            if(x<_min.x()) _min.x() = x; 
     
    181191 
    182192        /** Returns true if this bounding box contains the specified coordinate. */ 
    183         inline bool contains(const Vec3& v) const 
     193        inline bool contains(const vec_type& v) const 
    184194        { 
    185195            return valid() &&  
  • OpenSceneGraph/trunk/include/osg/BoundingSphere

    r5328 r8038  
    1616 
    1717#include <osg/Export> 
    18 #include <osg/Vec3> 
     18#include <osg/Vec3f> 
     19#include <osg/Vec3d> 
    1920 
    2021namespace osg { 
     
    3132{ 
    3233    public: 
     34 
     35#ifdef OSG_USE_DOUBLE_BOUNDINGSPHERE 
     36        typedef Vec3d vec_type; 
     37        typedef double value_type; 
     38#else 
     39        typedef Vec3f vec_type; 
     40        typedef float value_type; 
     41#endif 
    3342         
    34         Vec3 _center; 
    35         float _radius; 
     43        vec_type    _center; 
     44        value_type _radius; 
    3645 
    3746        /** Construct a default bounding sphere with radius to -1.0f, representing an invalid/unset bounding sphere.*/  
    38         BoundingSphere() : _center(0.0f,0.0f,0.0f),_radius(-1.0f) {} 
     47        BoundingSphere() : _center(0.0,0.0,0.0),_radius(-1.0) {} 
    3948     
    4049        /** Creates a bounding sphere initialized to the given extents. */ 
    41         BoundingSphere(const Vec3& center,float radius) : _center(center),_radius(radius) {} 
     50        BoundingSphere(const vec_type& center,value_type radius) : _center(center),_radius(radius) {} 
    4251 
    4352        /** Creates a bounding sphere initialized to the given extents. */ 
     
    4554 
    4655        /** Creates a bounding sphere initialized to the given extents. */ 
    47         BoundingSphere(const BoundingBox& bb) : _center(0.0f,0.0f,0.0f),_radius(-1.0f) { expandBy(bb); } 
     56        BoundingSphere(const BoundingBox& bb) : _center(0.0,0.0,0.0),_radius(-1.0) { expandBy(bb); } 
    4857 
    4958        /** Clear the bounding sphere. Reset to default values. */ 
    5059        inline void init() 
    5160        { 
    52             _center.set(0.0f,0.0f,0.0f); 
    53             _radius = -1.0f; 
     61            _center.set(0.0,0.0,0.0); 
     62            _radius = -1.0; 
    5463        } 
    5564 
    5665        /** Returns true of the bounding sphere extents are valid, false 
    5766          * otherwise. */ 
    58         inline bool valid() const { return _radius>=0.0f; } 
     67        inline bool valid() const { return _radius>=0.0; } 
    5968 
    60         /** Set the bounding sphere to the given center/radius. */  
    61         inline void set(const Vec3& center,float radius) 
     69        /** Set the bounding sphere to the given center/radius using floats. */  
     70        inline void set(const vec_type& center,value_type radius) 
    6271        { 
    6372            _center = center; 
     
    6675 
    6776        /** Returns the center of the bounding sphere. */ 
    68         inline Vec3& center() { return _center; } 
     77        inline vec_type& center() { return _center; } 
     78         
    6979        /** Returns the const center of the bounding sphere. */ 
    70         inline const Vec3& center() const { return _center; } 
     80        inline const vec_type& center() const { return _center; } 
    7181 
    7282        /** Returns the radius of the bounding sphere. */ 
    73         inline float& radius() { return _radius; } 
     83        inline value_type& radius() { return _radius; } 
    7484        /** Returns the const radius of the bounding sphere. */ 
    75         inline float radius() const { return _radius; } 
     85        inline value_type radius() const { return _radius; } 
    7686         
    7787        /** Returns the squared length of the radius. Note, For performance 
    7888          * reasons, the calling method is responsible for checking to make 
    7989          * sure the sphere is valid. */ 
    80         inline float radius2() const { return _radius*_radius; } 
     90        inline value_type radius2() const { return _radius*_radius; } 
    8191 
    8292        /** Expands the sphere to encompass the given point. Repositions the 
    8393          * sphere center to minimize the radius increase. If the sphere is 
    8494          * uninitialized, set its center to v and radius to zero. */ 
    85         void expandBy(const Vec3& v); 
     95        void expandBy(const Vec3f& v); 
    8696 
    8797        /** Expands the sphere to encompass the given point. Does not 
    8898          * reposition the sphere center. If the sphere is 
    8999          * uninitialized, set its center to v and radius to zero. */ 
    90         void expandRadiusBy(const Vec3& v); 
     100        void expandRadiusBy(const Vec3f& v); 
     101 
     102        /** Expands the sphere to encompass the given point. Repositions the 
     103          * sphere center to minimize the radius increase. If the sphere is 
     104          * uninitialized, set its center to v and radius to zero. */ 
     105        void expandBy(const Vec3d& v); 
     106 
     107        /** Expands the sphere to encompass the given point. Does not 
     108          * reposition the sphere center. If the sphere is 
     109          * uninitialized, set its center to v and radius to zero. */ 
     110        void expandRadiusBy(const Vec3d& v); 
    91111 
    92112        /** Expands the sphere to encompass the given sphere. Repositions the 
     
    109129 
    110130        /** Returns true if v is within the sphere. */ 
    111         inline bool contains(const Vec3& v) const 
     131        inline bool contains(const vec_type& v) const 
    112132        { 
    113133            return valid() && ((v-_center).length2()<=radius2()); 
    114134        } 
     135 
    115136 
    116137        /** Returns true if there is a non-empty intersection with the given 
  • OpenSceneGraph/trunk/include/osg/LOD

    r7648 r8038  
    4444        META_Node(osg, LOD); 
    4545 
     46        typedef osg::BoundingSphere::vec_type vec_type; 
     47        typedef osg::BoundingSphere::value_type value_type; 
     48 
    4649        virtual void traverse(NodeVisitor& nv); 
    4750         
     
    7073        /** Sets the object-space point which defines the center of the osg::LOD.   
    7174            center is affected by any transforms in the hierarchy above the osg::LOD.*/ 
    72         inline void setCenter(const Vec3& center) { _centerMode=USER_DEFINED_CENTER; _userDefinedCenter = center; } 
     75        inline void setCenter(const vec_type& center) { _centerMode=USER_DEFINED_CENTER; _userDefinedCenter = center; } 
    7376         
    7477        /** return the LOD center point. */ 
    75         inline const Vec3& getCenter() const { if (_centerMode==USER_DEFINED_CENTER) return _userDefinedCenter; else return getBound().center(); } 
     78        inline const vec_type& getCenter() const { if (_centerMode==USER_DEFINED_CENTER) return _userDefinedCenter; else return getBound().center(); } 
    7679 
    7780 
    7881        /** Set the object-space reference radius of the volume enclosed by the LOD.  
    7982          * Used to determine the bounding sphere of the LOD in the absence of any children.*/ 
    80         inline void setRadius(float radius) { _radius = radius; } 
     83        inline void setRadius(value_type radius) { _radius = radius; } 
    8184         
    8285        /** Get the object-space radius of the volume enclosed by the LOD.*/ 
    83         inline float getRadius() const { return _radius; } 
     86        inline value_type getRadius() const { return _radius; } 
    8487 
    8588 
     
    125128 
    126129        CenterMode                      _centerMode; 
    127         Vec3                            _userDefinedCenter; 
    128         float                           _radius; 
     130        vec_type                        _userDefinedCenter; 
     131        value_type                      _radius; 
    129132 
    130133        RangeMode                       _rangeMode; 
  • OpenSceneGraph/trunk/include/osg/ProxyNode

    r7881 r8038  
    3232        META_Node(osg, ProxyNode); 
    3333         
     34        typedef osg::BoundingSphere::vec_type vec_type; 
     35        typedef osg::BoundingSphere::value_type value_type; 
     36 
    3437        virtual void traverse(NodeVisitor& nv); 
    3538        
     
    8285         
    8386        /** return the ProxyNode center point. */ 
    84         inline const Vec3& getCenter() const { if (_centerMode==USER_DEFINED_CENTER) return _userDefinedCenter; else return getBound().center(); } 
     87        inline const vec_type& getCenter() const { if (_centerMode==USER_DEFINED_CENTER) return _userDefinedCenter; else return getBound().center(); } 
    8588 
    8689 
    8790        /** Set the object-space reference radius of the volume enclosed by the ProxyNode.  
    8891          * Used to determine the bounding sphere of the ProxyNode in the absence of any children.*/ 
    89         inline void setRadius(float radius) { _radius = radius; } 
     92        inline void setRadius(value_type radius) { _radius = radius; } 
    9093         
    9194        /** Get the object-space radius of the volume enclosed by the ProxyNode.*/ 
    92         inline float getRadius() const { return _radius; } 
     95        inline value_type getRadius() const { return _radius; } 
    9396 
    9497        virtual BoundingSphere computeBound() const; 
     
    106109         
    107110        CenterMode          _centerMode; 
    108         Vec3                _userDefinedCenter; 
    109         float               _radius; 
     111        vec_type            _userDefinedCenter; 
     112        value_type          _radius; 
    110113         
    111114}; 
  • OpenSceneGraph/trunk/include/osg/Vec4d

    r7648 r8038  
    249249} 
    250250 
     251/** Compute the dot product of a (Vec3,1.0) and a Vec4d. */ 
     252inline Vec4d::value_type operator * (const Vec3f& lhs,const Vec4d& rhs) 
     253{ 
     254    return lhs[0]*rhs[0]+lhs[1]*rhs[1]+lhs[2]*rhs[2]+rhs[3]; 
     255} 
     256 
     257/** Compute the dot product of a (Vec3,1.0) and a Vec4d. */ 
     258inline Vec4d::value_type operator * (const Vec3d& lhs,const Vec4f& rhs) 
     259{ 
     260    return lhs[0]*rhs[0]+lhs[1]*rhs[1]+lhs[2]*rhs[2]+rhs[3]; 
     261} 
     262 
     263 
    251264/** Compute the dot product of a Vec4d and a (Vec3,1.0). */ 
    252265inline Vec4d::value_type operator * (const Vec4d& lhs,const Vec3d& rhs) 
     
    255268} 
    256269 
     270/** Compute the dot product of a Vec4d and a (Vec3,1.0). */ 
     271inline Vec4d::value_type operator * (const Vec4d& lhs,const Vec3f& rhs) 
     272{ 
     273    return lhs[0]*rhs[0]+lhs[1]*rhs[1]+lhs[2]*rhs[2]+lhs[3]; 
     274} 
     275 
     276/** Compute the dot product of a Vec4d and a (Vec3,1.0). */ 
     277inline Vec4d::value_type operator * (const Vec4f& lhs,const Vec3d& rhs) 
     278{ 
     279    return lhs[0]*rhs[0]+lhs[1]*rhs[1]+lhs[2]*rhs[2]+lhs[3]; 
     280} 
     281 
    257282}    // end of namespace osg 
    258283 
  • OpenSceneGraph/trunk/src/osg/BoundingSphere.cpp

    r6050 r8038  
    1616using namespace osg; 
    1717 
    18 void BoundingSphere::expandBy(const Vec3& v) 
    19 { 
    20     if (valid()) 
    21     { 
    22         Vec3 dv = v-_center; 
    23         float r = dv.length(); 
     18void BoundingSphere::expandBy(const Vec3f& v) 
     19{ 
     20    if (valid()) 
     21    { 
     22        vec_type dv = v-_center; 
     23        value_type r = dv.length(); 
    2424        if (r>_radius) 
    2525        { 
    26             float dr = (r-_radius)*0.5f; 
     26            value_type dr = (r-_radius)*0.5; 
    2727            _center += dv*(dr/r); 
    2828            _radius += dr; 
     
    3232    { 
    3333        _center = v; 
    34         _radius = 0.0f; 
    35     } 
    36 } 
    37  
    38  
    39 void BoundingSphere::expandRadiusBy(const Vec3& v) 
    40 { 
    41     if (valid()) 
    42     { 
    43         float r = (v-_center).length(); 
     34        _radius = 0.0; 
     35    } 
     36} 
     37 
     38 
     39void BoundingSphere::expandRadiusBy(const Vec3f& v) 
     40{ 
     41    if (valid()) 
     42    { 
     43        value_type r = (v-_center).length(); 
    4444        if (r>_radius) _radius = r; 
    4545        // else do nothing as vertex is within sphere. 
     
    4848    { 
    4949        _center = v; 
    50         _radius = 0.0f; 
    51     } 
    52 } 
     50        _radius = 0.0; 
     51    } 
     52} 
     53 
     54 
     55 
     56void BoundingSphere::expandBy(const Vec3d& v) 
     57{ 
     58    if (valid()) 
     59    { 
     60        vec_type dv = v-_center; 
     61        value_type r = dv.length(); 
     62        if (r>_radius) 
     63        { 
     64            value_type dr = (r-_radius)*0.5; 
     65            _center += dv*(dr/r); 
     66            _radius += dr; 
     67        } // else do nothing as vertex is within sphere. 
     68    } 
     69    else 
     70    { 
     71        _center = v; 
     72        _radius = 0.0; 
     73    } 
     74} 
     75 
     76 
     77void BoundingSphere::expandRadiusBy(const Vec3d& v) 
     78{ 
     79    if (valid()) 
     80    { 
     81        value_type r = (v-_center).length(); 
     82        if (r>_radius) _radius = r; 
     83        // else do nothing as vertex is within sphere. 
     84    } 
     85    else 
     86    { 
     87        _center = v; 
     88        _radius = 0.0; 
     89    } 
     90} 
     91 
    5392 
    5493 
     
    108147        if (valid()) 
    109148        { 
    110             float r = (sh._center-_center).length()+sh._radius; 
     149            value_type r = (sh._center-_center).length()+sh._radius; 
    111150            if (r>_radius) _radius = r; 
    112151            // else do nothing as vertex is within sphere. 
  • OpenSceneGraph/trunk/src/osgGA/NodeTrackerManipulator.cpp

    r7102 r8038  
    106106        const float minimumDistanceScale = 0.001f; 
    107107        _minimumDistance = osg::clampBetween( 
    108             boundingSphere._radius * minimumDistanceScale, 
     108            float(boundingSphere._radius) * minimumDistanceScale, 
    109109            0.00001f,1.0f); 
    110110             
  • OpenSceneGraph/trunk/src/osgGA/TerrainManipulator.cpp

    r7792 r8038  
    5252        const float minimumDistanceScale = 0.001f; 
    5353        _minimumDistance = osg::clampBetween( 
    54             boundingSphere._radius * minimumDistanceScale, 
     54            float(boundingSphere._radius) * minimumDistanceScale, 
    5555            0.00001f,1.0f); 
    5656 
  • OpenSceneGraph/trunk/src/osgPlugins/Inventor/ConvertToInventor.cpp

    r7782 r8038  
    19951995 
    19961996    // set center 
    1997     lod->center.setValue(node.getCenter().ptr()); 
     1997    osg::Vec3f center(node.getCenter()); 
     1998    lod->center.setValue(center.ptr()); 
    19981999 
    19992000    ivLOD = lod;