Panda3D
 All Classes Functions Variables Enumerations
baseParticle.h
00001 // Filename: baseParticle.h
00002 // Created by:  charles (14Jun00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef BASEPARTICLE_H
00016 #define BASEPARTICLE_H
00017 
00018 #include "pandabase.h"
00019 #include "physicsObject.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //       Class : BaseParticle
00023 // Description : An individual, physically-modelable particle
00024 //               abstract base class.
00025 ////////////////////////////////////////////////////////////////////
00026 class EXPCL_PANDAPHYSICS BaseParticle : public PhysicsObject {
00027 public:
00028   // local methods
00029   INLINE void set_age(PN_stdfloat age);
00030   INLINE void set_lifespan(PN_stdfloat lifespan);
00031   INLINE void set_alive(bool alive);
00032   INLINE void set_index(int index);
00033 
00034 
00035   INLINE PN_stdfloat get_age() const;
00036   INLINE PN_stdfloat get_lifespan() const;
00037   INLINE bool get_alive() const;
00038   INLINE int get_index() const; 
00039 
00040   INLINE PN_stdfloat get_parameterized_age() const;
00041   INLINE PN_stdfloat get_parameterized_vel() const;
00042 
00043   // child methods
00044   virtual void init() = 0;
00045   virtual void die() = 0;
00046   virtual void update() = 0;
00047 
00048   // for spriteParticleRenderer
00049   virtual PN_stdfloat get_theta() const;
00050 
00051   // from PhysicsObject
00052   virtual PhysicsObject *make_copy() const = 0;
00053 
00054   virtual void output(ostream &out) const;
00055   virtual void write(ostream &out, int indent=0) const;
00056 
00057 protected:
00058   BaseParticle(PN_stdfloat lifespan = 1.0f, bool alive = false);
00059   BaseParticle(const BaseParticle &copy);
00060   virtual ~BaseParticle();
00061 
00062 private:
00063   // NOTE: age and lifespan are in seconds.
00064   PN_stdfloat _age;
00065   PN_stdfloat _lifespan;
00066   bool _alive;
00067   int _index;
00068 
00069   LPoint3 _last_position;
00070 };
00071 
00072 #include "baseParticle.I"
00073 
00074 #endif // BASEPARTICLE_H
 All Classes Functions Variables Enumerations