00001 00005 /* Copyright, 2001 Nevrax Ltd. 00006 * 00007 * This file is part of NEVRAX NEL. 00008 * NEVRAX NEL is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2, or (at your option) 00011 * any later version. 00012 00013 * NEVRAX NEL is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * General Public License for more details. 00017 00018 * You should have received a copy of the GNU General Public License 00019 * along with NEVRAX NEL; see the file COPYING. If not, write to the 00020 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00021 * MA 02111-1307, USA. 00022 */ 00023 00024 #ifndef NL_PS_PARTICLE_RIBBON_LOOK_AT_H 00025 #define NL_PS_PARTICLE_RIBBON_LOOK_AT_H 00026 00027 00028 #include "nel/3d/ps_ribbon_base.h" 00029 #include "nel/3d/vertex_buffer.h" 00030 #include "nel/3d/index_buffer.h" 00031 00032 namespace NL3D 00033 { 00034 00037 class CPSRibbonLookAt : public CPSRibbonBase, public CPSSizedParticle, public CPSColoredParticle, 00038 public CPSMaterial, public CPSTexturedParticleNoAnim 00039 { 00040 public: 00044 CPSRibbonLookAt(); 00046 ~CPSRibbonLookAt(); 00048 virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); 00049 // 00050 NLMISC_DECLARE_CLASS(CPSRibbonLookAt); 00052 00056 void setTexture(CSmartPtr<ITexture> tex); 00058 ITexture *getTexture(void) { return _Tex;} 00059 const ITexture *getTexture(void) const { return _Tex;} 00061 00064 00068 virtual void setColorFading(bool onOff = true) {} 00069 00073 virtual bool getColorFading(void) const { return false; } 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); 00095 00097 virtual bool hasTransparentFaces(void); 00098 00100 virtual bool hasOpaqueFaces(void); 00101 00102 virtual uint32 getNumWantedTris() const; 00103 00105 virtual bool hasLightableFaces() { return false; } 00106 // 00107 virtual bool supportGlobalColorLighting() const { return true; } 00108 // from CPSLocatedBindable 00109 virtual void enumTexs(std::vector<NLMISC::CSmartPtr<ITexture> > &dest, IDriver &drv); 00110 00111 // from CPSParticle 00112 virtual void setZBias(float value) { CPSMaterial::setZBias(value); } 00113 virtual float getZBias() const { return CPSMaterial::getZBias(); } 00114 00115 protected: 00116 00117 CSmartPtr<ITexture> _Tex; 00118 00119 // the number of dying ribbons that are present 00120 //uint32 _NbDyingRibbons; 00121 // a counter to tell how much frame is left for each ribbon 00122 //std::vector<uint32> _DyingRibbonsLifeLeft; 00124 virtual void newElement(const CPSEmitterInfo &info); 00126 virtual void deleteElement(uint32 index); 00128 virtual void resize(uint32 size); 00129 virtual CPSLocated *getSizeOwner(void) { return _Owner; } 00130 virtual CPSLocated *getColorOwner(void) { return _Owner; } 00131 private: 00132 00134 virtual void updateMatAndVbForColor(void); 00135 00137 void displayRibbons(uint32 nbRibbons, uint32 srcStep); 00138 00144 00147 class CVBnPB 00148 { 00149 public: 00150 CVertexBuffer VB; 00151 CIndexBuffer PB; 00152 public: 00153 CVBnPB() 00154 { 00155 NL_SET_IB_NAME(PB, "CPSRibbonLookAt::CVBnPB::PB"); 00156 VB.setName("CPSRibbonLookAt::CVBnPB::VB"); 00157 } 00158 }; 00159 typedef CHashMap<uint, CVBnPB> TVBMap; 00160 00161 static TVBMap _VBMap; // index buffers with no color 00162 static TVBMap _ColoredVBMap; // index buffer + colors 00163 00165 CVBnPB &getVBnPB(); 00166 00168 uint getNumRibbonsInVB() const; 00170 }; 00171 00172 00173 00174 } // NL3D 00175 00176 00177 #endif // NL_PS_RIBBON_LOOK_AT_H 00178 00179 /* End of ps_ribbon_look_at.h */
1.6.1