Kaim::Generator Class Reference

#include <generator.h>

Class Description

The Generator is the principal class in the NavData generation system.

Output files

The Generator is capable of generating multiple kinds of data files:

  • .ClientInput files, which are records of the input triangles, NavTags and TagVolumes that describe your terrain, passed as inputs to the NavData generation system.
  • .GenIO files, which record the list of sectors and the generation parameters that where used when the Generator::Generate() function was called. See Kaim::GeneratorInputOutput class
  • Intermediate data files, which record temporary data calculated during the generation process. Mostly for debug purposes.
  • Final .NavData files, which contain the final data that you will load into your game at runtime. You can control which types of data files you want to generate each time you use the Generator.

Sectors and multi-sectors

The Generator can be set up with any number of sectors, each of which is responsible for a block of terrain geometry within a defined area of your game world. Separate input, intermediate and output data are created for each sector, so that the sectors can be streamed into memory independently at runtime. Adjacent sectors whose triangles lie close to each other will be linked automatically at runtime. You can also configure the Generator to re-partition each sector that you provide into smaller sectors automatically.

+ Examples:

Inherits Kaim::RefCountBaseNTS< C, Stat >.

Public Member Functions

 Generator (Ptr< GeneratorInputProducer > producer, Ptr< IParallelForInterface > parallelForInterface=nullptr, Ptr< ITlsAlloc > tlsAlloc=nullptr, Ptr< ICollisionInterface > collisionInterface=nullptr)
 Constructs a new Generator initialized with the provided information. More...
 
 Generator (Ptr< GeneratorInputProducer > producer, Ptr< IGeneratorGlue > generatorGlue)
 Constructs a new Generator initialized with the provided GeneratorInputProducer and IGeneratorGlue. More...
 

Configuration

void SetFileOpener (FileOpenerBase *fileOpener)
 Sets the Kaim::FileOpenerBase derived class that will be used to open any files. More...
 
void SetOutputDirectory (const char *absoluteOutputBaseDir, const char *relativeOutputDir)
 Sets the directory used for the generation. More...
 
const String & GetAbsoluteOutputDirectory () const
 returns absoluteOutputBaseDir/relativeOutputDir set by SetOutputDirectory() More...
 

Generation

KyResult Generate (GeneratorInputOutput &config)
 Launch the generation of the sectors stored in config, using the config parameters and runOptions also defined in this structure. More...
 

Reporting

template<class OSTREAM >
void LogConfiguration (OSTREAM &os)
 Creates a detailed record of all configuration parameters and sector information, and writes the record to the specified stream. More...
 
const GeneratorReportGetGeneratorReport () const
 Retrieves a detailed record of the results of the last call to Generate(). More...
 
const GeneratorProfiling & GetGeneratorProfiling () const
 Get some profiling information about the time taken by the various steps of the generation. More...
 

Internal Access Only

GeneratorSystemSys ()
 
const KyArray< Ptr< GeneratorSectorBuilder > > & GetSectorBuilders () const
 

Constructor & Destructor Documentation

Kaim::Generator::Generator ( Ptr< GeneratorInputProducer producer,
Ptr< IParallelForInterface parallelForInterface = nullptr,
Ptr< ITlsAlloc >  tlsAlloc = nullptr,
Ptr< ICollisionInterface collisionInterface = nullptr 
)

Constructs a new Generator initialized with the provided information.

Parameters
producerA pointer to an object that the Generator will use to retrieve the input data for each sector.This object is ref-counted : It will be destroyed automatically when appropriate.
parallelForInterfaceA pointer to an object that the Generator will use to parallelize computations over multiple processors, or nullptr in order to perform all computations sequentially on a single processor. This object is ref-counted; It will be destroyed automatically when appropriate.
tlsAllocA pointer to an object that the Generator will use to allocate and free memory in secondary threads, when configured to use parallel generation. This object is ref-counted; It will be destroyed automatically when appropriate.
collisionInterfaceA pointer to an object that the Generator will use to cast 3D raycast against the input geometry. Not used at the moment.
Kaim::Generator::Generator ( Ptr< GeneratorInputProducer producer,
Ptr< IGeneratorGlue generatorGlue 
)

Constructs a new Generator initialized with the provided GeneratorInputProducer and IGeneratorGlue.

Requires an instance of a class that derives from IGeneratorGlue, which the Generator invokes to retrieve objects that implement IParallelForInterface and ITlsAlloc when needed.

Member Function Documentation

KyResult Kaim::Generator::Generate ( GeneratorInputOutput config)

Launch the generation of the sectors stored in config, using the config parameters and runOptions also defined in this structure.

See GeneratorInputOutput for more information

+ Examples:
const String& Kaim::Generator::GetAbsoluteOutputDirectory ( ) const
inline

returns absoluteOutputBaseDir/relativeOutputDir set by SetOutputDirectory()

const GeneratorProfiling& Kaim::Generator::GetGeneratorProfiling ( ) const
inline

Get some profiling information about the time taken by the various steps of the generation.

const GeneratorReport& Kaim::Generator::GetGeneratorReport ( ) const
inline

Retrieves a detailed record of the results of the last call to Generate().

+ Examples:
template<class OSTREAM >
void Kaim::Generator::LogConfiguration ( OSTREAM &  os)
inline

Creates a detailed record of all configuration parameters and sector information, and writes the record to the specified stream.

void Kaim::Generator::SetFileOpener ( FileOpenerBase fileOpener)

Sets the Kaim::FileOpenerBase derived class that will be used to open any files.

This is not mandatory to call this function, an instance of DefaultFileOpener will be used automatically.

void Kaim::Generator::SetOutputDirectory ( const char *  absoluteOutputBaseDir,
const char *  relativeOutputDir 
)

Sets the directory used for the generation.

It is passed as an absolute directory and a relative path. The relative path will be embedded in the generated data, so when visual debugging all data can be found by providing absoluteBaseDirectory to the NavigationLab.

Parameters
absoluteOutputBaseDirAn absolute path used as a base path for relativeOutputDir
relativeOutputDirA relative path to absoluteOutputBaseDir. The absolute path to this directory is : absoluteOutputBaseDir/relativeOutputDir
+ Examples:

The documentation for this class was generated from the following files:
  • gwnavgeneration/generator/generator.h
  • gwnavgeneration/generator/generator.cpp