From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/local__retriever_8h-source.html | 413 +++++++++++++++++++++++ 1 file changed, 413 insertions(+) create mode 100644 docs/doxygen/nel/local__retriever_8h-source.html (limited to 'docs/doxygen/nel/local__retriever_8h-source.html') diff --git a/docs/doxygen/nel/local__retriever_8h-source.html b/docs/doxygen/nel/local__retriever_8h-source.html new file mode 100644 index 00000000..a01470fc --- /dev/null +++ b/docs/doxygen/nel/local__retriever_8h-source.html @@ -0,0 +1,413 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# 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  
+

local_retriever.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_LOCAL_RETRIEVER_H
+00027 #define NL_LOCAL_RETRIEVER_H
+00028 
+00029 #include <vector>
+00030 #include <string>
+00031 #include <list>
+00032 
+00033 #include "nel/misc/types_nl.h"
+00034 #include "nel/misc/vector.h"
+00035 #include "nel/misc/file.h"
+00036 
+00037 #include "nel/misc/aabbox.h"
+00038 #include "nel/misc/polygon.h"
+00039 
+00040 #include "pacs/vector_2s.h"
+00041 #include "pacs/surface_quad.h"
+00042 #include "pacs/chain.h"
+00043 #include "pacs/retrievable_surface.h"
+00044 #include "pacs/chain_quad.h"
+00045 #include "pacs/exterior_mesh.h"
+00046 #include "pacs/face_grid.h"
+00047 
+00048 #include "nel/pacs/u_global_position.h"
+00049 
+00050 
+00051 
+00052 namespace NLPACS
+00053 {
+00054 
+00055 class CCollisionSurfaceTemp;
+00056 
+00063 class CLocalRetriever
+00064 {
+00065 public:
+00072         class CTip
+00073         {
+00074         public:
+00081                 struct CChainTip
+00082                 {
+00084                         sint32  Chain;
+00085 
+00087                         bool    Start;
+00088 
+00090                         CChainTip(sint32 chainId = 0, bool start = 0) : Chain(chainId), Start(start) {}
+00091 
+00093                         void    serial(NLMISC::IStream &f) { f.serial(Chain, Start); }
+00094                 };
+00095 
+00096                 CTip() : Point(NLMISC::CVector::Null) {}
+00097 
+00099                 NLMISC::CVector                                 Point;
+00100 
+00101                 // The chains linked to that tip.
+00102                 std::vector<CChainTip>                  Chains;
+00103 
+00104         public:
+00106                 void    serial(NLMISC::IStream &f)
+00107                 {
+00108                         f.serial(Point);
+00109                         f.serialCont(Chains);
+00110                 }
+00111 
+00113                 void    translate(const NLMISC::CVector &translation)
+00114                 {
+00115                         Point += translation;
+00116                 }
+00117         };
+00118 
+00119 
+00126         class CTopology : public std::vector<sint32>
+00127         {
+00128         public:
+00129                 void    serial(NLMISC::IStream &f)      { f.serialCont(*this); }
+00130         };
+00131 
+00132 
+00140         class CLocalPosition : public ULocalPosition
+00141         {
+00142         public:
+00144                 CLocalPosition(sint32 surface=-1, const NLMISC::CVector &estimation=NLMISC::CVector::Null) 
+00145                 {
+00146                         Surface=surface;
+00147                         Estimation=estimation;
+00148                 }
+00149 
+00151                 //void                                                  serial(NLMISC::IStream &f) { f.serial(Surface, Estimation); }
+00152         };
+00153 
+00160         enum EType
+00161         {
+00162                 Landscape = 0,
+00163                 Interior
+00164         };
+00165 
+00166 
+00173         class CInteriorFace
+00174         {
+00175         public:
+00176                 uint32  Verts[3];
+00177                 uint32  Surface;
+00178         public:
+00179                 void    serial(NLMISC::IStream &f) { f.serial(Verts[0], Verts[1], Verts[2], Surface); }
+00180         };
+00181 
+00182 
+00183 protected:
+00184         friend class    CRetrieverInstance;
+00185         
+00187         std::vector<COrderedChain>                      _OrderedChains;
+00188         std::vector<COrderedChain3f>            _FullOrderedChains;
+00189 
+00191         std::vector<CChain>                                     _Chains;
+00192 
+00194         std::vector<CRetrievableSurface>        _Surfaces;
+00195 
+00197         NLMISC::CAABBox                                         _BBox;
+00198 
+00200         std::vector<CTip>                                       _Tips;
+00201 
+00203         std::vector<uint16>                                     _BorderChains;
+00204 
+00206         std::vector<CTopology>                          _Topologies[NumCreatureModels];
+00207 
+00209         static const float                                      _TipThreshold;
+00210 
+00212         static const float                                      _EdgeTipThreshold;
+00213 
+00215         CChainQuad                                                      _ChainQuad;
+00216 
+00218         EType                                                           _Type;
+00219 
+00221         // @{
+00223         CExteriorMesh                                           _ExteriorMesh;
+00224 
+00226         std::vector<NLMISC::CVector>            _InteriorVertices;
+00227 
+00229         std::vector<CInteriorFace>                      _InteriorFaces;
+00230 
+00232         CFaceGrid                                                       _FaceGrid;
+00233 
+00235         std::string                                                     _Id;
+00236 
+00237         // @}
+00238 
+00239 
+00240 
+00241 private:
+00243         struct CIntersectionMarker
+00244         {
+00245                 float   Position;
+00246                 uint16  OChain;
+00247                 uint16  Edge;
+00248                 bool    In;
+00249 
+00250                 CIntersectionMarker() {}
+00251                 CIntersectionMarker(float position, uint16 ochain, uint16 edge, bool in) : Position(position), OChain(ochain), Edge(edge), In(in) {}
+00252 
+00253                 bool    operator< (const CIntersectionMarker &comp) const { return Position < comp.Position; }
+00254         };
+00255 
+00256 public:
+00258         // @{
+00259 
+00260         CLocalRetriever();
+00261 
+00262         // @}
+00263 
+00265         // @{
+00266 
+00268         const std::vector<CTip>                         &getTips() const { return _Tips; }
+00270         const CTip                                                      &getTip(uint n) const { return _Tips[n]; }
+00271 
+00273         const std::vector<COrderedChain>        &getOrderedChains() const { return _OrderedChains; }
+00275         const COrderedChain                                     &getOrderedChain(uint n) const { return _OrderedChains[n]; }
+00276 
+00278         const std::vector<COrderedChain3f>      &getFullOrderedChains() const { return _FullOrderedChains; }
+00280         const COrderedChain3f                           &getFullOrderedChain(uint n) const { return _FullOrderedChains[n]; }
+00281 
+00283         const std::vector<CChain>                       &getChains() const { return _Chains; }
+00285         const CChain                                            &getChain(uint n) const { return _Chains[n]; }
+00286 
+00288         const std::vector<uint16>                       &getBorderChains() const { return _BorderChains; }
+00290         uint16                                                          getBorderChain(uint n) const { return _BorderChains[n]; }
+00291 
+00293         const std::vector<CRetrievableSurface>  &getSurfaces() const { return _Surfaces; }
+00295         const CRetrievableSurface                       &getSurface(uint n) const { return _Surfaces[n]; }
+00296 
+00298         EType                                                           getType() const { return _Type; }
+00299 
+00301         const NLMISC::CAABBox                           &getBBox() const { return _BBox; }
+00302 
+00304         const CExteriorMesh                                     &getExteriorMesh() const { return _ExteriorMesh; }
+00305 
+00307         const std::vector<NLMISC::CVector>      &getInteriorVertices() const { return _InteriorVertices; }
+00308 
+00310         const std::vector<CInteriorFace>        &getInteriorFaces() const { return _InteriorFaces; }
+00311 
+00313         const std::string                                       &getIdentifier() const { return _Id; }
+00314 
+00316         void                                                            buildInteriorSurfaceBBoxes(std::vector<NLMISC::CAABBox> &surfaceBBoxes) const;
+00317 
+00319         void                                                            buildSurfacePolygons(uint32 surface, std::list<NLMISC::CPolygon> &polygons) const;
+00320 
+00322         void                                                            buildSurfacePolygons(std::list< std::list<NLMISC::CPolygon> > &polygons) const
+00323         {
+00324                 uint    i;
+00325                 for (i=0; i<_Surfaces.size(); ++i)
+00326                 {
+00327                         polygons.push_back();
+00328                         buildSurfacePolygons(i, polygons.back());
+00329                 }
+00330         }
+00331 
+00332         // @}
+00333 
+00334 
+00336 
+00337 
+00339         sint32                                                          addSurface(uint8 normalq, uint8 orientationq,
+00340                                                                                                    uint8 mat, uint8 charact, uint8 level,
+00341                                                                                                    bool isUnderWater, float waterHeight,
+00342                                                                                                    const NLMISC::CVector &center,
+00343                                                                                                    const CSurfaceQuadTree &quad);
+00344 
+00349         sint32                                                          addChain(const std::vector<NLMISC::CVector> &vertices,
+00350                                                                                                  sint32 left, sint32 right);
+00351 
+00353         void                                                            setType(EType type) { _Type = type; }
+00354 
+00356         void                                                            setExteriorMesh(const CExteriorMesh &em) { _ExteriorMesh = em; }
+00357 
+00359         void                                                            setBBox(const NLMISC::CAABBox &bbox) { _BBox = bbox; }
+00360 
+00361 
+00363         std::vector<NLMISC::CVector>            &getInteriorVertices() { return _InteriorVertices; }
+00364 
+00366         std::vector<CInteriorFace>                      &getInteriorFaces() { return _InteriorFaces; }
+00367 
+00369         void                                                            setIdentifier(const std::string &id) { _Id = id; }
+00370 
+00371 
+00373         CChainQuad                                                      &getChainQuad() { return _ChainQuad; }
+00374 
+00375 
+00377         void                                                            initFaceGrid();
+00378 
+00379 
+00381         void                                                            computeTopologies();
+00382 
+00384         void                                                            computeLoopsAndTips();
+00385 
+00387         void                                                            findBorderChains();
+00388 
+00390         void                                                            updateChainIds();
+00391 
+00392 
+00394         void                                                            sortTips();
+00395 
+00396 
+00398         void                                                            translate(const NLMISC::CVector &translation);
+00399 
+00400 
+00402         void                                                            flushFullOrderedChains() { _FullOrderedChains.clear(); }
+00403 
+00404 
+00406         void                                                            serial(NLMISC::IStream &f);
+00407 
+00408         // @}
+00409 
+00411         // @{
+00413         void                    computeCollisionChainQuad();
+00419         void                    testCollision(CCollisionSurfaceTemp &cst, const NLMISC::CAABBox &bboxMove, const NLMISC::CVector2f &transBase) const;
+00420 
+00421         // @}
+00422 
+00423 /*
+00424 protected:
+00425 */
+00426 
+00428         bool                                                            insurePosition(ULocalPosition &local) const;
+00429 
+00431         void                                                            retrievePosition(NLMISC::CVector estimated, /*std::vector<uint8> &retrieveTable,*/ CCollisionSurfaceTemp &cst) const;
+00432 
+00434         void                                                            snapToInteriorGround(ULocalPosition &position, bool &snapped) const;
+00435 
+00437         float                                                           getHeight(const ULocalPosition &position) const;
+00438 
+00440         void                                                            findPath(const CLocalPosition &A, const CLocalPosition &B, std::vector<CVector2s> &path, NLPACS::CCollisionSurfaceTemp &cst) const;
+00441 
+00442 
+00444         void                                                            unify();
+00445 
+00446 public:
+00447         const NLMISC::CVector                           &getStartVector(uint32 chain) const;
+00448         const NLMISC::CVector                           &getStopVector(uint32 chain) const;
+00449 
+00450         const NLMISC::CVector                           &getStartVector(uint32 chain, sint32 surface) const;
+00451         const NLMISC::CVector                           &getStopVector(uint32 chain, sint32 surface) const;
+00452 
+00453         uint16                                                          getStartTip(uint32 chain, sint32 surface) const;
+00454         uint16                                                          getStopTip(uint32 chain, sint32 surface) const;
+00455         
+00456         void                                                            setStartTip(uint32 chain, sint32 surface, uint16 startTip);
+00457         void                                                            setStopTip(uint32 chain, sint32 surface, uint16 stopTip);
+00458 
+00459         uint32                                                          getPreviousChain(uint32 chain, sint32 surface) const;
+00460         uint32                                                          getNextChain(uint32 chain, sint32 surface) const;
+00461 
+00462 public:
+00463         void                                                            dumpSurface(uint surf, const NLMISC::CVector &vect = NLMISC::CVector::Null) const;
+00464 
+00465         float                                                           distanceToBorder(const ULocalPosition &pos) const;
+00466 };
+00467 
+00468 }; // NLPACS
+00469 
+00470 #endif // NL_LOCAL_RETRIEVER_H
+00471 
+00472 /* End of local_retriever.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1