Overview
This DtDistributedDraw driver owns a DtExampleDrawObject, and is responsible for keeping track of the draw object's state and creating or destroying it when the driver is started or stopped.
Expected Result
Distributed Draw Result
Example details
DtExampleDrawObject is the implementation of the distributed draw object. When a DtExampleDrawObjectAgent is created on the master, an exampleDrawObject is created locally on each display engine.
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/exampleDistributedDraw_stealth.bat and ./bin64/exampleDistributedDraw_slave.bat (on Windows) or ./bin64/exampleDistributedDraw_stealth.sh and ./bin64/exampleDistributedDraw_slave.sh (on Linux). In Vantage, load Ground_DB II terrain than from the "Observer Views" panel click on "import and append views" and select "exampleDrawObjectsGroundDbView.osrx" then click on "remoteGraphicsView". If you also started "exampleDistributedDraw_slave", connect the remote display engine by first enabling from the menu "view->Display Engine Configuration Editor Panel". In the "Display Engine Configuration Editor Panel" click on "Connect To Display Engine", set the host name (leave it to localhost if you are running both on the same PC), click connect. Press the "F" key to create a sphere and see it display on both window.
For more information about running examples, please see Running Applications and Examples.
Example Source Files
DtExampleShaderManager.cxx
#ifndef DtDistributedDrawDriver_H_
#define DtDistributedDrawDriver_H_
{
public:
virtual const std::string&
className()
const;
protected:
};
#endif
Contains makVrv:DtAgentManager class.
Contains makVrv:DtDriver class.
Definition DtDistributedDrawDriver.h:21
virtual void updateSphere()
Utility function add a sphere at location x,y,z in the scene.
virtual bool onTick()
Stub implementation since this driver doesn't have anything that needs updating.
DtDistributedDrawDriver(DtAgentManager &agentManager, const std::string &instanceName)
CTOR.
DtExampleDrawObjectAgent * myDrawAgent
The draw agent that draws the sphere.
Definition DtDistributedDrawDriver.h:62
virtual bool onStop()
Called when the driver is stopped by the display engine.
bool mySphereInScene
Whether or not a sphere is displayed.
Definition DtDistributedDrawDriver.h:68
virtual void slot_displayEngineAdded(const DtDeRecord &igRecord)
Called when a display engine is connected; restarts the driver.
virtual void drawRandomSphere()
double mySphereZ
Definition DtDistributedDrawDriver.h:65
double mySphereY
Definition DtDistributedDrawDriver.h:65
double mySphereX
Saved location of the sphere.
Definition DtDistributedDrawDriver.h:65
virtual ~DtDistributedDrawDriver()
Virtual DTOR.
virtual const std::string & className() const
Get the class name as a string.
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
virtual const std::string & instanceName() const
Get this driver's instance name.
DtAgentManager & agentManager()
Get the master scene for this host. Do not create drivers using this agentManager,...
Agent class for the scene object class: DtExampleDrawObject.
Definition DtExampleDrawObjectAgent.hpp:23
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
DtExampleShaderManager.h
#ifndef DtExampleDrawObject_H_
#define DtExampleDrawObject_H_
#include <osg/Node>
#include <string>
{
{
public:
void drawSphere(
double x,
double y,
double z,
double r);
protected:
osg::ref_ptr<osg::Node>
myNode;
};
}
#endif
Contains makVrv::DtDe class.
Contains makVrv::DtUniqueID type.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer,...
Definition DtDe.h:77
Definition DtExampleDrawObject.h:24
void drawSphere(double x, double y, double z, double r)
Draw a sphere centered at x,y,z with radius r.
osg::ref_ptr< osg::Node > myNode
Definition DtExampleDrawObject.h:45
void removeChildFromAllRoots()
Removes the child from all model set roots.
DtExampleDrawObject(DtDe &de, DtUniqueID id)
The Constructor for a distributed object must take a DtDe and a Unique Id.
DtDe & myDe
Definition DtExampleDrawObject.h:42
virtual ~DtExampleDrawObject()
DTOR.
exampleCustomShaders.cxx
exampleCustomShaders.h
#include <boost/bind/bind.hpp>
static vrvSignalsLib::connection postInitializeConnection;
{
{
}
}
{
return true;
}
{
postInitializeConnection.disconnect();
if ( obsFrame )
{
}
}
#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
Contains DtDistributedDrawDriver class.
Contains makVrv:DtMasterScene class.
Contains makVrv::DtKeyMap and related classes.
Contains makVrv::DtKeyMapManager class.
DtAgentManager & agentManager()
Get the scene manager.
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.
DtInputDriver & inputDriver()
Return the DtInputDriver associated with the master scene.
a Key Map contains a map of keys to FunctionMapEntrys, as well as a list of functions to execute when...
Definition DtKeyMap.h:313
The manager for owning key maps.
Definition DtKeyMapManager.h:32
@ Rendering
Definition DtKeyMapManager.h:43
static DtKeyMapManager & instance(DtDe &de)
Get an instance of the key map.
virtual void addKeyFunction(const std::string &functionName, const KeyFunction &function, FunctionCategory functionCategory, bool categorize=true)
bind a function to string name that can be used in a key map (or binary function set)
virtual DtKeyMap * findKeyMap(const std::string &mapName)
look up a key map
@ KEY_F
Definition DtKeyState.h:61
DT_DLL_EXAMPLEACCESSORY void init(makVrv::DtDe &de)
void loadDriver(DtDe *de)
DT_DE_PLUGIN_EXPORT_MACRO bool initDeModule(makVrv::DtDe *de)
DtExampleDrawObject.cxx
#include <osg/Group>
#include <osg/Node>
#include <osg/Geode>
#include <osg/ShapeDrawable>
#include <osg/Material>
{
: myDe(de)
, myNode()
{
}
{
if (myNode.valid())
{
removeChildFromAllRoots();
}
}
{
DtModelSetRealizationManager::ModelSetRealizations::const_iterator iter = manager.
modelSetRealizations().begin();
DtModelSetRealizationManager::ModelSetRealizations::const_iterator end = manager.
modelSetRealizations().end();
while (iter != end)
{
if (iter->second)
{
((
DtOsgRenderer&)myDe.renderer()).removeNodeFromRoot( myNode.get(),
}
++iter;
}
myNode = 0;
}
{
if (myNode.valid())
{
removeChildFromAllRoots();
myNode = 0;
}
osg::Geode* geode = new osg::Geode;
geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(x,y,z), r)));
myNode = geode;
osg::Material* mat = new osg::Material();
mat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(0.25f, 0.40f, 0.55f, 1.0f));
mat->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(0.5f, 0.8f, 0.35f, 1.0f));
geode->getOrCreateStateSet()->setAttributeAndModes(mat);
DtModelSetRealizationManager::ModelSetRealizations::const_iterator iter = manager.
modelSetRealizations().begin();
DtModelSetRealizationManager::ModelSetRealizations::const_iterator end = manager.
modelSetRealizations().end();
while (iter != end)
{
if (iter->second)
{
}
++iter;
}
}
}
Contains makVrv::DtChannelSpecificGroup class.
Contains makVrv::DtDeSharedState class.
Contains makVrv::DtModelSetRealizationManager class.
Contains makVrv::DtOsgRenderer class.
DtModelSetRealizationManager is responsible for tracking which model sets are currently realized....
Definition DtModelSetRealizationManager.h:38
const ModelSetRealizations & modelSetRealizations() const
get the realizations map
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition DtOsgRenderer.h:93
static DtSceneRoot visualizerTypeRoot(DtModelSetId modelSet, int visualizerType)
Definition DtOsgRenderer.h:404
DtDistributedDrawDriver.cxx
#include <stdlib.h>
, myDrawAgent(0)
, mySphereInScene(false)
, mySphereX(0.0)
, mySphereY(0.0)
, mySphereZ(0.0)
{
setAutoStart(true);
myUserControllableFlag = false;
}
{
}
{
static std::string name("DtDistributedDrawDriver");
return name;
}
{
{
}
return true;
}
{
{
}
return true;
}
{
return true;
}
{
if (DtDriver::myStartedFlag)
{
}
}
{
}
{
}
DtAgentManager & myAgentManager
Definition DtDriver.h:190
void start()
Start the driver. Called by the Master Scene. Calls installAccessories().
void stop()
Stop the driver. Called by the Master Scene. Calls uninstallAccessories().
static DtExampleDrawObjectAgent * create(makVrv::DtAgentManagerInterface &sceneInterface, bool bDistribute=true)
Static helper creator.