gwnavgeneration/input/clientinputchunk.h Source File

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