gwnavruntime/navmesh/identifiers/stitch1to1edgelink.h Source File

stitch1to1edgelink.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 #pragma once
8 
10 
11 namespace Kaim
12 {
13 
15 // Stitch1To1EdgeLink
17 
18 class Stitch1To1EdgeLink
19 {
20  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
21 
22 public:
24  Stitch1To1EdgeLink();
25 
29  Stitch1To1EdgeLink(NavFloor* navFloor, KyUInt32 stitch1To1EdgeIdx);
30 
34  void Set(NavFloor* navFloor, KyUInt32 stitch1To1EdgeIdx);
35 
37  bool IsValid() const;
38 
39  void Invalidate();
40 
41  bool operator==(const Stitch1To1EdgeLink& rhs) const;
42  bool operator!=(const Stitch1To1EdgeLink& rhs) const;
43 
44  // ---------------------------------- Member Functions for valid instance ----------------------------------
47 
50  NavFloor* GetNavFloor() const;
51 
54  const NavFloorBlob* GetNavFloorBlob() const;
55 
56 public:
57  NavFloor* m_navFloor;
58  KyUInt16 m_stitch1To1EdgeIdx;
59  KyUInt16 m_correspondingOfStitch1To1Idx;
60 };
61 
62 
63 
64 KY_INLINE Stitch1To1EdgeLink::Stitch1To1EdgeLink() : m_navFloor(), m_stitch1To1EdgeIdx(KyUInt16MAXVAL), m_correspondingOfStitch1To1Idx(KyUInt16MAXVAL) {}
65 
66 KY_INLINE Stitch1To1EdgeLink::Stitch1To1EdgeLink(NavFloor* navFloor, NavHalfEdgeIdx stitch1To1EdgeIdx) :
67 m_navFloor(navFloor), m_stitch1To1EdgeIdx((CompactNavHalfEdgeIdx)stitch1To1EdgeIdx), m_correspondingOfStitch1To1Idx(KyUInt16MAXVAL) {}
68 
69 KY_INLINE void Stitch1To1EdgeLink::Set(NavFloor* navFloor, NavHalfEdgeIdx stitch1To1EdgeIdx)
70 {
71  m_navFloor = navFloor;
72  m_stitch1To1EdgeIdx = (CompactNavHalfEdgeIdx)stitch1To1EdgeIdx;
73  m_correspondingOfStitch1To1Idx = KyUInt16MAXVAL;
74 }
75 
76 KY_INLINE bool Stitch1To1EdgeLink::IsValid() const { return m_navFloor != nullptr && m_stitch1To1EdgeIdx != KyUInt16MAXVAL; }
77 KY_INLINE void Stitch1To1EdgeLink::Invalidate() { m_navFloor = nullptr; m_stitch1To1EdgeIdx = KyUInt16MAXVAL; m_correspondingOfStitch1To1Idx = KyUInt16MAXVAL; }
78 
79 KY_INLINE bool Stitch1To1EdgeLink::operator==(const Stitch1To1EdgeLink& rhs) const { return m_navFloor == rhs.m_navFloor && m_stitch1To1EdgeIdx == rhs.m_stitch1To1EdgeIdx;}
80 KY_INLINE bool Stitch1To1EdgeLink::operator!=(const Stitch1To1EdgeLink& rhs) const { return !(*this == rhs); }
81 
82 KY_INLINE NavFloor* Stitch1To1EdgeLink::GetNavFloor() const { return m_navFloor; }
83 KY_INLINE const NavFloorBlob* Stitch1To1EdgeLink::GetNavFloorBlob() const { return m_navFloor->GetNavFloorBlob(); }
84 }
85 
86 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
KyUInt32 NavHalfEdgeIdx
An index that uniquely identifies a single edge of a triangle within the set of edges owned by a NavF...
Definition: navmeshtypes.h:84
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
std::uint16_t KyUInt16
uint16_t
Definition: types.h:28
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
#define KyUInt16MAXVAL
KyUInt16 max value
Definition: types.h:67