VR-Vantage
Loading...
Searching...
No Matches
exampleDriverPlugin

Overview

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.

Expected Result

Example Driver Plugin Result

Example details

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.

void installDriver(DtDe& de)
DT_DLL_EXAMPLEPROJECTILE void installDriver(makVrv::DtDe &de)
{
// Create DtExampleDriver.
DtExampleDriver* driver = new DtExampleDriver( de.agentManager());
// The driver is now owned by the display engine. Do not delete it.
de.driverManager().addDriver(driver);
// Start the driver, creating the agent.
de.driverManager().startDriver(driver);
Definition DtExampleDriver.h:20

The plugin registers the install function to be called after the DtDe has been initialized.

if (de.isInMasterMode())

Building the Example

VR-Vantage includes pre-built versions of the example plug-in. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.

Running the Example

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.

Example Source Files


exampleDriver.h

/*****************************************************************************
* Copyright (c) 2019 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#pragma once
#include <string>
// This driver creates and owns the example driver.
{
public:
virtual ~DtExampleDriver();
virtual const std::string& className() const;
protected:
virtual bool onStart();
virtual bool onStop();
virtual bool onTick();
virtual void attachObserverToEntity(const std::string& entityName);
virtual void slot_displayEngineAdded(const makVrv::DtDeRecord& igRecord);
protected:
};
Contains makVrv:DtDriver class.
virtual ~DtExampleDriver()
Virtual DTOR.
DtExampleDriver(makVrv::DtAgentManager &am)
CTOR.
virtual bool onTick()
DtExampleSimEngine * myExampleSimEngine
Definition DtExampleDriver.h:63
virtual const std::string & className() const
virtual bool onStop()
virtual void attachObserverToEntity(const std::string &entityName)
virtual bool onStart()
virtual void slot_displayEngineAdded(const makVrv::DtDeRecord &igRecord)
Provide a basic sim engine to use in an example showing how to embed a sim engine into a driver that ...
Definition exampleDriver/DtExampleSimEngine.h:49
The DtAgentManager manages the distributed scene object framework. This includes the objects and upda...
Definition DtAgentManager.h:39
A Record of an IG instance.
Definition DtDeRecord.h:25
The DtDriver is an abstract class. Developers derive from this to create logic that "directs" things ...
Definition DtDriver.h:32

exampleDriver.cxx

exampleSimEngine.h

/*****************************************************************************
* Copyright (c) 2023 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#pragma once
#include <matrix/vlTaitBryan.h>
#include <matrix/vlVector.h>
#include <string>
//#define SIM_IS_SHIP
namespace makVrv
{
class DtEntity3dFacade;
class DtEntityHATLineFacade;
class DtDe;
class DtCoordinateSystem;
}
{
public:
bool init();
bool uninit();
bool tick(double simTime);
protected:
const makVrv::DtSelectionManager::IdSet& pinOrUnpinList,
bool pinAllLabels);
virtual void setHoverSignalsActive(bool active);
virtual void setEntityInfoWidgetActive(bool active);
virtual void updatePosition(double simTime);
#ifdef SIM_IS_SHIP
// For the ship, need to pass dT so we can determine velocity
virtual void repositionShip(DtVector position, DtTaitBryan ori, double dT);
#else
virtual void repositionAircraft(DtVector position, DtTaitBryan ori);
#endif
protected:
std::string myEntityDisplayName;
DtTaitBryan myOrientation;
DtVector myPosition;
#ifdef SIM_IS_SHIP
// For the ship, need our last (local) position to determine our velocity
DtVector myLastPosition;
#endif
double myHeading;
DtVector myOrbitCenter;
double myClockAngle;
double myRadius;
double myRoll;
makVrv::vrvSignalsLib::connection myMouseEnterConnection;
makVrv::vrvSignalsLib::connection myMouseLeaveConnection;
};
Contains makVrv::DtEntityIndicatorWidget class.
Contains makVrv::DtEntityInfoWidget class.
Contains makVrv:DtSelectionManager class.
Base class to provide boost signal/slot management.
makVrv::DtEntityHATLineFacade * myEntityHATLineFacade
Definition exampleDriver/DtExampleSimEngine.h:123
DtTaitBryan myOrientation
Definition exampleDriver/DtExampleSimEngine.h:128
double myRadius
Definition exampleDriver/DtExampleSimEngine.h:143
makVrv::DtCoordinateSystem * myCoordinateSystem
Definition exampleDriver/DtExampleSimEngine.h:150
DtExampleSimEngine(makVrv::DtDe &de)
double myLastUpdateTime
Definition exampleDriver/DtExampleSimEngine.h:138
makVrv::DtEntity3dFacade * myEntityFacade
Definition exampleDriver/DtExampleSimEngine.h:120
double myLastCommLineTime
Definition exampleDriver/DtExampleSimEngine.h:137
makVrv::vrvSignalsLib::connection myMouseLeaveConnection
Definition exampleDriver/DtExampleSimEngine.h:153
double myHeading
Definition exampleDriver/DtExampleSimEngine.h:135
std::string myEntityDisplayName
Definition exampleDriver/DtExampleSimEngine.h:125
virtual void setEntityInfoWidgetActive(bool active)
Sets whether the entity info widget is displayed or not.
makVrv::DtDe & myDe
Definition exampleDriver/DtExampleSimEngine.h:118
double myRoll
Definition exampleDriver/DtExampleSimEngine.h:144
makVrv::DtEntityInfoWidget * myEntityInfoWidget
Definition exampleDriver/DtExampleSimEngine.h:122
makVrv::DtSignalConnectionManager mySignalConnections
Definition exampleSimEngine.h:143
virtual ~DtExampleSimEngine()
DTOR.
virtual void setHoverSignalsActive(bool active)
void slot_infoLabelsArePinned(const makVrv::DtSelectionManager::IdSet &pinOrUnpinList, bool pinAllLabels)
DtVector myPosition
Definition exampleDriver/DtExampleSimEngine.h:129
double myClockAngle
Definition exampleDriver/DtExampleSimEngine.h:142
virtual void updatePosition(double simTime)
Updates the current position / orientation of the entity.
virtual makVrv::DtUnicode generateInfoString() const
Generates the information string displayed in the entity info widget.
bool tick(double simTime)
bool myEntityInfoWidgetPinnedFlag
Definition exampleDriver/DtExampleSimEngine.h:126
makVrv::DtEntityIndicatorWidget * myEntityIndicator
Definition exampleDriver/DtExampleSimEngine.h:121
virtual void slot_coordinateSystemChanged()
slot for when the coordinate system changes
virtual void repositionAircraft(DtVector position, DtTaitBryan ori)
Positions the aircraft at the given position with the given orientation.
makVrv::vrvSignalsLib::connection myMouseEnterConnection
Definition exampleDriver/DtExampleSimEngine.h:152
double myAngularVelocity
Definition exampleDriver/DtExampleSimEngine.h:141
DtVector myOrbitCenter
Definition exampleDriver/DtExampleSimEngine.h:140
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition DtCoordinateSystem.h:41
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer,...
Definition DtDe.h:77
The DtEntity3dFacade is a facade around agents that make up an entity in the 3D model set.
Definition DtEntity3dFacade.h:40
Class for height above terrain line to show height above terrain line and label.
Definition DtEntityHATLineFacade.h:35
The indicator widget.
Definition DtEntityIndicatorWidget.h:30
DtEntityInfoWidget is the object proxy for 2D distributed entity info (label) objects.
Definition DtEntityInfoWidget.h:28
std::set< DtUniqueID > IdSet
Definition DtSelectionManager.h:32
Class to manage disconnection of boost connections on deletion.
Definition DtSignalConnectionManager.h:21
Definition DtUnicode.h:34
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16

exampleSimEngine.cxx

/*****************************************************************************
* Copyright (c) 2024 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#include <vrvCore/DtDe.h>
#include <matrix/LibMatrix.h>
#include <boost/bind/bind.hpp>
// Use the VR-Vantage namespace.
// All classes in VR-Vantage are in this namespace.
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();
}
{
}
{
}
{
// Create the entity
DtElementID parentElementId = 0;
#ifdef SIM_IS_SHIP
myEntityDisplayName = "Ship 1";
#else
#endif
DtElementID elementId = myDe.agentManager().createNewUniqueId();
myEntityFacade = new DtEntity3dFacade(myDe.agentManager(),
DtSharedSettingsManager::instance(myDe), elementId, true);
#ifdef SIM_IS_SHIP
// Load the model
myEntityFacade->setArticulatedModelDefinition("SurfaceWatercraftDDG151Arleigh-BurkeNavy");
// Need to 'dead reckon' position because wakes use the velocity from the dead
// reckoner
myEntityFacade->setDeadReckoningEnabled(true, false, false);
// Enable watercraft-specific elements
myEntityFacade->setWaterClamping(true);
myEntityFacade->addWake();
DtWakeModelAgent* wakeModelAgent = myEntityFacade->wake();
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.);
myEntityFacade->setWakeLODDistance(10000.0); //set the wake lod distance to 10000.0 meters
#else
// Load the model
myEntityFacade->setArticulatedModelDefinition("FixedWingRQ-1Predator");
#endif
// Let the DataBank know about this new element
DtElementChanges changes;
changes.myElementsAdded.push_back(new DtElementEntry(elementId, parentElementId, DtElementEntry::Entity));
changes.myAttributesChanged[elementId].push_back(new DtElementAttributeVisibility(true));
changes.myAttributesChanged[elementId].push_back(new DtElementAttributeElementSubtype(DtElementAttributes::Friendly));
changes.myAttributesChanged[elementId].push_back(new DtElementAttributeDriverType("Example Driver"));
// the below change makes it so the entity we're creating respects the 'Fixed Wing' display unit collection
changes.myAttributesChanged[elementId].push_back(new DtElementAttributeDisplayUnitCollectionName("Fixed Wing"));
myDe.dataBank().elementData().applyChanges(changes);
// Create the entity indicator
new DtEntityIndicatorWidget(myDe.agentManager(), myEntityFacade->modelSet(), false);
myEntityIndicator->setEventsEnabled(true);
myEntityIndicator->setColor(0, 0, 1, 1);
// Attach the entity indicator to the entity
myEntityFacade->sceneObjectAgent().addModel(myEntityIndicator->model(),
DtStateVisualizer::EntityVisualizerType);
#ifndef SIM_IS_SHIP
// Create a HAT line
myEntityHATLineFacade = new DtEntityHATLineFacade(myDe.agentManager(), myEntityFacade->modelSet(),
myEntityFacade->sceneObjectAgent().uniqueId());
// The element ID is used to look up the display unit collection element
// attribute set above
myEntityHATLineFacade->setElementID(elementId);
#endif
// Listen for a signal toggling the entity info widget's pinned state
DtSelectionManager& selectMgr(DtSelectionManager::instance(myDe));
mySignalConnections += selectMgr.signal_infoLabelsArePinned.connect(boost::bind(
&DtExampleSimEngine::slot_infoLabelsArePinned, this, boost::placeholders::_1, boost::placeholders::_2));
return true;
}
{
{
{
myEntityFacade->sceneObjectAgent().removeModel(
myEntityInfoWidget->model());
}
{
myEntityFacade->sceneObjectAgent().removeModel(
myEntityIndicator->model());
}
DtElementChanges changes;
changes.myElementsDeleted.push_back(myEntityFacade->elementId());
myDe.dataBank().elementData().applyChanges(changes);
}
return true;
}
DtSceneObject* findSceneObjectFromElement(DtDe& myDe, const DtElementID& id)
{
if (idList.size() == 0)
{
return 0;
}
DtAgentUpdateResolverInterface* updater = myDe.agentManager().findUpdater(idList.front());
if (updater)
{
return updater->castObjectTypeFromUpdater<DtSceneObject>("DtSceneObject");
}
return 0;
}
bool DtExampleSimEngine::tick(double simTime)
{
updatePosition(simTime);
{
}
return true;
}
{
// Get the event signals for the entity indicator from the widget signaler.
DtWidgetSignaler& widgetSignaler =
DtWidgetSignaler::instance(myDe.mainEventQueue());
DtWidgetEventSignals& signals = myEntityIndicator->eventSignals(
widgetSignaler);
// Connect to or disconnect from the signals.
if (active)
{
myMouseEnterConnection = signals.signal_mouseEnter.connect(boost::bind(
myMouseLeaveConnection = signals.signal_mouseLeave.connect(boost::bind(
}
else
{
myMouseEnterConnection.disconnect();
myMouseLeaveConnection.disconnect();
}
}
{
// If mouse is hovering and there's no info widget...
if (active && !myEntityInfoWidget)
{
// Create the entity info widget and set the color.
myEntityInfoWidget = new DtEntityInfoWidget(
myDe.agentManager(),
myEntityFacade->modelSet(), "entityInfo");
myEntityInfoWidget->setColor(0, 0, 1, 1);
// Set group id in the entityInfoHoverGroup.
DtOverlayGroupManager& groupManager =
DtOverlayGroupManager::instance(myDe);
myEntityInfoWidget->setGroup(groupManager.nextGroupId("hoverGroupSet"));
// Add it to the entity,
myEntityFacade->sceneObjectAgent().addModel(myEntityInfoWidget->model(),
DtStateVisualizer::EntityVisualizerType);
// And update its display text.
DtUnicode infoString = generateInfoString();
myEntityInfoWidget->setText(infoString);
}
// If mouse isn't hovering, and there is an info widget...
else if (!active && myEntityInfoWidget)
{
// Remove it from the model and destroy it.
myEntityFacade->sceneObjectAgent().removeModel(
myEntityInfoWidget->model());
}
}
{
DtReferenceEllipsoid refEllip(DtWGS84);
DtGeodeticCoord geod(&refEllip);
geod.setGeocentric(myPosition);
DtVector localp;
DtTaitBryan hpr;
myCoordinateSystem->netToLocalPos(myPosition, localp);
myCoordinateSystem->netToLocalHpr(localp, myOrientation, hpr);
const char* entityFormatString =
"Marking :%s\n" // Marking Text
"Heading :%.2f Deg\n" // Heading
"Lat|Lon :%.2fN %.fE\n" // Location
"Alt. :%.1f m above sea level";
std::string buffer;
buffer.resize(1024, '0');
{
int charsWritten = sprintf(
const_cast<char*>(buffer.c_str()), entityFormatString,
myEntityDisplayName.c_str(), // Marking Text
DtRad2Deg(myHeading), // Heading
DtRad2Deg(geod.lat()), // Location (Lat)
DtRad2Deg(geod.lon()), // Location (Lon)
myPosition[2] // Altitude
);
buffer.resize(charsWritten, '0');
}
return DtUnicode::fromUtf8(buffer);
}
{
// Compute time since last update.
double now = simTime;
double dt = now - myLastUpdateTime;
// Update clock angle. The clock angle represents the bearing
// to the aircraft from the center point of its orbit.
// Compute the offset to the aircraft using the radius and clock angle.
DtVector offset(myRadius*sin(myClockAngle), myRadius*cos(myClockAngle), 0);
// Compute heading and net orientation. Since the entity is
// orbiting in a perfect circle, the heading is always 90 degrees
// (pi/2) more than the bearing to the aircraft.
myHeading = DtModPerLo(myClockAngle + M_PI_2, 0., 2.*M_PI);
DtTaitBryan ori(myHeading, 0, myRoll);
#ifdef SIM_IS_SHIP
// Update the ship's position/orientation with the new parameters.
repositionShip(myOrbitCenter + offset, ori, dt);
#else
// Update the aircraft's position/orientation with the new parameters.
#endif
// Store as last update time.
}
#ifdef SIM_IS_SHIP
void DtExampleSimEngine::repositionShip(DtVector position, DtTaitBryan ori, double dt)
#else
void DtExampleSimEngine::repositionAircraft(DtVector position, DtTaitBryan ori)
#endif
{
// Get the coordinate converter and initialize.
DtCoordinateConverter* coordConverter;
coordConverter = myCoordinateSystem->converter();
if (coordConverter->type() == DtCoordinateConverter::Geocentric)
{
// => Use this for Geocentric - not exact but close enough
DtGeodeticCoord geod(DtDeg2Rad(10.0), DtDeg2Rad(60.0), 0.0);
coordConverter->setupTopoFrame(geod.geocentric());
}
else
{
// Or this for (UTM)
coordConverter->setupTopoFrame(position);
}
// Convert the position (from ENU) to local database (CIG) coords.
coordConverter->enuToCig_coordTrans(position, myPosition);
// Convert the orientation (from NED) to local database (CIG) ori.
myOrientation = coordConverter->nedToCig_EulerTrans(ori);
// Set the Position and Orientation on the aircraft.
myEntityFacade->setOrientation(myOrientation);
myEntityFacade->setPosition(myPosition);
#ifdef SIM_IS_SHIP
// need a velocity for wakes
DtVector vecDiff;
DtVector localVel;
DtVector velocity;
DtVecSub(position, myLastPosition, vecDiff);
DtVecScale(vecDiff, 1.0 / dt, localVel);
coordConverter->enuToCig_vecTrans(localVel, velocity);
myEntityFacade->setVelocity(DtVector64To32(velocity));
myLastPosition = position;
#endif
}
const DtSelectionManager::IdSet& sel, bool pinOrUnpinList)
{
// Iterate over selected entities...
DtSelectionManager::IdSet::const_iterator i = sel.begin();
DtSelectionManager::IdSet::const_iterator e = sel.end();
for (; i != e; ++i)
{
// If the entity facade is selected...
if ((*i) == myEntityFacade->elementId())
{
// Pin/unpin the label and stop/start listening for mouse hovers.
myEntityInfoWidgetPinnedFlag = pinOrUnpinList;
}
}
}
Contains makVrv:DtAgentManager class.
Contains makVrv::DtAgentUpdateResolver class.
Contains makVrv::DtDataBank class.
Contains makVrv::DtDe class.
Contains makVrv::DtDeSharedState class.
Contains makVrv::DtDeSharedStateSignaler class.
Contains makVrv:DtMasterScene class.
Contains makVrv::DtElementAttributes class.
Contains makVrv::DtEntity3dFacade class.
Contains the DtEntityHATLineFacade.h class declaration.
Contains makVrv::DtInputDriver class.
Contains makVrv::DtObserver class.
Contains the DtOverlayGroupManager class declaration.
Contains makVrv::DtScene class.
Contains makVrv::DtSceneObject class.
Contains makVrv::DtSharedSettingsManager class.
Contains makVrv:DtStateVisualizer class.
virtual DtAgentUpdateResolverInterface * findUpdater(DtUniqueID id)
Find the update handler for a particular object id.
Abstract base class for object updaters.
Definition DtAgentUpdateResolverInterface.h:21
ObjectType * castObjectTypeFromUpdater(const std::string &className)
Attempt to cast an object from an updater using the className. It is vital that the class name is the...
Definition DtAgentUpdateResolverInterface.h:35
DtCoordinateConverter is the base class for 'local (cig) to geocentric' converters.
Definition DtCoordinateConverter.h:26
virtual const std::string & type() const
Get converter type - this base class type is NoOp.
virtual DtTaitBryan nedToCig_EulerTrans(const DtTaitBryan &topo) const
provide cig euler angles from topo euler
static const char * Geocentric
Does no conversion.
Definition DtCoordinateConverter.h:30
virtual void setupTopoFrame(const DtVector &truth)
virtual void enuToCig_vecTrans(const DtVector &enuVec, DtVector &cigVec) const
convert to Cig vector from Enu vector
virtual void enuToCig_coordTrans(const DtVector &enuPos, DtVector &cigPos) const
convert to Cig coordinates from Enu coordinates
const std::string & type() const
bool set(const std::string &type, const std::string &origin)
const std::string & parameters() const
The coordinate system parameters.
DtElementData & elementData()
Get element data. DtElementData contains data that is common to all VR-Vantage elements,...
DtAgentManager & agentManager()
Get the scene manager.
virtual DtDataBank & dataBank()
The DtDataBank accessor.
virtual DtDeSharedState & sharedState()
Returns the DtDeSharedState object.
const DtCoordinateSystem & coordinateSystem() const
Get the coordinate system.
static DtDeSharedStateSignaler & instance(DtDe &de)
Get an instance used to emit, or to connect.
ElementAttributeMap myAttributesChanged
Definition DtElementChanges.h:55
UniqueIdList myElementsDeleted
Definition DtElementChanges.h:54
ElementPointerList myElementsAdded
Definition DtElementChanges.h:53
virtual void getSceneObjectIds(const DtElementID &elementID, SceneObjectIdList &outputList, DtModelSetId modelSet=DtModelSetId::Unspecified) const
Get the scene object ID from the specified modelset that is associated with an element ID (or all sce...
std::vector< DtUniqueID > SceneObjectIdList
Public Type Definitions.
Definition DtElementData.h:38
virtual unsigned int nextGroupId(const std::string &groupSetName)
Returns the next available group id for the given set. Obtains the group id generator for the set wit...
A DtSceneObject represents an object that can be positioned in the scene by (possibly) attaching it t...
Definition DtSceneObject.h:45
virtual void setHullSprayStart(double offset)=0
virtual void setPropWashOffset(double offset)=0
virtual void setShipLength(double shipLength)=0
virtual void setPropWashFadeTime(double fadeTime)=0
virtual void setSternWaveOffset(double offset)=0
virtual void setBowSize(double size)=0
virtual void setSpraySizeScale(double scale)=0
virtual void setBowWaveScale(double scale)=0
virtual void setHullSprayVerticalOffset(double offset)=0
virtual void setHullSprayEnd(double offset)=0
virtual void setHullSpraySizeScale(double scale)=0
virtual void setBowSprayOffset(double offset)=0
virtual void setBowWaveOffset(double offset)=0
virtual void setBeamWidth(double beamWidth)=0
virtual void setSprayVelocityScale(double scale)=0
virtual void setSprayEnabled(bool enabled)=0
virtual void setMaxBowWaveAmplitude(double amplitude)=0
virtual void setWakeOffset(double offset)=0
virtual void setPropWashEnabled(bool b)=0
virtual void setNumHullSprays(int numSprays)=0
virtual void setHullSprayVelocityScale(double scale)=0
virtual void setDraft(double draft)=0
boost::signalslib::signal< void()> signal_mouseLeave
Emitted when the mouse leaves the widget.
Definition DtWidgetSignaler.h:41
boost::signalslib::signal< void(int x, int y)> signal_mouseEnter
Emitted when the mouse entered the widget.
Definition DtWidgetSignaler.h:35
DtUniqueElementAttribute< std::string, DtElementAttributes::DisplayName > DtElementAttributeDisplayName
Definition DtElementAttributes.h:88
@ Models3D
Definition DtModelSetEnums.h:23
DtUniqueElementAttribute< std::string, DtElementAttributes::DisplayUnitCollectionName > DtElementAttributeDisplayUnitCollectionName
Definition DtElementAttributes.h:127
DtUniqueID DtElementID
Definition DtUniqueID.h:23
DtUniqueElementAttribute< unsigned int, DtElementAttributes::ElementSubtype > DtElementAttributeElementSubtype
Definition DtElementAttributes.h:121
DtUniqueElementAttribute< bool, DtElementAttributes::ObjectVisibility > DtElementAttributeVisibility
Definition DtElementAttributes.h:97
DtUniqueElementAttribute< std::string, DtElementAttributes::DriverType > DtElementAttributeDriverType
Definition DtElementAttributes.h:118
DT_DLL_VRVDRAWCONTROL void DtVecScale(const DtVdcVector2D &v, double scale_factor, DtVdcVector2D &result)

exampleDriverPlugin.h

/*****************************************************************************
* Copyright (c) 2019 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#pragma once
#ifdef _WIN32
#ifdef EXAMPLEDRIVERPLUGIN_EXPORTS
#define DT_DLL_EXAMPLEDRIVERPLUGIN __declspec ( dllexport )
#else
#define DT_DLL_EXAMPLEDRIVERPLUGIN __declspec ( dllimport )
#endif
#else
#define DT_DLL_EXAMPLEDRIVERPLUGIN
#endif
// Setup proper plugin export symbol
#define DT_DE_PLUGIN_EXPORT_MACRO DT_DLL_EXAMPLEDRIVERPLUGIN
// Declare & export the plugin initialization function (bool initDeModule(DtDe* de))

exampleDriverPlugin.cxx

/*****************************************************************************
* Copyright (c) 2024 MAK Technologies, Inc.
* All rights reserved.
*****************************************************************************/
#include <vrvCore/DtDe.h>
#include "exampleDriver.h"
// Use the VR-Vantage namespace. All classes in VR-Vantage are in this namespace.
using namespace makVrv;
static vrvSignalsLib::connection postInitializeConnection;
{
// Create DtExampleDriver.
// The driver is now owned by the display engine. Do not delete it.
de.driverManager().addDriver(driver);
// Start the driver, creating the agent.
de.driverManager().startDriver(driver);
}
void init(DtDe& de)
{
// Ensure that init only gets called once
// (not strictly necessary here, but this is good practice in general)
// We only want to create the driver if we are running in master mode.
if (de.isInMasterMode())
{
// The accessory must be created after the DE's initialization is
// finished, to make sure all the objects it uses exist.
postInitializeConnection = de.signal_postInitialize.connect(boost::bind(
&installDriver, std::ref(de) ));
}
}
{
// Setup the plug-in. Normally, the init function and functionality
// should be in its own library.
init(*de);
return true;
}
#define DT_DE_INIT_ONCE(de)
This macro is called by modules in their init() function. This macro ensures that the module is only ...
Definition DtDe.h:30
virtual bool isInMasterMode() const
Returns true if the DtDe is in master mode.
virtual DtDriverManager & driverManager()
The DtMasterScene accessor. The function will throw before the initialize function is called.
boost::signalslib::signal< void()> signal_postInitialize
Definition DtDe.h:535
void addDriver(DtDriver *driver)
Add a host driver to the master scene. The host is now owned by the Master Scene.
void startDriver(DtDriver *driver)
Start a driver driver modifying the scene.
DT_DLL_EXAMPLEACCESSORY void init(makVrv::DtDe &de)
Contains the DtExampleDriver class declaration.
DT_DE_PLUGIN_EXPORT_MACRO bool initDeModule(makVrv::DtDe *de)