![]() |
VR-Forces Developer's Guide
|
The Add Sensor Propagator example demonstrates the following:
A sensor propagator is responsible for taking in a group of parameters stored in a DtSignaturePropagatorArgs class along with the absolute signature of the object being detected. It returns an apparent signature which represents how well the sensor detected the object. Hence the base class is called DtSignaturePropagator.
This propagator adds an additional check on signature. It takes the apparent signature calculated by the parent class, DtSignaturePropagator, and checks if the target is inside a forest areal feature. If so then the apparent signature is further reduced by half.
Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces application
In the launcher, set the addSensorPropagator plugin to be loaded.
To view the new behavior:
The entity named "inside" is within a forest areal feature and all the other entities are outside, so the only message printed to the back-end console should be the following:
Target inside is in an area. Cutting apparent signature in half.
| MySignaturePropagator | The new Signature Propagator derived from DtVisualSignaturePropagator |
/*******************************************************************************
** Copyright (c) 2011 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
/*******************************************************************************
** $RCSfile: plugin.cxx,v $ $Revision: 1.1 $ $State: Exp $
*******************************************************************************/
#include "vrfcgf/vrfPluginExtension.h"
#include "mySignaturePropagator.h"
#include "vrfobjcore/signaturePropagatorTypes.h"
#include "vrfcgf/cgf.h"
#include "vrfcgf/factoryManager.h"
#include "vrfobjcore/signaturePropagatorFactory.h"
extern "C" {
DT_VRF_DLL_PLUGIN void DtPluginInformation(DtVrfPluginInformation& info)
{
info.pluginName = "addSensorPropagator";
info.pluginVersion = "1.00";
info.pluginDescription = "An example of how to add a new sensor propagation model.";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "10 Fawcett Street, Suite 204, Cambridge, MA 02138 USA";
info.pluginContactPhone = "(617) 876 8085";
}
DT_VRF_DLL_PLUGIN bool DtInitializeVrfPlugin(DtCgf* cgf)
{
//Register new propagator.
//Here, we are using the same type string as the default visual signature propagator
//so that no configuration files need to be changed. This will replace all sensors
//using the visual propagator with this new propagator.
//If a different string was used, this would be configured in the physicalWorldParams.mtl file.
cgf->factoryManager()->signaturePropagatorFactory()->addCreatorFcn(DtVisualSignaturePropagatorType,MySignaturePropagator::create);
return true;
}
}