00001 // Filename: lineParticleRenderer.h 00002 // Created by: darren (06Oct00) 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 LINEPARTICLERENDERER_H 00020 #define LINEPARTICLERENDERER_H 00021 00022 #include "baseParticle.h" 00023 #include "baseParticleRenderer.h" 00024 00025 #include <pointerTo.h> 00026 #include <pointerToArray.h> 00027 #include <geom.h> 00028 #include <geomLine.h> 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : LineParticleRenderer 00032 // Description : renders a line from last position to current 00033 // position -- good for rain, sparks, etc. 00034 //////////////////////////////////////////////////////////////////// 00035 00036 class EXPCL_PANDAPHYSICS LineParticleRenderer : public BaseParticleRenderer { 00037 private: 00038 00039 Colorf _head_color; 00040 Colorf _tail_color; 00041 00042 PT(GeomLine) _line_primitive; 00043 00044 PTA_Vertexf _vertex_array; 00045 PTA_Colorf _color_array; 00046 00047 int _max_pool_size; 00048 00049 LPoint3f _aabb_min, _aabb_max; 00050 00051 virtual void birth_particle(int index); 00052 virtual void kill_particle(int index); 00053 virtual void init_geoms(void); 00054 virtual void render(pvector< PT(PhysicsObject) >& po_vector, 00055 int ttl_particles); 00056 virtual void resize_pool(int new_size); 00057 00058 PUBLISHED: 00059 LineParticleRenderer(void); 00060 LineParticleRenderer(const LineParticleRenderer& copy); 00061 LineParticleRenderer(const Colorf& head, 00062 const Colorf& tail, 00063 ParticleRendererAlphaMode alpha_mode); 00064 00065 virtual ~LineParticleRenderer(void); 00066 00067 virtual BaseParticleRenderer *make_copy(void); 00068 00069 INLINE void set_head_color(const Colorf& c); 00070 INLINE void set_tail_color(const Colorf& c); 00071 00072 INLINE const Colorf& get_head_color(void) const; 00073 INLINE const Colorf& get_tail_color(void) const; 00074 }; 00075 00076 #include "lineParticleRenderer.I" 00077 00078 #endif // LINEPARTICLERENDERER_H