BVB Source Codes

CRYENGINE Show VertexList.h Source code

Return Download CRYENGINE: download VertexList.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef _VERTEX_LIST_
  4. #define _VERTEX_LIST_
  5.  
  6. #if _MSC_VER > 1000
  7.         #pragma once
  8. #endif
  9.  
  10. #include <CryAISystem/IAgent.h>
  11. #include "GraphStructures.h"
  12. #include "HashSpace.h"
  13.  
  14. class CCryFile;
  15.  
  16. class CVertexList
  17. {
  18. public:
  19.         CVertexList();
  20.         ~CVertexList();
  21.         int                 AddVertex(const ObstacleData& od);
  22.  
  23.         const ObstacleData& GetVertex(int index) const;
  24.         ObstacleData&       ModifyVertex(int index);
  25.         int                 FindVertex(const ObstacleData& od) const;
  26.  
  27.         bool                IsIndexValid(int index) const { return index >= 0 && index < (int)m_obstacles.size(); }
  28.  
  29.         bool                ReadFromFile(const char* fileName);
  30.  
  31.         void                Clear()       { stl::free_container(m_obstacles); m_hashSpace->Clear(true); }
  32.         void                Reset();
  33.         int                 GetSize()     { return m_obstacles.size(); }
  34.         int                 GetCapacity() { return m_obstacles.capacity(); }
  35.  
  36.         void                GetVerticesInRange(std::vector<std::pair<float, unsigned>>& vertsOut, const Vec3& pos, float range, unsigned char flags);
  37.         void                GetMemoryStatistics(ICrySizer* pSizer);
  38.  
  39. private:
  40.  
  41.         struct SVertexRecord
  42.         {
  43.                 inline SVertexRecord() {}
  44.                 inline SVertexRecord(unsigned vertIndex) : vertIndex(vertIndex) {}
  45.                 inline const Vec3& GetPos(CVertexList& vertList) const        { return vertList.GetVertex(vertIndex).vPos; }
  46.                 inline bool        operator==(const SVertexRecord& rhs) const { return rhs.vertIndex == vertIndex; }
  47.                 unsigned           vertIndex;
  48.         };
  49.  
  50.         class VertexHashSpaceTraits
  51.         {
  52.         public:
  53.                 inline VertexHashSpaceTraits(CVertexList& vertexList) : vertexList(vertexList) {}
  54.                 inline const Vec3& operator()(const SVertexRecord& item) const { return item.GetPos(vertexList); }
  55.                 CVertexList&       vertexList;
  56.         };
  57.  
  58.         struct SVertCollector
  59.         {
  60.                 SVertCollector(CVertexList& vertList, std::vector<std::pair<float, unsigned>>& verts, unsigned char flags)
  61.                         : vertList(vertList), verts(verts), flags(flags) {}
  62.  
  63.                 void operator()(const SVertexRecord& record, float distSq)
  64.                 {
  65.                         if (vertList.GetVertex(record.vertIndex).flags & flags)
  66.                                 verts.push_back(std::make_pair(distSq, record.vertIndex));
  67.                 }
  68.  
  69.                 CVertexList&                             vertList;
  70.                 unsigned char                            flags;
  71.                 std::vector<std::pair<float, unsigned>>& verts;
  72.         };
  73.  
  74.         /// Our spatial structure
  75.         CHashSpace<SVertexRecord, VertexHashSpaceTraits>* m_hashSpace;
  76.  
  77.         Obstacles m_obstacles;
  78. };
  79.  
  80. #endif // #ifndef _VERTEX_LIST_
  81.  
downloadVertexList.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top