Counter 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #ifndef OSGPARTICLE_COUNTER
  15. #define OSGPARTICLE_COUNTER 1
  16. #include <osg/CopyOp>
  17. #include <osg/Object>
  18. namespace osgParticle
  19. {
  20. class Counter: public osg::Object {
  21. public:
  22. inline Counter();
  23. inline Counter(const Counter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
  24. virtual const char* libraryName() const { return "osgParticle"; }
  25. virtual const char* className() const { return "Counter"; }
  26. virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Counter* >(obj) != 0; }
  27. /** get the number of particle of create for current frame.*/
  28. virtual int numParticlesToCreate(double dt) const = 0;
  29. /** get the esimated maximum number of particles that would be generated duration the lifetime of a particle before it expires.*/
  30. virtual int getEstimatedMaxNumOfParticles(double lifeTime) const = 0;
  31. protected:
  32. ~Counter() {}
  33. Counter &operator=(const Counter &) { return *this; }
  34. };
  35. // INLINE FUNCTIONS
  36. inline Counter::Counter()
  37. : osg::Object()
  38. {
  39. }
  40. inline Counter::Counter(const Counter& copy, const osg::CopyOp& copyop)
  41. : osg::Object(copy, copyop)
  42. {
  43. }
  44. }
  45. #endif