Paged Terrain Tutorial
Name | Location |
---|---|
Paged Terrain | <Vortex Studio Installation Folder>\tutorials\ExPagedTerrain |
This tutorial how to create a paged terrain extension.
A paged terrain extension allows a user to feed the simulation with terrain information.
A classic example would be simulating driving on a large map. Since the map is too big to be created in Vortex, the client database can be used to feed Vortex as needed.
The extension is usually added to a scene or a setup. It manages a Terrain Producer, which answer to a VxTerrainInterface.
Vortex will detect when a terrain tile is needed, based on the location of dynamics objects and will query the interface for terrain information.
The tutorial shows how to add a terrain surface and objects such as trees and post.
Classes
TerrainSource
This source is a virtual database with its own interface. It is completely unrelated to Vortex structure.
The Internal implementation of the source is not of interest for the tutorial and is provided as an example
The source simulates an infinite terrain made of predefined features.
Here the infinite terrain goes as follow :
- One surface for each request. The surface can return an height at given position
- One Tree by request located near a corner of the surface
- One Post at each 72X72 grid point.
The source was built to be called in a specific sequence:
- SearchFeatureIntersecting returns some FeatureKey
- FeatureTypeFromKey and GetXX can be called with FeatureKey returned in 1. of current sequence.
- Restart at point 1.
PagedTerrain
This class adapts the content of a given source to Vortex as a paged terrain.
Its role is to:
- Retrieve from the source, upon request, the objects laying in a region of interest.
- Convert the retrieved objects into Vortex objects.
- Insert the objects into the terrain producer.
- Inform the producer that the object lies in the new region requested. This must be done even if the retrieved object is already in the terrain producer; in this case, there is no need to perform step #2.
- function in an asynchronous, or non-blocking, manner.
PagedTerrainExtension
The paged terrain extension adds a paged terrain producer for simulation of a client terrain database to a Vortex simulation.
The paged terrain extension will then automatically create terrain elements where needed to support collisions with the mechanism you have added to the scene.
See Vortex Studio SDK - Paged Terrain Producer for more information
Using the tutorial
- Open Tutorials solution
- Compile the ExPagedTerrain project.
- From the <Vortex Studio Installation Folder>\tutorials\plugins folder, copy the built ExPagedTerrain.vxp into the Vortex Studio plugins folder (<Vortex Studio Installation Folder>\plugins).
- The code is fully documented for extra information.
- Launch the Vortex Editor
- Create a scene
- Add the paged terrain. It can be found under the "Tutorials" category in the editor's toolbox.
- Add some vehicles from the Vortex Studio SamplesÂ
- Save the scene.
- Start the simulation
- If required, move the mechanism slightly from its initial location before starting the simulation, so that it does not start directly inside a post or a tree geometry, or underneath the terrain surface produced by the paged terrain extension.
- By moving the vehicle around, new tiles of terrain should be generated as needed.