gwnavruntime/path/positiononpathblob.h Source File

positiononpathblob.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 
8 #pragma once
9 
15 
16 namespace Kaim
17 {
18 
19 class PositionOnPathBlob
20 {
21  KY_ROOT_BLOB_CLASS(Runtime, PositionOnPathBlob, 0)
22 
23 public:
24  PositionOnPathBlob() : m_edgeIndex(KyUInt32MAXVAL), m_onPathStatus((KyUInt32)PositionOnPathStatus_Undefined) {}
25 
26  PositionOnPathStatus GetPositionStatus() const { return (PositionOnPathStatus)m_onPathStatus; }
27 public:
28  Vec3f m_positionOnPath;
29  KyUInt32 m_edgeIndex;
30  KyUInt32 m_onPathStatus;
31 };
32 inline void SwapEndianness(Endianness::Target e, PositionOnPathBlob& self)
33 {
34  SwapEndianness(e, self.m_positionOnPath);
35  SwapEndianness(e, self.m_edgeIndex);
36  SwapEndianness(e, self.m_onPathStatus);
37 }
38 
39 
40 class PositionOnPathBlobBuilder: public BaseBlobBuilder<PositionOnPathBlob>
41 {
42  KY_CLASS_WITHOUT_COPY(PositionOnPathBlobBuilder)
43 
44 public:
45  PositionOnPathBlobBuilder(const PositionOnPath* positionOnPath)
46  : m_positionOnPath(positionOnPath)
47  {}
48  ~PositionOnPathBlobBuilder() {}
49 
50 private:
51  virtual void DoBuild()
52  {
53  if ((m_positionOnPath != NULL) && (m_positionOnPath->GetPositionOnPathStatus() != PositionOnPathStatus_Undefined))
54  {
55  BLOB_SET(m_blob->m_positionOnPath, m_positionOnPath->GetPosition());
56  if (m_positionOnPath->GetPositionOnPathStatus() != PositionOnPathStatus_Undefined)
57  {
58  BLOB_SET(m_blob->m_edgeIndex , m_positionOnPath->GetPathEdgeIndex());
59  }
60  BLOB_SET(m_blob->m_onPathStatus, (KyUInt32)m_positionOnPath->GetPositionOnPathStatus());
61  }
62  }
63 
64 private:
65  const PositionOnPath* m_positionOnPath;
66 };
67 
68 
69 }
70 
#define BLOB_SET(blob, value)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:130
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
PositionOnPathStatus
< enumerates="" the="" different="" status="" an="" objectpositiononpath="" can="" have="" on="" its="" path.="" />
Definition: positiononpath.h:17
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
The PositionOnPath is not yet defined.
Definition: positiononpath.h:19
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
PositionOnPathBlob * m_blob
The blob maintained by this builder. Only modify using the macros listed under DoBuild().
Definition: baseblobbuilder.h:113
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
#define KyUInt32MAXVAL
KyUInt32 max value
Definition: types.h:68