# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

ps_tail_dot.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_PS_TAIL_DOT_H
00027 #define NL_PS_TAIL_DOT_H
00028 
00029 #include "3d/ps_ribbon_base.h"
00030 #include "3d/vertex_buffer.h"
00031 #include "3d/primitive_block.h"
00032 #include <hash_map>
00033 
00034 
00035 namespace NL3D 
00036 {
00037 
00041 class CPSTailDot : public  CPSRibbonBase, public CPSColoredParticle, public  CPSMaterial
00042 {
00043 public: 
00047                 CPSTailDot();
00049                 ~CPSTailDot();
00051                 virtual void            serial(NLMISC::IStream &f) throw(NLMISC::EStream);
00052                 //
00053                 NLMISC_DECLARE_CLASS(CPSTailDot);
00055 
00056         
00059 
00062                         virtual void setColorFading(bool onOff = true) 
00063                         {
00064                                 _ColorFading = onOff;
00065                                 touch();
00066                         }
00067 
00070                         virtual bool getColorFading(void) const
00071                         {
00072                                 return _ColorFading;
00073                         }
00074 
00079                         virtual void setSystemBasis(bool yes) {}
00080                 
00082                         virtual bool isInSystemBasis(void) const { return true; }
00083                 
00084                 //void setPersistAfterDeath(bool persit = true);
00085 
00089                 //bool getPersistAfterDeath(void) const { return _DyingRibbons != NULL; }
00090                 
00092 
00094         virtual void                    step(TPSProcessPass pass, TAnimationTime ellapsedTime, TAnimationTime realEt);
00095 
00097         virtual bool                    hasTransparentFaces(void);
00098 
00100         virtual bool                    hasOpaqueFaces(void);
00101 
00102         virtual uint32                  getMaxNumFaces(void) const;
00103 
00104 protected:              
00106         
00107         // the number of dying ribbons that are present
00108         //uint32                                                        _NbDyingRibbons;
00109         // a counter to tell how much frame is left for each ribbon
00110         //std::vector<uint32>                           _DyingRibbonsLifeLeft;
00111 
00113         virtual void                                    newElement(CPSLocated *emitterLocated, uint32 emitterIndex) ;
00115         virtual void                                    deleteElement(uint32 index);
00117         virtual void                                    resize(uint32 size);
00118         virtual CPSLocated                              *getSizeOwner(void) { return _Owner; }
00119         virtual CPSLocated                              *getColorOwner(void) { return _Owner; } 
00120 
00121 
00122 private:                
00123 
00125         virtual void                                    updateMatAndVbForColor(void);   
00126 
00128         void                                                    displayRibbons(uint32 nbRibbons, uint32 srcStep);
00129 
00138                         struct CVBnPB
00139                         {
00140                                 CVertexBuffer           VB;
00141                                 CPrimitiveBlock         PB;
00142                         };
00143 
00144                         typedef std::hash_map<uint, CVBnPB> TVBMap;
00145 
00146                         static TVBMap                                   _VBMap;                   // index / vertex buffers with no color
00147                         static TVBMap                                   _FadedVBMap;      // index / vertex buffers for constant color with fading
00148                         static TVBMap                                   _ColoredVBMap;    // index / vertex buffer + colors
00149                         static TVBMap                                   _FadedColoredVBMap;    // index / vertex buffer + faded colors
00150 
00152                         CVBnPB &getVBnPB();
00153 
00155                         uint    getNumRibbonsInVB() const;
00157                         
00158 
00159         bool _ColorFading : 1;
00160         bool _GlobalColor : 1; // to see wether the system uses global color
00161         bool _Touch               : 1; // we use this to see if we must setup the material again
00162 
00163         void touch() { _Touch = true; }
00164 
00165         void    updateMaterial();
00166         void    setupGlobalColor();
00167 };
00168 
00169 
00170 } // NL3D
00171 
00172 
00173 #endif // NL_PS_TAIL_DOT_H
00174 
00175 /* End of ps_taildot.h */