This driver will load the Ground_DB II terrain database and create an F-16 entity on start, attach the main observer to it, and then move the F16 a small amount each time that it's ticked. This example adds a driver via a plugin.
The example driver's onStart() method loads the database first.
It then creates a new entity facade and tells it to use the f-16_Falcon Visual Definition.
Using the coordinate system information provided by the loaded terrain database, the driver provides an initial position and orientation in the coordinate system of the database.
The current observer is then attached to the newly created entity, and reset to provide a perspective view.
The driver manager ticks the example driver by calling its onTick() method. The onTick() method updates the driver's local kinematic member variables and then passes them on to the entity facade.
The driver is stopped by the driver manager callings its onStop() method. This cleans up the entity facade allocated on the heap.
The example driver is created, added to the driver manager, and started in the main program.
The plugin registers the install function to be called after the DtDe has been initialized.
This example is a plug-in. You can run it by running ./bin64/exampleDriverPlugin_stealth.bat (on Windows) or ./bin64/exampleDriverPlugin_stealth.sh (on Linux). Press the "s" key to get away from the entity and see the HAT line. For more information about running examples, please see Running Applications and Examples.
#include <vrvCore/DtWakeModelAgent.hpp>
#include <vrvCore/DtSceneObjectAgent.hpp>
#include <matrix/LibMatrix.h>
#include <functional>
using namespace makVrv;
: myDe(de)
, myEntityFacade(0)
, myEntityIndicator(0)
, myEntityInfoWidget(0)
, myEntityDisplayName("")
, myEntityInfoWidgetPinnedFlag(false)
, myPosition()
, myOrientation()
, myLastUpdateTime(0.0)
, myEntityHATLineFacade(0)
, myHeading(0.0)
, myLastCommLineTime(0.0)
#ifdef SIM_IS_SHIP
, myOrbitCenter(-9500.0, 17200.0, 10.0)
, myAngularVelocity(0.006)
, myClockAngle(0.0)
, myRadius(5000.0)
, myRoll(0.0)
, myLastPosition(-9500.0, 22200.0, 10.)
#else
, myOrbitCenter(0.0, 0.0, 350.0)
, myAngularVelocity(0.1)
, myClockAngle(0.0)
, myRadius(1000.0)
, myRoll(0.6)
#endif
{
myCoordinateSystem = myDe.sharedState().coordinateSystem().clone();
if (myCoordinateSystem == nullptr)
{
DtTHROW_NEW(DtCorruptedState, "myDe.sharedState().coordinateSystem().clone() failed.");
}
mySignalConnections += DtDeSharedStateSignaler::instance(myDe).signal_coordinateSystemChanged.connect(
slot_coordinateSystemChanged();
}
{
}
{
}
{
#ifdef SIM_IS_SHIP
#else
#endif
DtSharedSettingsManager::instance(
myDe), elementId,
true);
#ifdef SIM_IS_SHIP
wakeModelAgent->setSprayEnabled(true);
wakeModelAgent->setBowSprayOffset(58.);
wakeModelAgent->setSpraySizeScale(3.);
wakeModelAgent->setNumHullSprays(5);
wakeModelAgent->setHullSprayStart(-155.);
wakeModelAgent->setHullSprayEnd(30.);
wakeModelAgent->setPropWashEnabled(true);
wakeModelAgent->setShipLength(300.);
wakeModelAgent->setBeamWidth(16.);
wakeModelAgent->setDraft(10.);
wakeModelAgent->setSprayVelocityScale(0.65);
wakeModelAgent->setBowWaveScale(1.);
wakeModelAgent->setBowSize(2.);
wakeModelAgent->setBowWaveOffset(70.);
wakeModelAgent->setSternWaveOffset(-60.);
wakeModelAgent->setWakeOffset(0.);
wakeModelAgent->setPropWashOffset(-75.);
wakeModelAgent->setPropWashFadeTime(30.);
wakeModelAgent->setMaxBowWaveAmplitude(5.);
wakeModelAgent->setHullSpraySizeScale(1.);
wakeModelAgent->setHullSprayVelocityScale(0.4);
wakeModelAgent->setHullSprayVerticalOffset(1.);
#else
#endif
DtStateVisualizer::EntityVisualizerType);
#ifndef SIM_IS_SHIP
#endif
return true;
}
{
{
{
}
{
}
}
return true;
}
{
if (idList.size() == 0)
{
return 0;
}
if (updater)
{
}
return 0;
}
{
{
}
return true;
}
{
widgetSignaler);
if (active)
{
}
else
{
}
}
{
{
DtOverlayGroupManager::instance(myDe);
DtStateVisualizer::EntityVisualizerType);
}
{
}
}
{
DtReferenceEllipsoid refEllip(DtWGS84);
DtGeodeticCoord geod(&refEllip);
DtTaitBryan hpr;
const char* entityFormatString =
"Marking :%s\n"
"Heading :%.2f Deg\n"
"Lat|Lon :%.2fN %.fE\n"
"Alt. :%.1f m above sea level";
std::string buffer;
buffer.resize(1024, '0');
{
int charsWritten = sprintf(
const_cast<char*>(buffer.c_str()), entityFormatString,
DtRad2Deg(geod.lat()),
DtRad2Deg(geod.lon()),
);
buffer.resize(charsWritten, '0');
}
return DtUnicode::fromUtf8(buffer);
}
{
double now = simTime;
#ifdef SIM_IS_SHIP
#else
#endif
myLastUpdateTime = now;
}
#ifdef SIM_IS_SHIP
void DtExampleSimEngine::repositionShip(
DtVector position, DtTaitBryan ori,
double dt)
#else
#endif
{
coordConverter = myCoordinateSystem->converter();
if (coordConverter->
type() == DtCoordinateConverter::Geocentric)
{
DtGeodeticCoord geod(DtDeg2Rad(10.0), DtDeg2Rad(60.0), 0.0);
}
else
{
}
myEntityFacade->setOrientation(myOrientation);
myEntityFacade->setPosition(myPosition);
#ifdef SIM_IS_SHIP
DtVecSub(position, myLastPosition, vecDiff);
myEntityFacade->setVelocity(DtVector64To32(velocity));
myLastPosition = position;
#endif
}
{
DtSelectionManager::IdSet::const_iterator i = sel.begin();
DtSelectionManager::IdSet::const_iterator e = sel.end();
for (; i != e; ++i)
{
{
}
}
}