Copyright VirtualSim 2004-2020 - All rights reserved
Scenario Setup
In Database::Settings::Runtime, make sure that Directory is set to: $(TITAN_DIR)\plugins. vsTASKER will generate a DLL to be loaded by Titan.
Make sure that Database::Settings::Link generates a DLL
In Classes::Global::Definitions, add the following:
#include "titan/vt_titan.h"
The vt_titan.h (vcc_titan.lib), contains an API to simplify the coding of some Titan interactions. It will contain more and more functions by time.
In Classes::Global::Declaration, add this line:
extern TitanRoot* titan_root;
The titan_root variable is setup by the Titan viewer code (vt_runtime_titan.cpp). It is defined in vt_titan.h and contains major pointers to the Titan core engine (interface).
In Classes::Global::Declaration, setup the titan_root pointer:
case INIT: {
titan_root = (TitanRoot*) udata();
} break;
As titan_root is declared external, the setup is not mandatory.
In Classes::Scenario::Declaration, add the following public static method:
float alt = vtTitan::getTerrainHeightAt(lla.lat, lla.lon);
return alt + offset;
}
You can decide to use this function in replacement of the default vsTASKER getAlt() or whenever you need it. If the scenario has a terrain elevation loaded, calling this function might not be necessary as it is CPU intensive.
In Classes::Entity::Declaration, add the following public pointer:
TitanEntity* te;
and in InitalizationINIT part, set it this way:
te = (TitanEntity*) find(TT_Component, "TitanEntity");
This component is mandatory for an entity to be created in Titan engine. See the Development Guide for more information on this component.
The database template Titan contains already these settings.