gwnavgeneration/input/clientinputchunk.h Source File

clientinputchunk.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 
9 
14 
15 namespace Kaim
16 {
17 
18 class DynamicClientInputChunk
19 {
20  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
21 
22 public:
23  DynamicClientInputChunk() {}
24 
25 public:
26  KyArray<DynamicTaggedTriangle3f> m_dynTaggedTriangle3fs; // in client coordinates
27  KyArray<ClientInputTagVolume> m_tagVolumes; // in client coordinates
28  KyArray<Vec3f> m_seedPoints; // in client coordinates
29 };
30 
31 class ClientInputChunk
32 {
33  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
34  KY_ROOT_BLOB_CLASS(Generator, ClientInputChunk, 0)
35 
36 public:
37  ClientInputChunk() {}
38 
39 public:
40  BlobArray<TaggedTriangle3f> m_taggedTriangle3fs; // in client coordinates
41  BlobArray<ClientInputTagVolumeBlob> m_tagVolumeBlobs; // in client coordinates
42  BlobArray<Vec3f> m_seedPoints; // in client coordinates
43 };
44 inline void SwapEndianness(Endianness::Target e, ClientInputChunk& self)
45 {
46  SwapEndianness(e, self.m_taggedTriangle3fs);
47  SwapEndianness(e, self.m_tagVolumeBlobs);
48  SwapEndianness(e, self.m_seedPoints);
49 }
50 
51 class ClientInputChunkBlobBuilder : public BaseBlobBuilder<ClientInputChunk>
52 {
53 public:
54  ClientInputChunkBlobBuilder(const DynamicClientInputChunk& clientInputChunk) : m_dynClientInputChunk(&clientInputChunk) {}
55 private:
56  virtual void DoBuild()
57  {
58  // triangles
59  TaggedTriangle3f* taggedTriangle3fArray = BLOB_ARRAY(m_blob->m_taggedTriangle3fs, m_dynClientInputChunk->m_dynTaggedTriangle3fs.GetCount());
60  for (UPInt i = 0; i < m_dynClientInputChunk->m_dynTaggedTriangle3fs.GetCount(); ++i)
61  {
62  TaggedTriangle3fBlobBuilder blobBuider(m_dynClientInputChunk->m_dynTaggedTriangle3fs[i]);
63  BLOB_BUILD(taggedTriangle3fArray[i], blobBuider);
64  }
65 
66  // tagVolumes
67  ClientInputTagVolumeBlob* tagVolumeBlobArray = BLOB_ARRAY(m_blob->m_tagVolumeBlobs, m_dynClientInputChunk->m_tagVolumes.GetCount());
68  for (UPInt i = 0; i < m_dynClientInputChunk->m_tagVolumes.GetCount(); ++i)
69  {
70  ClientInputTagVolumeBlobBuilder blobBuider(m_dynClientInputChunk->m_tagVolumes[i]);
71  BLOB_BUILD(tagVolumeBlobArray[i], blobBuider);
72  }
73 
74  // seedPoints
75  BLOB_ARRAY_COPY(m_blob->m_seedPoints, m_dynClientInputChunk->m_seedPoints.GetDataPtr(), m_dynClientInputChunk->m_seedPoints.GetCount());
76  }
77 
78  const DynamicClientInputChunk* m_dynClientInputChunk;
79 };
80 }
81 
82 
83 
#define BLOB_BUILD(blob, builder)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:175
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
ClientInputChunk * 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 BLOB_ARRAY(blobArray, count)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:139
#define BLOB_ARRAY_COPY(blobArray, src, count)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:151