VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages

Header File:

Implementation

/*******************************************************************************
** Copyright (c) 2022 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
// This local exception insures that only the code in this class will ever catch
// this exception. It's thrown as soon as FindOneFeature finds something.
struct ExitSearchException{};
// Used as the functor passed into DtAreaFeatureSet::forEachFeature to
// see if there's at least one hit. When one is found ExitSearchException is
// thrown to prevent any unnecessary searching.
struct FindOneFeature
{
FindOneFeature() { }
void operator()(const MAKVRinTerra::DtAreaFeature& feature)
{
throw ExitSearchException();
}
};
// default constructor
const DtSignaturePropagatorDescriptor* desc, DtPhysicalWorld* physicalWorld)
: DtVisualSignaturePropagator(desc, physicalWorld)
{
}
// destructor
{
}
{
}
double absoluteSignature, const DtSignaturePropagatorArgs& args, bool* dataAvailable) const
{
//Get the apparent signature from the parent class. This will include
//terrain blockage tests, weather visibility effects, and tactical smoke
//blockage.
absoluteSignature, args, dataAvailable);
//This is an optimization. The minSignatureThreshold() value is set by the
//sensor calling this propagator, and indicates the smallest returned value
//that it will care about. Any value smaller than this is the same as 0
//to the caller.
//So, if the apparentSig is already less than this value, the additional checks
//can be skipped, as long as those checks can only reduce the value further.
if (apparentSig < args.minSignatureThreshold())
{
return 0;
}
using namespace MAKVRinTerra;
//Get the area feature set that matches the query "FOREST".
//See appData/settings/featureconfig.txt for the named feature types
//and their definitions.
std::auto_ptr<MAKVRinTerra::DtAreaFeatureSet> losFeatures =
if (!losFeatures.get())
{
losFeatures.reset(new DtAreaFeatureSet::Empty());
}
//Feature queries use DtFeatureGeometry objects for determining
//geometric intersections.
//Create a point feature geometry using the target's position and
//the local proj object.
DtVector targetPosition = args.targetObject()->localPosition();
DtFeatureGeometry targetPoint =
DtFeatureGeometry::Point::Make(targetPosition, *localProj);
//Construct a feature query for all areal features that intersect target point
//The area feature set that matches FOREST can contain areal,
//point, or linear features, so our query specifies areal features.
DtQuery areaTypeQuery = DtHasGeometry::Create(DtFeatureGeometry::AreaType);
//Filter the feature set using our query. Pass the LOAD flag so
//this filtering will cause features to be loaded in the background.
//This loading will continue regardless of what happens to the local
//objects "losFeatures" and "areas", meaning subsequent calls will
//have the features already loaded.
std::auto_ptr<DtAreaFeatureSet> obstacles(
losFeatures->filter(areaTypeQuery, targetPoint, LOAD));
// See if there's at least one feature in the set. See the definitions of
// FindOneFeature and ExitSearchException above.
if (obstacles.get())
{
try
{
FindOneFeature finder;
obstacles->forEachFeature(boost::ref(finder));
}
catch (ExitSearchException)
{
DtInfo << "Target " << args.targetObject()->objectName()
<< " is in an area. Cutting apparent signature in half." << std::endl;
return apparentSig / 2.0;
}
}
return apparentSig;
}
//This is the static creator method that is registered with the factory.
{
DtSignaturePropagator* prop = new MySignaturePropagator(desc, physicalWorld);
prop->init();
return prop;
}

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)