# 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  

retrievable_surface.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_RETRIEVABLE_SURFACE_H
00027 #define NL_RETRIEVABLE_SURFACE_H
00028 
00029 #include <vector>
00030 #include "nel/misc/types_nl.h"
00031 #include "nel/misc/vector.h"
00032 #include "nel/misc/file.h"
00033 
00034 #include "nel/misc/aabbox.h"
00035 
00036 #include "pacs/surface_quad.h"
00037 
00038 namespace NLPACS
00039 {
00040 
00044 enum
00045 {
00046         NumCreatureModels = 4,
00047         ModelRadius = 0,
00048         ModelHeight = 1,
00049         ModelInclineThreshold = 2,
00050         NumModelCharacteristics = 3
00051 };
00052 
00056 extern  float   Models[NumCreatureModels][NumModelCharacteristics];
00057 
00058 
00059 
00067 class CRetrievableSurface
00068 {
00069 public:
00076         class CSurfaceLink
00077         {
00078         public:
00080                 sint32                                                  Chain;
00081 
00083                 sint32                                                  Surface;
00084         public:
00086                 CSurfaceLink(sint32 chain=0, sint32 surface=0) : Chain(chain), Surface(surface) {}
00087 
00089                 void                                                    serial(NLMISC::IStream &f) { f.serial(Chain, Surface); }
00090         };
00091 
00092         enum
00093         {
00094                 IsFloorBit = 24,
00095                 IsSlantBit = 25,
00096                 IsCeilingBit = 26,
00097                 IsUnderWaterBit = 27,
00098                 NormalQuantasStartBit = 0,
00099                 NormalQuantasStopBit = 3,
00100                 NormalQuantasBitMask = 0x0000000f,
00101                 CharacterQuantasStartBit = 8,
00102                 CharacterQuantasStopBit = 11,
00103                 CharacterQuantasBitMask = 0x00000f00,
00104                 MaterialQuantasStartBit = 16,
00105                 MaterialQuantasStopBit = 23,
00106                 MaterialQuantasBitMask = 0x00ff0000
00107         };
00108 
00109 protected:
00110         friend class CLocalRetriever;
00111 
00112         struct TLoop : std::vector<uint16>
00113         {
00114                 float   Length;
00115                 void    serial(NLMISC::IStream &f);
00116         };
00117 
00119 
00120         uint8                                                           _NormalQuanta;
00121         uint8                                                           _OrientationQuanta;
00122         uint8                                                           _Material;
00123         uint8                                                           _Character;
00124         uint8                                                           _Level;
00125         bool                                                            _IsFloor;
00126         bool                                                            _IsCeiling;
00128 
00130         uint32                                                          _Flags;
00131         float                                                           _WaterHeight;
00132 
00134         std::vector<CSurfaceLink>                       _Chains;
00135 
00137         std::vector<TLoop>                                      _Loops;
00138 
00140         CSurfaceQuadTree                                        _Quad;
00141 
00143         sint32                                                          _Topologies[NumCreatureModels];
00144 
00146         NLMISC::CVector                                         _Center;
00147 
00148 public:
00149         CRetrievableSurface()
00150         {
00151                 uint    i;
00152                 for (i=0; i<NumCreatureModels; ++i)
00153                         _Topologies[i] = -1;
00154 
00155                 _WaterHeight = 0.0f;
00156         }
00157 
00158         uint8                                                           getNormalQuanta() const { return _NormalQuanta; }
00159         uint8                                                           getOrientationQuanta() const { return _OrientationQuanta; }
00160         uint8                                                           getMaterial() const { return _Material; }
00161         uint8                                                           getCharacter() const { return _Character; }
00162         uint8                                                           getLevel() const { return _Level; }
00163         bool                                                            isFloor() const { return _IsFloor; }
00164         bool                                                            isCeiling() const { return _IsCeiling; }
00165         const CSurfaceQuadTree                          &getQuadTree() const { return _Quad; }
00166         sint32                                                          getTopology(uint model) const { return _Topologies[model]; }
00167         uint32                                                          getFlags() const { return _Flags; }
00168         float                                                           getWaterHeight() const { return _WaterHeight; }
00169 
00171         const std::vector<CSurfaceLink>         &getChains() const { return _Chains; }
00173         CSurfaceLink                                            getChain(uint n) const { return _Chains[n]; }
00174 
00175         const NLMISC::CVector                           &getCenter() const { return _Center; }
00176 
00178         void                                                            translate(const NLMISC::CVector &translation)
00179         {
00180                 _Center += translation;
00181                 _Quad.translate(translation);
00182         }
00183         
00185         void                                                            serial(NLMISC::IStream &f);
00186 };
00187 
00188 }; // NLPACS
00189 
00190 #endif // NL_RETRIEVABLE_SURFACE_H
00191 
00192 /* End of retrievable_surface.h */