Changeset 13041 for OpenSceneGraph/trunk/include/osgParticle/range
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osgParticle/range (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgParticle/range
r7092 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 31 31 A simple struct template useful to store ranges of values as min/max pairs. 32 32 This struct template helps storing min/max ranges for values of any kind; class <CODE>ValueType</CODE> is 33 the type of values to be stored, and it must support operations <CODE>ValueType + ValueType</CODE>, <CODE>ValueType - ValueType</CODE>, 33 the type of values to be stored, and it must support operations <CODE>ValueType + ValueType</CODE>, <CODE>ValueType - ValueType</CODE>, 34 34 and <CODE>ValueType * float</CODE>, otherwise the <CODE>geValueTyperandom()</CODE> method will not compile. 35 This struct could be extended to customize the random number generator (now it uses only 35 This struct could be extended to customize the random number generator (now it uses only 36 36 <CODE>std::rand()</CODE>). 37 37 */ 38 38 template<class ValueType> struct range 39 39 { 40 40 41 41 /// Lower bound. 42 42 ValueType minimum; 43 43 44 44 /// Higher bound. 45 45 ValueType maximum; … … 47 47 /// Construct the object by calling default constructors for min and max. 48 48 range() : minimum(ValueType()), maximum(ValueType()) {} 49 49 50 50 /// Construct and initialize min and max directly. 51 51 range(const ValueType& mn, const ValueType& mx) : minimum(mn), maximum(mx) {} … … 65 65 return minimum + (maximum - minimum) * sqrtf( static_cast<float>(rand()) / static_cast<float>(RAND_MAX) ); 66 66 } 67 67 68 68 ValueType mid() const 69 69 { … … 75 75 /// Range of floats. 76 76 typedef range<float> rangef; 77 77 78 78 /// Range of osg::Vec2s. 79 79 typedef range<osg::Vec2> rangev2; 80 80 81 81 /// Range of osg::Vec3s. 82 82 typedef range<osg::Vec3> rangev3; 83 83 84 84 /// Range of osg::Vec4s. 85 85 typedef range<osg::Vec4> rangev4;
