![]() |
VR-Vantage 2.4 API Documentation
|
This example shows how to load an OpenFlight geometry file into a DtModelInstance and then add it to the scene. Of particular interest in this example is how to create and initialize a model instance.
To create a basic VR-Vantage application, first instantiate the application, initialize it and finally call run.
... add some content to the application ...
The content that this example application displays is geometry in a DtModelInstance. This application implements a helper function to create and load a DtModelInstance and add the geometry to the scene-graph.
The function accepts a reference to a display engine (DtDe) where the scene renderer can be found. The display engine passed to this function is retrieved directly from the application.
To load a geometry file into a DtModelInstance, the model-instance must first be created, then 'realized' with a model-definition. This example uses a DtOsgSimpleModelInstance (derived from DtModelInstance) to load the geometry. The DtModelDefinition holds information on how to load and initialize the geometry. This example only use the DtModelDefinition to specify the geometry file to load.
This example places the DtModelInstance geometry under a transform node so the model can be moved in the scene.
To add the geometry into the VR-Vantage scene, the renderer is retrieved from the display engine and the transform is added to a root of the scene.
This example chose to place the geometry under the 'propRoot' of the renderer. Depending on the purpose of the model it could have been placed under one of the other root domains; Environment, Terrain, ModelSets, etc.
VR-Vantage includes pre-built versions of the example application. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.
This example is an application. You can run it by running ./bin/exampleModelInstance.exe (on Windows) or ./bin/exampleModelInstance (on Linux). For more information about running examples, please see Running Applications and Examples.