gwnavruntime/navmesh/blobs/navvertex.h Source File

navvertex.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 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 
8 // Primary contact: JUBA - secondary contact: NOBODY
9 #ifndef Navigation_NavVertex_H
10 #define Navigation_NavVertex_H
11 
15 
16 namespace Kaim
17 {
18 
21 class NavVertex
22 {
23 public:
24  NavVertex();
25 
26  KyInt64 GetX64() const;
27  KyInt64 GetY64() const;
28  KyInt32 GetX32() const;
29  KyInt32 GetY32() const;
30 
31  CoordPos GetCoordPos() const;
32  CoordPos64 GetCoordPos64() const;
33 
36  KY_INLINE KyUInt8 operator[](KyInt32 idx) const { return (&x)[idx]; }
37 
38  bool operator==(const NavVertex& v) const;
39  bool operator!=(const NavVertex& v) const;
40  bool operator< (const NavVertex& v) const;
41  bool operator> (const NavVertex& v) const;
42 public:
43  KyUInt8 x;
44  KyUInt8 y;
45 };
46 
49 KY_INLINE void SwapEndianness(Endianness::Target e, NavVertex& self)
50 {
51  SwapEndianness(e, self.x);
52  SwapEndianness(e, self.y);
53 }
54 
55 KY_INLINE NavVertex::NavVertex() : x(0xFF), y(0xFF) {}
56 
57 KY_INLINE KyInt64 NavVertex::GetX64() const { return (KyInt64)GetX32(); }
58 KY_INLINE KyInt64 NavVertex::GetY64() const { return (KyInt64)GetY32(); }
59 KY_INLINE KyInt32 NavVertex::GetX32() const { return IntCoordSystem::PixelCoordToInt((KyInt32)x); }
60 KY_INLINE KyInt32 NavVertex::GetY32() const { return IntCoordSystem::PixelCoordToInt((KyInt32)y); }
61 KY_INLINE CoordPos NavVertex::GetCoordPos() const { return CoordPos(GetX32(), GetY32()); }
62 KY_INLINE CoordPos64 NavVertex::GetCoordPos64() const { return CoordPos64(GetX64(), GetY64()); }
63 
64 KY_INLINE bool NavVertex::operator==(const NavVertex& v) const { return x == v.x && y == v.y; }
65 KY_INLINE bool NavVertex::operator!=(const NavVertex& v) const { return x != v.x || y != v.y; }
66 KY_INLINE bool NavVertex::operator< (const NavVertex& v) const { return (x != v.x) ? (x < v.x) : (y < v.y); }
67 KY_INLINE bool NavVertex::operator> (const NavVertex& v) const { return !operator<(v) && operator!=(v); }
68 
69 }
70 
71 #endif //Navigation_NavVertex_H
72 
KyInt64 GetY64() const
Returns the Y coordinate of the vertex.
Definition: navvertex.h:62
KyUInt8 x
Stores the X coordinate of the vertex. Do not modify.
Definition: navvertex.h:46
KyUInt8 operator[](KyInt32 idx) const
Retrieves the size of the vector around one of its axes.
Definition: navvertex.h:38
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
This class defines a two-dimensional vector whose coordinates are stored using 64-bit integers...
Definition: vec2ll.h:27
Vec2i CoordPos
A type that represents the position of a point within the 2D integer grid.
Definition: navmeshtypes.h:23
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
CoordPos GetCoordPos() const
Returns the position of the vertex in an integer grid. For internal use.
Definition: navvertex.h:65
KyInt32 GetY32() const
Returns the Y coordinate of the vertex.
Definition: navvertex.h:64
Vec2LL CoordPos64
A type that represents the position of a point within the 2D integer grid.
Definition: navmeshtypes.h:19
unsigned char KyUInt8
Type used internally to represent an unsigned 8-bit integer.
Definition: types.h:41
This class defines a two-dimensional vector whose coordinates are stored using 32-bit integers...
Definition: vec2i.h:26
Definition: gamekitcrowddispersion.h:20
CoordPos64 GetCoordPos64() const
Returns the position of the vertex in an integer grid. For internal use.
Definition: navvertex.h:66
KyUInt8 y
Stores the Y coordinate of the vertex. Do not modify.
Definition: navvertex.h:47
__int64 KyInt64
Type used internally to represent a 64-bit integer.
Definition: types.h:37
Represents a single vertex that forms the corner of at least one NavMesh triangle.
Definition: navvertex.h:22
KyInt32 GetX32() const
Returns the X coordinate of the vertex.
Definition: navvertex.h:63
KyInt64 GetX64() const
Returns the X coordinate of the vertex.
Definition: navvertex.h:61