Overview
This example show how to extend the state model visualizer and turn all the entities in XR mode to red.
Expected Result
Extend Visualizer Result
Example details
In this example we derived from the class DtVrlinkEntityArticulatedStateModelVisualizer to create a new class MyVrlinkEntityArticulatedStateModelVisualizer. The only thing this class does in the constructor is to force the entity's id for colorization. This will just to prove it is overriding the original visualizer. To see the effect switch to XR mode to see all the entities in red.
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/exampleExtendVisualizer<protocol>_stealth.bat (on Windows) or ./bin64/exampleExtendVisualizer<protocol>_stealth.sh (on Linux). Load MakLand terrain, once Vantage is started, connect with the selected <protocol>. Swicth the observer to "XR" and all the entities will be red. For more information about running examples, please see Running Applications and Examples.
Example Source Files
exampleExtendVisualizerPlugin.cxx
#include <iostream>
using namespace makVrv;
namespace exampleExtendVisualizer
{
{
{
std::cout << "Loading extend visualizer plugin" << std::endl;
{
}
}
}
}
{
return true;
}
exampleExtendVisualizerPlugin.h
#pragma once
#define DT_DE_PLUGIN_EXPORT_MACRO DT_DLL_EXAMPLEEXTENDVISUALIZER
namespace makVrv { class DtDe; }
MyVrlinkEntityArticulatedStateModelVisualizer.h
#pragma once
namespace makVrv
{
{
public DtVrlinkEntityArticulatedStateModelVisualizer
{
public:
MyVrlinkEntityArticulatedStateModelVisualizer(DtBaseConnection& simulation,
DtStateListener& listener, int modelSet);
virtual ~MyVrlinkEntityArticulatedStateModelVisualizer();
protected:
};
typedef DtStateVisualizerCreatorTemplate<MyVrlinkEntityArticulatedStateModelVisualizer>
}
}
#define MyVrlinkEntityArticulatedStateModelVisualizer_INL_
#undef MyVrlinkEntityArticulatedStateModelVisualizer_INL_
MyVrlinkEntityArticulatedStateModelVisualizer.inl
#ifndef MyVrlinkEntityArticulatedStateModelVisualizer_INL_
#error This file may only be included by MyVrlinkEntityArticulatedStateModelVisualizer.h
#endif
namespace makVrv
{
{
DtBaseConnection& simulation, DtStateListener& listener, int modelSet)
: DtVrlinkEntityArticulatedStateModelVisualizer(simulation, listener, modelSet)
{
std::cout << "MyVrlinkEntityArticulatedStateModelVisualizer created" << std::endl;
setForceId( 2 );
}
MyVrlinkEntityArticulatedStateModelVisualizer::~MyVrlinkEntityArticulatedStateModelVisualizer()
{
}
}
}
protocolSpecificNamespace.h
#pragma once
#ifdef _WIN32
#define DL_DLL_IGCONVRLINK __declspec ( dllimport )
#else
#define DL_DLL_IGCONVRLINK
#endif
#ifdef DtDIS
# define DT_PROTOCOL_NAMESPACE vrvDis
#else
# ifdef DtHLA_1516
# ifdef DtHLA_1516_EVOLVED
# define DT_PROTOCOL_NAMESPACE vrvHla1516e
# else
# define DT_PROTOCOL_NAMESPACE vrvHla1516
# endif
# else
# define DT_PROTOCOL_NAMESPACE vrvHla13
# endif
#endif
namespace exampleExtendVisualizer
{
{
}
}
[<< Examples] [Home] [Top of Page]