# 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  

exterior_mesh.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_EXTERIOR_MESH_H
00027 #define NL_EXTERIOR_MESH_H
00028 
00029 #include <vector>
00030 
00031 #include "nel/misc/types_nl.h"
00032 #include "nel/misc/vector.h"
00033 #include "nel/misc/file.h"
00034 
00035 #include "nel/misc/aabbox.h"
00036 
00037 #include "pacs/vector_2s.h"
00038 #include "pacs/surface_quad.h"
00039 #include "pacs/chain.h"
00040 #include "pacs/retrievable_surface.h"
00041 #include "pacs/chain_quad.h"
00042 
00043 #include "nel/pacs/u_global_position.h"
00044 
00045 
00046 
00047 namespace NLPACS
00048 {
00049 
00056 class CExteriorMesh
00057 {
00058 public:
00060         struct CEdge
00061         {
00062                 NLMISC::CVector                                 Start;
00063                 sint32                                                  Link;
00064 
00065                 CEdge() {}
00066                 CEdge(const CVector &start, sint32 link) : Start(start), Link(link) {}
00067                 void    serial(NLMISC::IStream &f) { f.serial(Start, Link); }
00068         };
00069 
00071         struct COrderedEdges
00072         {
00073                 uint32                                                  Start, End;
00074                 bool                                                    Forward;
00075                 void    serial(NLMISC::IStream &f) { f.serial(Start, End, Forward); }
00076         };
00077 
00079         class CLink
00080         {
00081         public:
00082                 uint16                          BorderChainId;
00083                 uint16                          ChainId;
00084                 uint16                          SurfaceId;
00085                 CLink() : BorderChainId(0xFFFF), ChainId(0xFFFF), SurfaceId(0xFFFF) {}
00086                 void    serial(NLMISC::IStream &f) { f.serial(BorderChainId, ChainId, SurfaceId); }
00087         };
00088 
00089 protected:
00090         std::vector<CEdge>                                      _Edges;
00091         std::vector<COrderedEdges>                      _OrderedEdges;
00092 
00093         std::vector<CLink>                                      _Links;
00094 
00095         NLMISC::CAABBox                                         _BBox;
00096 
00097 
00098 public:
00100         // @{
00101 
00102         CExteriorMesh();
00103 
00104         // @}
00105 
00106 
00108         // @{
00109 
00111         const std::vector<CEdge>                        &getEdges() const { return _Edges; }
00112 
00114         const CEdge                                                     getEdge(uint n) const { return _Edges[n]; }
00115 
00116 
00118         const std::vector<COrderedEdges>        &getOrderedEdges() const { return _OrderedEdges; }
00119 
00121         const COrderedEdges                                     &getOrderedEdges(uint n) const { return _OrderedEdges[n]; }
00122 
00123 
00125         const std::vector<CLink>                        &getLinks() const { return _Links; }
00127         const CLink                                                     &getLink(uint n) const { return _Links[n]; }
00128 
00130         CLink                                                           getLinkFromEdge(uint edge) const { return (_Edges[edge].Link != -1) ? _Links[_Edges[edge].Link] : CLink(); }
00131 
00132 
00134         const NLMISC::CAABBox                           &getBBox() const { return _BBox; }
00135 
00136         // @}
00137 
00138 
00140         // @{
00141 
00143         void                                                            setEdges(const std::vector<CEdge> &edges);
00144 
00146         void                                                            setLinks(const std::vector<CLink> &links) { _Links = links; }
00147 
00148         // @}
00149 
00151         void                                                            serial(NLMISC::IStream &f);
00152 };
00153 
00154 }; // NLPACS
00155 
00156 #endif // NL_EXTERIOR_MESH_H
00157 
00158 /* End of exterior_mesh.h */