gwnavgeneration/input/generatorinputproducer.h Source File

generatorinputproducer.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: GUAL - secondary contact: NOBODY
9 #ifndef GwNavGen_PdgInputProducer_H
10 #define GwNavGen_PdgInputProducer_H
11 
12 
16 
17 // a forward declare of ClientInputConsumer would be enough but #include is handy
18 // to avoid the derivation to #include manually <gwnavgeneration/input/clientinputconsumer.h>
19 // and <gwnavgeneration/generator/generatorsector.h>
20 
21 namespace Kaim
22 {
23 
24 
25 class GeneratorSystem;
26 
27 
34 class GeneratorInputProducer : public RefCountBaseNTS<GeneratorInputProducer, MemStat_NavDataGen>
35 {
36 public:
41 
44  KyResult ProduceSectorInputs(const GeneratorSector& sector, ClientInputConsumer& sectorInputConsumer)
45  {
46  for (UPInt i = 0; i < sector.m_inputTagVolumes.GetSize(); ++i)
47  sectorInputConsumer.ConsumeTagVolume(sector.m_inputTagVolumes[i]);
48 
49  for (UPInt i = 0; i < sector.m_inputSeedPoints.GetSize(); ++i)
50  sectorInputConsumer.ConsumeSeedPoint(sector.m_inputSeedPoints[i]);
51 
52  // HeightFields & IndexedMeshes
53  for (UPInt i = 0; i < sector.m_inputFileNames.GetSize(); ++i)
54  {
55  const String& inputFileName = sector.m_inputFileNames[i];
56  const String fileNameExtension = inputFileName.GetExtension();
57 
58  if (fileNameExtension.CompareNoCase(".HeightField") == 0)
59  {
60  if (sectorInputConsumer.ConsumeHeightFieldFile(inputFileName) == KY_ERROR)
61  return KY_ERROR;
62  }
63  else if (fileNameExtension.CompareNoCase(".IndexedMesh") == 0)
64  {
65  if (sectorInputConsumer.ConsumeIndexedMeshFile(inputFileName) == KY_ERROR)
66  return KY_ERROR;
67  }
68  }
69 
70  if (Produce(sector, sectorInputConsumer) == KY_ERROR)
71  return KY_ERROR;
72 
73  return KY_SUCCESS;
74  }
75 
76 private:
86  virtual KyResult Produce(const GeneratorSector& sector, ClientInputConsumer& sectorInputConsumer) = 0;
87 };
88 }
89 
90 
91 #endif
92 
KyArray< ClientInputTagVolume > m_inputTagVolumes
Optional facility. Will be fed automatically to the Sector. Sometimes easier than producing TagVolume...
Definition: generatorsector.h:140
The ClientInputConsumer class is one of the primary components of the NavData generation system...
Definition: clientinputconsumer.h:67
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
KyResult ConsumeTagVolume(const ClientInputTagVolume &inputTagVolume)
Provides a single tag volume to the ClientInputConsumer.
GeneratorInputProducer()
Constructor for objects of this class.
Definition: generatorinputproducer.h:43
KyArray< String > m_inputFileNames
Optional facility. To be used in GeneratorInputProducer::ProduceSectorInputs().
Definition: generatorsector.h:138
KyResult ConsumeSeedPoint(const Vec3f &position)
Provides a seed point that identifies a walkable area of the terrain.
The GeneratorSector class provides a definition for a single sector to be treated by the Generator...
Definition: generatorsector.h:46
Definition: gamekitcrowddispersion.h:20
#define KY_SUCCESS
Shorthand for Kaim::Result::Success.
Definition: types.h:273
#define KY_ERROR
Shorthand for Kaim::Result::Failure.
Definition: types.h:272
KyArray< Vec3f > m_inputSeedPoints
Optional facility. Will be fed automatically to the Sector. Sometimes easier than producing seedPoint...
Definition: generatorsector.h:139
virtual KyResult Produce(const GeneratorSector &sector, ClientInputConsumer &sectorInputConsumer)=0
Called by the NavData generation system to retrieve the geometry associated to the sector...
KyResult ProduceSectorInputs(const GeneratorSector &sector, ClientInputConsumer &sectorInputConsumer)
Called by the NavData generation system to retrieve the geometry all the input associated with this s...
Definition: generatorinputproducer.h:48