Home | nevrax.com |
|
particle_system_shape.hGo 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_PARTICLE_SYSTEM_SHAPE_H 00027 #define NL_PARTICLE_SYSTEM_SHAPE_H 00028 00029 #include "nel/misc/types_nl.h" 00030 #include "nel/misc/class_id.h" 00031 #include "nel/misc/mem_stream.h" 00032 #include "nel/misc/smart_ptr.h" 00033 #include "3d/shape.h" 00034 #include "3d/track.h" 00035 00036 00037 00038 namespace NL3D { 00039 00041 // THE FOLLOWING CLASS ARE FOR INSERTION OF A PARTICLE SYSTEM IN A MOT MODEL // 00043 00044 // *************************************************************************** 00045 // ClassIds. 00046 const NLMISC::CClassId ParticleSystemModelId=NLMISC::CClassId(0x3a9b1dc3, 0x49627ff0); 00047 00048 00049 class CParticleSystem; 00050 class CParticlesystemModel; 00051 class CParticleSystemDetailObs; 00052 00053 00054 00060 class CParticleSystemShape : public IShape 00061 { 00062 public: 00063 00065 CParticleSystemShape(); 00066 00067 00071 void buildFromPS(const NL3D::CParticleSystem &ps); 00072 00074 virtual ~CParticleSystemShape() {} 00075 00080 virtual CTransformShape *createInstance(NL3D::CScene &scene); 00081 00083 // @{ 00087 virtual void render(NL3D::IDriver *drv, CTransformShape *trans, bool passOpaque); 00088 // @} 00089 00091 virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); 00092 NLMISC_DECLARE_CLASS(CParticleSystemShape); 00093 00094 00096 CTrackDefaultFloat *getUserParamDefaultTrack(uint numTrack) 00097 { 00098 nlassert(numTrack < 4); 00099 return &_UserParamDefaultTrack[numTrack]; 00100 } 00101 00102 00104 CTrackDefaultBool *getDefaultTriggerTrack(void) 00105 { 00106 00107 return &_DefaultTriggerTrack; 00108 } 00109 00110 00112 virtual void getAABBox(NLMISC::CAABBox &bbox) const; 00113 00114 00118 virtual float getNumTriangles (float distance) { return 0; } 00119 00120 00122 // @{ 00123 CTrackDefaultVector* getDefaultPos () {return &_DefaultPos;} 00124 CTrackDefaultVector* getDefaultScale () {return &_DefaultScale;} 00125 CTrackDefaultQuat* getDefaultRotQuat () {return &_DefaultRotQuat;} 00126 // @} 00127 00128 // Test if the system is shared 00129 bool isShared() const { return _Sharing; } 00130 protected: 00131 00132 friend class CParticleSystemModel; 00133 friend class CParticleSystemDetailObs; 00134 friend class CParticleSystemClipObs; 00135 friend class CParticleSystem; 00136 00137 public: 00141 CParticleSystem *instanciatePS(CScene &scene); 00142 protected: 00144 virtual void flushTextures (IDriver &driver) {} 00145 00146 protected: 00147 00151 NLMISC::CMemStream _ParticleSystemProto; 00152 float _MaxViewDist; // the max view distance of the system, mirror the PS value 00153 NLMISC::CAABBox _PrecomputedBBox; // mirror the ps value 00154 00156 CTrackDefaultFloat _UserParamDefaultTrack[4]; 00157 00159 CTrackDefaultVector _DefaultPos; 00160 CTrackDefaultVector _DefaultScale; 00161 CTrackDefaultQuat _DefaultRotQuat; 00162 00164 CTrackDefaultBool _DefaultTriggerTrack; 00165 00167 NLMISC::CRefPtr<CParticleSystem> _SharedSystem; 00168 00169 bool _DestroyWhenOutOfFrustum; // mirror the ps value 00170 bool _DestroyModelWhenOutOfRange; // mirror the ps value 00171 bool _UsePrecomputedBBox; // mirror the ps value 00172 bool _Sharing; // mirror the ps value 00173 }; 00174 00175 } // NL3D 00176 00177 00178 #endif // NL_PARTICLE_SYSTEM_SHAPE_H 00179 00180 /* End of particle_system_shape.h */ |