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 DtEntityArticulatedStateModelVisualizer to create a new class MyEntityArticulatedStateModelVisualizer. 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_stealth.bat (on Windows) or ./bin64/exampleExtendVisualizer_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
{
void postInitializeWork(
DtDe* de)
{
}
{
{
}
}
}
{
return true;
}
exampleExtendVisualizerPlugin.h
#pragma once
#define DT_DE_PLUGIN_EXPORT_MACRO DT_DLL_EXAMPLEEXTENDVISUALIZER
namespace makVrv { class DtDe; }
MyEntityArticulatedStateModelVisualizer.h
#pragma once
namespace makVrv
{
public DtEntityArticulatedStateModelVisualizer
{
public:
MyEntityArticulatedStateModelVisualizer(DtBaseConnection& simulation,
DtStateListener& listener, int modelSet);
virtual ~MyEntityArticulatedStateModelVisualizer();
protected:
};
typedef DtStateVisualizerCreatorTemplate<MyEntityArticulatedStateModelVisualizer>
}
MyEntityArticulatedStateModelVisualizer.cxx
namespace makVrv
{
DtBaseConnection& simulation, DtStateListener& listener, int modelSet)
: DtEntityArticulatedStateModelVisualizer(simulation, listener, modelSet)
{
std::cout << "MyEntityArticulatedStateModelVisualizer created" << std::endl;
DtEntityArticulatedStateModelVisualizer::setColorizedColor( 1.0, 0.0, 0.0, 1.0 );
}
MyEntityArticulatedStateModelVisualizer::~MyEntityArticulatedStateModelVisualizer()
{
}
}
[<< Examples] [Home] [Top of Page]