vsTASKER 7 Tutorial
×
Menu
Index

Scenario Setup

 
Make sure that Database::Settings::Link generates a DLL
 
 
#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.
 
 
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).
 
 
case INIT: {
   titan_root = (TitanRoot*) udata();
} break;
 
As titan_root is declared external, the setup is not mandatory.
 
 
static float titanGetAlt(WCoord&, float offset =0);
 
and define it in Classes::Scenario::Methods:
 
// warning: this function is static!
float Scn::titanGetAlt(WCoord& pos, float offset)
{
   WCoord lla = pos;
   lla.convertToLLA();
   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.
 
 
TitanEntity* te;
 
and in Initalization INIT 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.