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

panda/src/particlesystem/pointParticleRenderer.h

Go to the documentation of this file.
00001 // Filename: pointParticleRenderer.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 POINTPARTICLERENDERER_H
00020 #define POINTPARTICLERENDERER_H
00021 
00022 #include "baseParticleRenderer.h"
00023 #include "baseParticle.h"
00024 
00025 #include <pointerTo.h>
00026 #include <pointerToArray.h>
00027 #include <luse.h>
00028 #include <geom.h>
00029 #include <geomPoint.h>
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //       Class : PointParticleRenderer
00033 // Description : Simple point/point particle renderer.  Does NOT
00034 //               handle billboards- use BillboardParticleRenderer
00035 //               for that.
00036 ////////////////////////////////////////////////////////////////////
00037 
00038 class EXPCL_PANDAPHYSICS PointParticleRenderer : public BaseParticleRenderer {
00039 PUBLISHED:
00040   enum PointParticleBlendType {
00041     PP_ONE_COLOR,
00042     PP_BLEND_LIFE,
00043     PP_BLEND_VEL
00044   };
00045 
00046   PointParticleRenderer(const PointParticleRenderer& copy);
00047   PointParticleRenderer(ParticleRendererAlphaMode ad = PR_ALPHA_NONE,
00048                         float point_size = 1.0f,
00049                         PointParticleBlendType bt = PP_ONE_COLOR,
00050                         ParticleRendererBlendMethod bm = PP_NO_BLEND,
00051                         const Colorf& sc = Colorf(1.0f, 1.0f, 1.0f, 1.0f),
00052                         const Colorf& ec = Colorf(1.0f, 1.0f, 1.0f, 1.0f));
00053 
00054   virtual ~PointParticleRenderer(void);
00055 
00056   virtual BaseParticleRenderer *make_copy(void);
00057 
00058   INLINE void set_point_size(float point_size);
00059   INLINE void set_start_color(const Colorf& sc);
00060   INLINE void set_end_color(const Colorf& ec);
00061   INLINE void set_blend_type(PointParticleBlendType bt);
00062   INLINE void set_blend_method(ParticleRendererBlendMethod bm);
00063 
00064   INLINE float get_point_size(void) const;
00065   INLINE const Colorf& get_start_color(void) const;
00066   INLINE const Colorf& get_end_color(void) const;
00067   INLINE PointParticleBlendType get_blend_type(void) const;
00068   INLINE ParticleRendererBlendMethod get_blend_method(void) const;
00069 
00070 private:
00071   Colorf _start_color, _end_color;
00072   float _point_size;
00073 
00074   PT(GeomPoint) _point_primitive;
00075 
00076   PTA_Vertexf _vertex_array;
00077   PTA_Colorf _color_array;
00078 
00079   int _max_pool_size;
00080 
00081   PointParticleBlendType _blend_type;
00082   ParticleRendererBlendMethod _blend_method;
00083 
00084   LPoint3f _aabb_min, _aabb_max;
00085 
00086   Colorf create_color(const BaseParticle *p);
00087 
00088   virtual void birth_particle(int index);
00089   virtual void kill_particle(int index);
00090   virtual void init_geoms(void);
00091   virtual void render(pvector< PT(PhysicsObject) >& po_vector,
00092                       int ttl_particles);
00093   virtual void resize_pool(int new_size);
00094 };
00095 
00096 #include "pointParticleRenderer.I"
00097 
00098 #endif // POINTPARTICLERENDERER_H

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