CRYENGINE Show OffGridLinks.h Source code
Return
Download CRYENGINE:
download OffGridLinks.h Source code
- Download CRYENGINE Source code - Type:.h
- // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
- #ifndef __OFFMESH_LINKS_H__
- #define __OFFMESH_LINKS_H__
- #pragma once
- #include "../MNM/MNM.h"
- struct NavigationMesh;
- struct IAIPathAgent;
- namespace MNM
- {
- //////////////////////////////////////////////////////////////////////////
- /// One of this objects is bound to every Navigation Mesh
- /// Keeps track of off-mesh links per Tile
- /// Each tile can have up to 1024 Triangle links (limited by the Tile link structure within the mesh)
- ///
- /// Some triangles in the NavigationMesh will have a special link with an index
- /// which allows to access this off-mesh data
- struct OffMeshNavigation
- {
- private:
- //////////////////////////////////////////////////////////////////////////
- //Note: This structure could hold any data for the link
- // For the time being it will store the necessary SO info to interface with the current SO system
- struct TriangleLink
- {
- TriangleID startTriangleID;
- TriangleID endTriangleID;
- OffMeshLinkID linkID;
- };
- //////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- struct TileLinks
- {
- TileLinks()
- : triangleLinks(NULL)
- , triangleLinkCount(0)
- {
- }
- ~TileLinks()
- {
- SAFE_DELETE_ARRAY(triangleLinks);
- }
- void CopyLinks(TriangleLink* links, uint16 linkCount);
- TriangleLink* triangleLinks;
- uint16 triangleLinkCount;
- };
- public:
- struct QueryLinksResult
- {
- QueryLinksResult(const TriangleLink* _firstLink, uint16 _linkCount)
- : pFirstLink(_firstLink)
- , currentLink(0)
- , linkCount(_linkCount)
- {
- }
- WayTriangleData GetNextTriangle() const
- {
- if (currentLink < linkCount)
- {
- currentLink++;
- return WayTriangleData(pFirstLink[currentLink - 1].endTriangleID, pFirstLink[currentLink - 1].linkID);
- }
- return WayTriangleData(0, 0);
- }
- private:
- const TriangleLink* pFirstLink;
- mutable uint16 currentLink;
- uint16 linkCount;
- };
- #if DEBUG_MNM_ENABLED
- struct ProfileMemoryStats
- {
- ProfileMemoryStats()
- : offMeshTileLinksMemory(0)
- , totalSize(0)
- {
- }
- size_t offMeshTileLinksMemory;
- size_t totalSize;
- };
- #endif
- void AddLink(NavigationMesh& navigationMesh, const TriangleID startTriangleID, const TriangleID endTriangleID, OffMeshLinkID& linkID);
- void RemoveLink(NavigationMesh& navigationMesh, const TriangleID boundTriangleID, const OffMeshLinkID linkID);
- void InvalidateLinks(const TileID tileID);
- QueryLinksResult GetLinksForTriangle(const TriangleID triangleID, const uint16 index) const;
- #if DEBUG_MNM_ENABLED
- ProfileMemoryStats GetMemoryStats(ICrySizer* pSizer) const;
- #endif
- private:
- typedef std::unordered_map<TileID, TileLinks, stl::hash_uint32> TTilesLinks;
- TTilesLinks m_tilesLinks;
- static OffMeshLinkID s_linkIDGenerator;
- };
- }
- #endif //__OFFMESH_LINKS_H__
downloadOffGridLinks.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