OpenSceneGraph 3.6.5
VariableRateCounter
Go to the documentation of this file.
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
24namespace osgParticle
25{
26
28 public:
29 inline VariableRateCounter();
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 virtual int getEstimatedMaxNumOfParticles(double lifeTime) const { return static_cast<int>(_rate_range.maximum * lifeTime); }
41
42 protected:
44
45 private:
46 rangef _rate_range;
47 };
48
49 // INLINE FUNCTIONS
50
52 : Counter(), _rate_range(1, 1)
53 {
54 }
55
57 : Counter(copy, copyop), _rate_range(copy._rate_range)
58 {
59 }
60
62 {
63 return _rate_range;
64 }
65
67 {
68 _rate_range = r;
69 }
70
71 inline void VariableRateCounter::setRateRange(float minrange, float maxrange)
72 {
73 _rate_range.set(minrange, maxrange);
74 }
75
76}
77
78
79#endif
The osgParticle library is a NodeKit that extends the core scene graph to support particle effects.
Definition AccelOperator:27
range< float > rangef
Range of floats.
Definition range:76
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Counter()
Definition Counter:46
void set(const ValueType &mn, const ValueType &mx)
Set min and max.
Definition range:54
virtual const char * className() const
return the name of the object's class type.
Definition VariableRateCounter:33
VariableRateCounter()
Definition VariableRateCounter:51
void setRateRange(const rangef &r)
Definition VariableRateCounter:66
const rangef & getRateRange() const
Definition VariableRateCounter:61
virtual ~VariableRateCounter()
Definition VariableRateCounter:43
virtual bool isSameKindAs(const osg::Object *obj) const
Definition VariableRateCounter:34
virtual const char * libraryName() const
return the name of the object's library.
Definition VariableRateCounter:32
virtual int getEstimatedMaxNumOfParticles(double lifeTime) const
get the esimated maximum number of particles that would be generated duration the lifetime of a parti...
Definition VariableRateCounter:40

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.