Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/particlesystem/baseParticleRenderer.h

Go to the documentation of this file.
00001 // Filename: baseParticleRenderer.h
00002 // Created by:  charles (20Jun00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef BASEPARTICLERENDERER_H
00020 #define BASEPARTICLERENDERER_H
00021 
00022 #include "pandabase.h"
00023 #include "referenceCount.h"
00024 #include "physicsObject.h"
00025 #include "renderState.h"
00026 #include "geomNode.h"
00027 
00028 #include "particleCommonFuncs.h"
00029 #include "baseParticle.h"
00030 
00031 #include "pvector.h"
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //       Class : BaseParticleRenderer
00035 // Description : Pure virtual particle renderer base class
00036 ////////////////////////////////////////////////////////////////////
00037 class EXPCL_PANDAPHYSICS BaseParticleRenderer : public ReferenceCount {
00038 private:
00039   PT(GeomNode) _render_node;
00040 
00041   float _user_alpha;
00042 
00043   // birth and kill particle are for renderers that might do maintenance
00044   // faster if it was notified on a per-event basis.  An example:
00045   // geomParticleRenderer maintains an arc for every particle.  Instead
00046   // of visiting EVERY entry in the arc array, individual arcs are
00047   // changed on birth and death.  Brings it down a little from O(N) every
00048   // update.
00049 
00050   virtual void birth_particle(int index) = 0;
00051   virtual void kill_particle(int index) = 0;
00052 
00053 
00054   virtual void init_geoms(void) = 0;
00055   virtual void render(pvector< PT(PhysicsObject) >& po_vector,
00056                       int ttl_particles) = 0;
00057 
00058 PUBLISHED:
00059   enum ParticleRendererAlphaMode {
00060     PR_ALPHA_NONE,
00061     PR_ALPHA_OUT,
00062     PR_ALPHA_IN,
00063     PR_ALPHA_USER,
00064     PR_NOT_INITIALIZED_YET
00065   };
00066 
00067   enum ParticleRendererBlendMethod {
00068     PP_NO_BLEND,
00069     PP_BLEND_LINEAR,
00070     PP_BLEND_CUBIC
00071   };
00072 
00073   virtual ~BaseParticleRenderer(void);
00074 
00075   INLINE GeomNode *get_render_node(void) const;
00076 
00077   INLINE void set_alpha_mode(ParticleRendererAlphaMode am);
00078   INLINE ParticleRendererAlphaMode get_alpha_mode(void) const;
00079 
00080   INLINE void set_user_alpha(float ua);
00081   INLINE float get_user_alpha(void) const;
00082 
00083 protected:
00084   ParticleRendererAlphaMode _alpha_mode;
00085 
00086   BaseParticleRenderer(ParticleRendererAlphaMode alpha_decay = PR_ALPHA_NONE);
00087   BaseParticleRenderer(const BaseParticleRenderer& copy);
00088 
00089   void update_alpha_mode(ParticleRendererAlphaMode am);
00090 
00091   void enable_alpha(void);
00092   void disable_alpha(void);
00093 
00094   INLINE float get_cur_alpha(BaseParticle* bp);
00095 
00096   virtual void resize_pool(int new_size) = 0;
00097 
00098   CPT(RenderState) _render_state;
00099 
00100 public:
00101   virtual BaseParticleRenderer *make_copy(void) = 0;
00102 
00103   friend class ParticleSystem;
00104 };
00105 
00106 #include "baseParticleRenderer.I"
00107 
00108 #endif // BASEPARTICLERENDERER_H
00109 

Generated on Fri May 2 00:40:55 2003 for Panda by doxygen1.3