| 1 | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield |
|---|
| 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 |
|---|
| 5 | * (at your option) any later version. The full license is in LICENSE file |
|---|
| 6 | * included with this distribution, and on the openscenegraph.org website. |
|---|
| 7 | * |
|---|
| 8 | * This library is distributed in the hope that it will be useful, |
|---|
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 | * OpenSceneGraph Public License for more details. |
|---|
| 12 | */ |
|---|
| 13 | //osgParticle - Copyright (C) 2002 Marco Jez |
|---|
| 14 | |
|---|
| 15 | #ifndef OSGPARTICLE_VARIABLERATE_COUNTER |
|---|
| 16 | #define OSGPARTICLE_VARIABLERATE_COUNTER 1 |
|---|
| 17 | |
|---|
| 18 | #include <osgParticle/Counter> |
|---|
| 19 | #include <osgParticle/range> |
|---|
| 20 | |
|---|
| 21 | #include <osg/CopyOp> |
|---|
| 22 | #include <osg/Object> |
|---|
| 23 | |
|---|
| 24 | namespace osgParticle |
|---|
| 25 | { |
|---|
| 26 | |
|---|
| 27 | class VariableRateCounter: public Counter { |
|---|
| 28 | public: |
|---|
| 29 | inline VariableRateCounter(); |
|---|
| 30 | inline VariableRateCounter(const VariableRateCounter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); |
|---|
| 31 | |
|---|
| 32 | virtual const char* libraryName() const { return "osgParticle"; } |
|---|
| 33 | virtual const char* className() const { return "VariableRateCounter"; } |
|---|
| 34 | virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const VariableRateCounter *>(obj) != 0; } |
|---|
| 35 | |
|---|
| 36 | inline const rangef& getRateRange() const; |
|---|
| 37 | inline void setRateRange(const rangef& r); |
|---|
| 38 | inline void setRateRange(float minrange, float maxrange); |
|---|
| 39 | |
|---|
| 40 | protected: |
|---|
| 41 | virtual ~VariableRateCounter() {} |
|---|
| 42 | |
|---|
| 43 | private: |
|---|
| 44 | rangef _rate_range; |
|---|
| 45 | }; |
|---|
| 46 | |
|---|
| 47 | // INLINE FUNCTIONS |
|---|
| 48 | |
|---|
| 49 | inline VariableRateCounter::VariableRateCounter() |
|---|
| 50 | : Counter(), _rate_range(1, 1) |
|---|
| 51 | { |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | inline VariableRateCounter::VariableRateCounter(const VariableRateCounter& copy, const osg::CopyOp& copyop) |
|---|
| 55 | : Counter(copy, copyop), _rate_range(copy._rate_range) |
|---|
| 56 | { |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | inline const rangef &VariableRateCounter::getRateRange() const |
|---|
| 60 | { |
|---|
| 61 | return _rate_range; |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | inline void VariableRateCounter::setRateRange(const rangef& r) |
|---|
| 65 | { |
|---|
| 66 | _rate_range = r; |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | inline void VariableRateCounter::setRateRange(float minrange, float maxrange) |
|---|
| 70 | { |
|---|
| 71 | _rate_range.set(minrange, maxrange); |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | #endif |
|---|