00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00035
00036
00037 class EXPCL_PANDAPHYSICS BaseParticleRenderer : public ReferenceCount {
00038 private:
00039 PT(GeomNode) _render_node;
00040
00041 float _user_alpha;
00042
00043
00044
00045
00046
00047
00048
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