#include <generator.h>
The Generator is the principal class in the NavData generation system.
The Generator is capable of generating multiple kinds of data files:
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.
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.
Inherits Kaim::RefCountBaseNTS< C, Stat >.
Public Member Functions | |
Generator (Ptr< GeneratorInputProducer > producer, Ptr< IParallelForInterface > parallelForInterface=0, Ptr< ITlsAlloc > tlsAlloc=0, Ptr< ICollisionInterface > visibilityInterface=0) | |
Generator (Ptr< GeneratorInputProducer > producer, Ptr< IGeneratorGlue > generatorGlue) | |
Configuration | |
void | SetFileOpener (FileOpenerBase *fileOpener) |
void | SetOutputDirectory (const char *absoluteOutputBaseDir, const char *relativeOutputDir) |
const String & | GetAbsoluteOutputDirectory () const |
Generation | |
KyResult | Generate (GeneratorInputOutput &config) |
Reporting | |
template<class OSTREAM > | |
void | LogConfiguration (OSTREAM &os) |
const GeneratorReport & | GetGeneratorReport () const |
const GeneratorProfiling & | GetGeneratorProfiling () const |
Internal Access Only | |
GeneratorSystem & | Sys () |
const KyArray< Ptr< GeneratorSectorBuilder > > & | GetSectorBuilders () const |
For internal use only | |
void | RemoveInputTilesPartTempDir () |
Kaim::Generator::Generator | ( | Ptr< GeneratorInputProducer > | producer, |
Ptr< IParallelForInterface > | parallelForInterface = 0 , |
||
Ptr< ITlsAlloc > | tlsAlloc = 0 , |
||
Ptr< ICollisionInterface > | visibilityInterface = 0 |
||
) |
Constructs a new Generator initialized with the provided information.
producer | A 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. |
parallelForInterface | A pointer to an object that the Generator will use to parallelize computations over multiple processors, or KY_NULL in order to perform all computations sequentially on a single processor. This object is ref-counted; It will be destroyed automatically when appropriate. |
tlsAlloc | A 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. |
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.
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
|
inline |
returns absoluteOutputBaseDir/relativeOutputDir set by SetOutputDirectory()
|
inline |
Get some profiling information about the time taken by the various steps of the generation.
|
inline |
Retrieves a detailed record of the results of the last call to Generate().
|
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.
absoluteOutputBaseDir | An absolute path used as a base path for relativeOutputDir |
relativeOutputDir | A relative path to absoluteOutputBaseDir. The absolute path to this directory is : absoluteOutputBaseDir/relativeOutputDir |