Panda3D
 All Classes Functions Variables Enumerations
lineParticleRenderer.h
00001 // Filename: lineParticleRenderer.h
00002 // Created by:  darren (06Oct00)
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 LINEPARTICLERENDERER_H
00016 #define LINEPARTICLERENDERER_H
00017 
00018 #include "baseParticle.h"
00019 #include "baseParticleRenderer.h"
00020 #include "pointerTo.h"
00021 #include "pointerToArray.h"
00022 #include "geom.h"
00023 #include "geomVertexData.h"
00024 #include "geomLines.h"
00025 #include "pStatCollector.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : LineParticleRenderer
00029 // Description : renders a line from last position to current
00030 //               position -- good for rain, sparks, etc.
00031 ////////////////////////////////////////////////////////////////////
00032 
00033 class EXPCL_PANDAPHYSICS LineParticleRenderer : public BaseParticleRenderer {
00034 PUBLISHED:
00035   LineParticleRenderer();
00036   LineParticleRenderer(const LineParticleRenderer& copy);
00037   LineParticleRenderer(const LColor& head,
00038                        const LColor& tail,
00039                        ParticleRendererAlphaMode alpha_mode);
00040 
00041   virtual ~LineParticleRenderer();
00042 
00043 public:
00044   virtual BaseParticleRenderer *make_copy();
00045 
00046 PUBLISHED:
00047   INLINE void set_head_color(const LColor& c);
00048   INLINE void set_tail_color(const LColor& c);
00049 
00050   INLINE const LColor& get_head_color() const;
00051   INLINE const LColor& get_tail_color() const;
00052   
00053   INLINE void set_line_scale_factor(PN_stdfloat sf);
00054   INLINE PN_stdfloat get_line_scale_factor() const;
00055 
00056   virtual void output(ostream &out) const;
00057   virtual void write(ostream &out, int indent_level = 0) const;
00058 
00059 private:
00060   LColor _head_color;
00061   LColor _tail_color;
00062 
00063   PT(Geom) _line_primitive;
00064   PT(GeomLines) _lines;
00065   PT(GeomVertexData) _vdata;
00066 
00067   int _max_pool_size;
00068 
00069   LPoint3 _aabb_min;
00070   LPoint3 _aabb_max;
00071 
00072   PN_stdfloat _line_scale_factor;
00073 
00074   virtual void birth_particle(int index);
00075   virtual void kill_particle(int index);
00076   virtual void init_geoms();
00077   virtual void render(pvector< PT(PhysicsObject) >& po_vector,
00078                       int ttl_particles);
00079   virtual void resize_pool(int new_size);
00080 
00081   static PStatCollector _render_collector;
00082 };
00083 
00084 #include "lineParticleRenderer.I"
00085 
00086 #endif // LINEPARTICLERENDERER_H
 All Classes Functions Variables Enumerations