![]() |
VR-Forces 5.0.3 Developer's Guide
|
The Extent Terrain Implementation example demonstrates the following:
The out of the box VR-Forces terrain loaders can load many types of terrains, but a user may want to create a new terrain implementation to:
To acheive these goals, a user needs to create a new class derived from DtTerrainImplementation, and register it with the DtTerrainInterface's addTerrainImplementation function.
The source and project files for this example are in ./examples/extentTerrainImplementation. A sample MTF file set up to load the new implementation is included in the same directory.
The example creates a new derived DtTerrainImplementation. The new terrain implementation implements a Flat Earth extent at alt = 0.
When actual triangles are needed by B-HAVE, they are generated.
The general process for creating a controller is as follows:
To get the derived terrain implementation to be created, you need to load an MTF file with the appropriate generic record. The "type" for the generic record should be "simTerrain-extent". See the following excerpt from the example MTF:
<myGenericRecords class_id="14" tracking_level="0" version="0"> <count>1</count> <item_version>1</item_version> <Type>simTerrain-extent</Type> <Parameters class_id="5" tracking_level="0" version="0"> <ParameterMap class_id="6" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </ParameterMap> </Parameters> </myGenericRecords>
Look at extentImplementation.mtf for a full mtf file that is set up in this way.
To install the plugin, copy the extentTerrainImplementation.dll into the proper subdirectory /bin64/terrainImplementations/debug or release/ (depending on what is being run). Any dll in this directory will be loaded by the VR-Forces sim and its DtRegisterTerrainImplementation function will be called.
Also copy the extentImplementation.mtf into the /SharedData/.../TerrainData/TerrainConfiguration/ . The .mtf file ships in the example directory.
To run the application:
| DtExtentTerrainImplementation | This subclass of DtTerrainImplementation implements a Flat Earth extent at altitude 0. |
/*******************************************************************************
** Copyright (c) 2011 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//Example includes
#include "extentTerrainImplementation.h"
//VRF includes
#include "vrfcgf/vrfPluginExtension.h"
#include "terrainInterface/terrainInterface.h"
extern "C" {
bool DT_VRF_DLL_PLUGIN DtRegisterTerrainImplementation(DtTerrainInterface* terrainIf)
{
//Install the terrain Implementation.
terrainIf->addTerrainImplementation("simTerrain-extent", DtExtentTerrainImplementation::create);
return true;
}
};