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/global__retriever_8h-source.html | 350 ++++++++++++++++++++++ 1 file changed, 350 insertions(+) create mode 100644 docs/doxygen/nel/global__retriever_8h-source.html (limited to 'docs/doxygen/nel/global__retriever_8h-source.html') diff --git a/docs/doxygen/nel/global__retriever_8h-source.html b/docs/doxygen/nel/global__retriever_8h-source.html new file mode 100644 index 00000000..1b8110fc --- /dev/null +++ b/docs/doxygen/nel/global__retriever_8h-source.html @@ -0,0 +1,350 @@ + + + + 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  
+

global_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_GLOBAL_RETRIEVER_H
+00027 #define NL_GLOBAL_RETRIEVER_H
+00028 
+00029 #include <vector>
+00030 #include <list>
+00031 
+00032 #include "nel/misc/types_nl.h"
+00033 #include "nel/misc/vector.h"
+00034 #include "nel/misc/file.h"
+00035 
+00036 #include "nel/misc/vector.h"
+00037 #include "nel/misc/vectord.h"
+00038 #include "nel/misc/aabbox.h"
+00039 
+00040 #include "pacs/local_retriever.h"
+00041 #include "pacs/retriever_instance.h"
+00042 #include "pacs/vector_2s.h"
+00043 #include "pacs/collision_surface_temp.h"
+00044 #include "pacs/retriever_bank.h"
+00045 
+00046 #include "nel/pacs/u_global_retriever.h"
+00047 
+00048 
+00049 #include "pacs/quad_grid.h"
+00050 
+00051 
+00052 namespace NLPACS
+00053 {
+00054 
+00061 class CGlobalRetriever : public UGlobalRetriever
+00062 {
+00063 public:
+00064 
+00072         class CGlobalPosition : public UGlobalPosition
+00073         {
+00074         public:
+00079                 CGlobalPosition(sint32 instanceId=-1, 
+00080                                            const CLocalRetriever::CLocalPosition &localPosition=CLocalRetriever::CLocalPosition::CLocalPosition())
+00081                 {
+00082                         InstanceId=instanceId;
+00083                         LocalPosition=localPosition;
+00084                 }
+00085 
+00087                 //void                                                  serial(NLMISC::IStream &f) { f.serial(InstanceId, LocalPosition); }
+00088         };
+00089 
+00090         class CLocalPath
+00091         {
+00092         public:
+00093                 sint32                                                          InstanceId;
+00094                 CLocalRetriever::CLocalPosition         Start;
+00095                 CLocalRetriever::CLocalPosition         End;
+00096                 std::vector<CVector2s>                          Path;
+00097         };
+00098 
+00099         typedef std::vector<CLocalPath>                 CGlobalPath;
+00100 
+00101 private:
+00103         mutable CCollisionSurfaceTemp                   _InternalCST;
+00104 
+00106         mutable std::vector<uint8>                              _RetrieveTable;
+00107 
+00108 protected:
+00109 
+00111         const CRetrieverBank                                    *_RetrieverBank;
+00112 
+00114         mutable std::vector<CRetrieverInstance> _Instances;
+00115 
+00117         mutable CQuadGrid<uint32>                               _InstanceGrid;
+00118 
+00120         NLMISC::CAABBox                                                 _BBox;
+00121 
+00122 public:
+00124         // @{
+00125 
+00130         CGlobalRetriever(const CRetrieverBank *bank=NULL) 
+00131                 : _RetrieverBank(bank)
+00132         { }
+00133         virtual ~CGlobalRetriever() {}
+00134         
+00135 
+00137         void                                                    init();
+00138 
+00140         void                                                    initQuadGrid();
+00141 
+00143         void                                                    initRetrieveTable();
+00144 
+00145         // @}
+00146 
+00147 
+00149 
+00150 
+00151 
+00153         const NLMISC::CAABBox                   &getBBox() const { return _BBox; }
+00154 
+00155 
+00157         const std::vector<CRetrieverInstance>   &getInstances() const { return _Instances; }
+00158 
+00160         const CRetrieverInstance                &getInstance(uint id) const { return _Instances[id]; }
+00161 
+00162 
+00166         void                                                    selectInstances(const NLMISC::CAABBox &bbox, CCollisionSurfaceTemp &cst) const;
+00167 
+00169         const CRetrieverBank                    *getRetrieverBank() const { return _RetrieverBank; }
+00170 
+00172         const CLocalRetriever                   &getRetriever(uint32 id) const { return _RetrieverBank->getRetriever(id); }
+00173 
+00174 
+00176         uint32                                                  getMaterial(const UGlobalPosition &pos) const
+00177         {
+00178                 if (pos.InstanceId < 0 || pos.InstanceId >= (sint)_Instances.size())
+00179                         return 0xFFFFFFFF;
+00180 
+00181                 const CRetrieverInstance        &instance = _Instances[pos.InstanceId];
+00182                 const CLocalRetriever           &retriever = getRetriever(instance.getRetrieverId());
+00183 
+00184                 if (pos.LocalPosition.Surface < 0 || pos.LocalPosition.Surface >= (sint)retriever.getSurfaces().size())
+00185                         return 0xFFFFFFFF;
+00186 
+00187                 return retriever.getSurface(pos.LocalPosition.Surface).getMaterial();
+00188         }
+00189 
+00191         bool                                                    isInterior(const UGlobalPosition &pos) const
+00192         {
+00193                 if (pos.InstanceId < 0 || pos.InstanceId >= (sint)_Instances.size())
+00194                         return false;
+00195 
+00196                 return (_Instances[pos.InstanceId].getType() == CLocalRetriever::Interior);
+00197         }
+00198 
+00200         bool                                                    isWaterPosition(const UGlobalPosition &pos, float &waterHeight) const
+00201         {
+00202                 if (pos.InstanceId < 0 || pos.InstanceId >= (sint)_Instances.size())
+00203                         return false;
+00204 
+00205                 const CRetrieverInstance        &instance = _Instances[pos.InstanceId];
+00206                 const CLocalRetriever           &retriever = getRetriever(instance.getRetrieverId());
+00207                 const CRetrievableSurface       &surface = retriever.getSurface(pos.LocalPosition.Surface);
+00208 
+00209                 waterHeight = surface.getWaterHeight();
+00210 
+00211                 return (surface.getFlags() & CRetrievableSurface::IsUnderWaterBit) != 0;
+00212         }
+00213 
+00215 
+00217 
+00218 
+00220         UGlobalPosition                                 retrievePosition(const NLMISC::CVector &estimated) const;
+00221 
+00223         UGlobalPosition                                 retrievePosition(const NLMISC::CVectorD &estimated) const;
+00224 
+00226         UGlobalPosition                                 retrievePosition(const NLMISC::CVector &estimated, float threshold) const;
+00227 
+00229         UGlobalPosition                                 retrievePosition(const NLMISC::CVectorD &estimated, double threshold) const;
+00230 
+00232         sint32                                                  getIdentifier(const std::string &id) const;
+00233 
+00235         const std::string                               &getIdentifier(const UGlobalPosition &position) const;
+00236 
+00243         bool                                                    buildInstance(const std::string &id, const NLMISC::CVectorD &position, sint32 &instanceId);
+00244 
+00248         void                                                    removeInstance(sint32 instanceId);
+00249 
+00251 //      void                                                    snapToInteriorGround(UGlobalPosition &position) const;
+00252 
+00254         NLMISC::CVector                                 getGlobalPosition(const UGlobalPosition &global) const;
+00255 
+00257         NLMISC::CVectorD                                getDoubleGlobalPosition(const UGlobalPosition &global) const;
+00258 
+00260         bool                                                    testRaytrace (const NLMISC::CVectorD &v0, const NLMISC::CVectorD &v1);
+00261 
+00263 
+00264 
+00266 
+00267 
+00269         const CRetrieverInstance                &makeInstance(uint32 retriever, uint8 orientation, const NLMISC::CVector &origin);
+00270 
+00272         CRetrieverInstance                              &getInstanceFullAccess(uint id) { return _Instances[id]; }
+00273 
+00275         void                                                    setRetrieverBank(const CRetrieverBank *bank) { _RetrieverBank = bank; }
+00276 
+00277 
+00279         void                                                    resetAllLinks();
+00280 
+00282         void                                                    initAll();
+00284         void                                                    makeLinks(uint n);
+00286         void                                                    makeAllLinks();
+00287 
+00289         void                                                    check() const;
+00290 
+00292         float                                                   distanceToBorder(const UGlobalPosition &pos) const;
+00294         void                                                    getBorders(const UGlobalPosition &pos, std::vector<NLMISC::CLine> &edges);
+00295 
+00296 
+00298         void                                                    serial(NLMISC::IStream &f);
+00299 
+00301 
+00302 
+00304         // @{
+00313         const TCollisionSurfaceDescVector       *testCylinderMove(const UGlobalPosition &start, const NLMISC::CVector &delta, 
+00314                 float radius, CCollisionSurfaceTemp &cst) const;
+00324         const TCollisionSurfaceDescVector       *testBBoxMove(const UGlobalPosition &start, const NLMISC::CVector &delta, 
+00325                 const NLMISC::CVector &locI, const NLMISC::CVector &locJ, CCollisionSurfaceTemp &cst) const;
+00339         UGlobalPosition         doMove(const UGlobalPosition &start, const NLMISC::CVector &delta, float t, CCollisionSurfaceTemp &cst, bool rebuildChains=false) const;
+00342         const CRetrievableSurface       *getSurfaceById(const CSurfaceIdent &surfId) const;
+00352         const TCollisionSurfaceDescVector       &testBBoxRot(const CGlobalPosition &start, 
+00353                 const NLMISC::CVector &locI, const NLMISC::CVector &locJ, CCollisionSurfaceTemp &cst) const;
+00354 
+00358         float                           getMeanHeight(const UGlobalPosition &pos) const;
+00359 
+00361         void                            updateHeight(UGlobalPosition &pos) const { pos.LocalPosition.Estimation.z = getMeanHeight(pos); }
+00362 
+00363         // @}
+00364 
+00365 
+00367         // @{
+00368 
+00371         void                                                    findAStarPath(const UGlobalPosition &begin, const UGlobalPosition &end, std::vector<CRetrieverInstance::CAStarNodeAccess> &path, uint32 forbidFlags) const;
+00372 
+00375         void                                                    findPath(const UGlobalPosition &begin, const UGlobalPosition &end, CGlobalPath &path, uint32 forbidFlags=0) const;
+00376 
+00377         // @}
+00378 
+00379 private:
+00381         // @{
+00382 
+00384         CRetrieverInstance::CAStarNodeInfo      &getNode(CRetrieverInstance::CAStarNodeAccess &access) const
+00385         {
+00386                 return _Instances[access.InstanceId]._NodesInformation[access.NodeId];
+00387         }
+00388 
+00389         // @}
+00390 
+00391 
+00393         // @{
+00394         enum    TCollisionType { Circle, BBox };
+00398         void    findCollisionChains(CCollisionSurfaceTemp &cst, const NLMISC::CAABBox &bboxMove, const NLMISC::CVector &origin) const;
+00402         void    testCollisionWithCollisionChains(CCollisionSurfaceTemp &cst, const CVector2f &startCol, const CVector2f &deltaCol,
+00403                 CSurfaceIdent startSurface, float radius, const CVector2f bbox[4], TCollisionType colType) const;
+00409         CSurfaceIdent   testMovementWithCollisionChains(CCollisionSurfaceTemp &cst, const CVector2f &startCol, const CVector2f &deltaCol,
+00410                 CSurfaceIdent startSurface) const;
+00414         void    testRotCollisionWithCollisionChains(CCollisionSurfaceTemp &cst, const CVector2f &startCol, CSurfaceIdent startSurface, const CVector2f bbox[4])  const;
+00416         bool                    verticalChain(const CCollisionChain &colChain) const;
+00417         // @}
+00418 
+00419 protected:
+00420         friend class CRetrieverInstance;
+00421 
+00422         CCollisionSurfaceTemp   &getInternalCST() const { return _InternalCST; }
+00423 };
+00424 
+00425 }; // NLPACS
+00426 
+00427 #endif // NL_GLOBAL_RETRIEVER_H
+00428 
+00429 /* End of global_retriever.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1