exterior_mesh.h
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef NL_EXTERIOR_MESH_H
00025 #define NL_EXTERIOR_MESH_H
00026
00027 #include <vector>
00028
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/vector.h"
00031 #include "nel/misc/file.h"
00032
00033 #include "nel/misc/aabbox.h"
00034
00035 #include "vector_2s.h"
00036 #include "surface_quad.h"
00037 #include "chain.h"
00038 #include "retrievable_surface.h"
00039 #include "chain_quad.h"
00040
00041 #include "nel/pacs/u_global_position.h"
00042
00043
00044
00045 namespace NLPACS
00046 {
00047
00054 class CExteriorMesh
00055 {
00056 public:
00058 struct CEdge
00059 {
00060 NLMISC::CVector Start;
00061 sint32 Link;
00062
00063 CEdge() {}
00064 CEdge(const CVector &start, sint32 link) : Start(start), Link(link) {}
00065 void serial(NLMISC::IStream &f) { f.serial(Start, Link); }
00066 };
00067
00069 struct COrderedEdges
00070 {
00071 uint32 Start, End;
00072 bool Forward;
00073 void serial(NLMISC::IStream &f) { f.serial(Start, End, Forward); }
00074 };
00075
00077 class CLink
00078 {
00079 public:
00080 uint16 BorderChainId;
00081 uint16 ChainId;
00082 uint16 SurfaceId;
00083 CLink() : BorderChainId(0xFFFF), ChainId(0xFFFF), SurfaceId(0xFFFF) {}
00084 void serial(NLMISC::IStream &f) { f.serial(BorderChainId, ChainId, SurfaceId); }
00085 };
00086
00087 protected:
00088 std::vector<CEdge> _Edges;
00089 std::vector<COrderedEdges> _OrderedEdges;
00090
00091 std::vector<CLink> _Links;
00092
00093 NLMISC::CAABBox _BBox;
00094
00095
00096 public:
00098
00099
00100 CExteriorMesh();
00101
00102
00103
00104 void clear()
00105 {
00106 NLMISC::contReset(_Edges);
00107 NLMISC::contReset(_OrderedEdges);
00108 NLMISC::contReset(_Links);
00109 }
00110
00112
00113
00115 const std::vector<CEdge> &getEdges() const { return _Edges; }
00116
00118 const CEdge getEdge(uint n) const { return _Edges[n]; }
00119
00120
00122 const std::vector<COrderedEdges> &getOrderedEdges() const { return _OrderedEdges; }
00123
00125 const COrderedEdges &getOrderedEdges(uint n) const { return _OrderedEdges[n]; }
00126
00127
00129 const std::vector<CLink> &getLinks() const { return _Links; }
00131 const CLink &getLink(uint n) const { return _Links[n]; }
00132
00134 CLink getLinkFromEdge(uint edge) const { return (_Edges[edge].Link != -1) ? _Links[_Edges[edge].Link] : CLink(); }
00135
00136
00138 const NLMISC::CAABBox &getBBox() const { return _BBox; }
00139
00140
00141
00142
00144
00145
00147 void setEdges(const std::vector<CEdge> &edges);
00148
00150 void setLinks(const std::vector<CLink> &links) { _Links = links; }
00151
00152
00153
00155 void serial(NLMISC::IStream &f);
00156 };
00157
00158 };
00159
00160 #endif // NL_EXTERIOR_MESH_H
00161
00162