gwnavruntime/collision/heightfieldblob.h Source File

heightfieldblob.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 #ifndef Navigation_HeightFieldBlob_H
8 #define Navigation_HeightFieldBlob_H
9 
14 
15 namespace Kaim
16 {
17 
18 class HeightFieldBlob
19 {
20  KY_ROOT_BLOB_CLASS(CollisionData, HeightFieldBlob, 0)
21  KY_CLASS_WITHOUT_COPY(HeightFieldBlob)
22 
23 public:
24  HeightFieldBlob() {}
25 
26  Vec3f m_origin;
27  BlobArray<KyFloat32> m_altitudes;
28  KyFloat32 m_tileSize;
29  KyUInt32 m_xAltitudeCount;
30  KyUInt32 m_yAltitudeCount;
31 };
32 
33 inline void SwapEndianness(Endianness::Target e, HeightFieldBlob& self)
34 {
35  SwapEndianness(e, self.m_origin);
36  SwapEndianness(e, self.m_altitudes);
37  SwapEndianness(e, self.m_tileSize);
38  SwapEndianness(e, self.m_xAltitudeCount);
39  SwapEndianness(e, self.m_yAltitudeCount);
40 }
41 
42 class HeightFieldBlobBuilder : public BaseBlobBuilder<HeightFieldBlob>
43 {
44 public:
45  HeightFieldBlobBuilder(const Vec3f& origin, KyFloat32 tileSize, KyUInt32 xCount, KyUInt32 yCount) :
46  m_origin(origin), m_tileSize(tileSize), m_xAltitudeCount(xCount), m_yAltitudeCount(yCount) {}
47 
48  void DoBuild()
49  {
50  BLOB_SET(m_blob->m_origin, m_origin);
51  BLOB_ARRAY(m_blob->m_altitudes, m_xAltitudeCount * m_yAltitudeCount);
52  BLOB_SET(m_blob->m_tileSize, m_tileSize);
53  BLOB_SET(m_blob->m_xAltitudeCount, m_xAltitudeCount);
54  BLOB_SET(m_blob->m_yAltitudeCount, m_yAltitudeCount);
55  }
56 
57  Vec3f m_origin;
58  KyFloat32 m_tileSize;
59  KyUInt32 m_xAltitudeCount;
60  KyUInt32 m_yAltitudeCount;
61 };
62 
63 }
64 
65 #endif //Navigation_HeightFieldBlob_H
#define BLOB_SET(blob, value)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:136
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
HeightFieldBlob * m_blob
The blob maintained by this builder. Only modify using the macros listed under DoBuild().
Definition: baseblobbuilder.h:117
Definition: gamekitcrowddispersion.h:20
#define BLOB_ARRAY(blobArray, count)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:147
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43