VR-Link API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Environmental Process Example

Table of Contents

Some sample code to demonstrait the usage of Environmental Process Objects in VR-Link.

Environmental Process objects represent things happening in the simulated environment like chemical clouds, chaff, or vapor trails.

Implementation of Environmental Process Objects

Environmental Process Objects are implemented in four main classes

Example Code

Environmental Process Publisher

A function which creates and publishes an Environmental Process Object.

#include "PointRec.h"
#include "Point2Rec.h"
#include <iostream>
void publishEnvPro(DtExerciseConn *exConn)
{
// Create publishers
// Hold on to its state repository, where we can set data
DtEnvironmentProcessRepository &esr = *pub.epsr();
// Fill in unrealistic sample data
DtEntityIdentifier entId("1:3:1");
envType.setClassOfEnv(1);
envType.setKind(2);
envType.setDomain(3);
envType.setCategory(4);
envType.setSubCategory(5);
envType.setSpecific(6);
envType.setExtra(7);
esr.setEnvironmentType(envType);
int size = (sizeof(Point1GeometryData) - sizeof(DtNetEnvironmentalRecord))*8;
if (esr.setRecordBitSize(0, size) && esr.setRecordBitSize(1, size) &&
esr.setRecordBitSize(2, size))
{
std::cout<< "Setting size was successful" << std::endl;
}
else
{
std::cout<< "Setting size was unsucessfull" << std::endl;
}
for ( int i = 0; i < esr.numberOfEnvironmentalRecords(); i++)
{
rec->myIndex = i;
rec->pos[0] = i*10 + 10;
rec->pos[1] = i*10 + 10;
rec->pos[2] = i*10 + 10;
}
}

Environmental Process Listener

Sample code to listen for Environmental Process objects.

#include <vl/fom.h>
// A callback for when a DtReflectedEnvironmentProcess object is updated.
void printEnvProc(DtReflectedEnvironmentProcess* obj, void* userData)
{
obj->epsr()->printData();
}
// A callback for when a new DtReflectedEnvironmentProcess object is added.
void envProcAddedCb(DtReflectedEnvironmentProcess* obj, void* userData)
{
// register a callback for when an existing object is updated.
obj->addPostUpdateCallback(printEnvProc, userData);
}
// Create a reflected list and register interest in object creation.
void listenEnvProc(DtExerciseConn *exConn)
{
rel.addEnvironmentProcessAdditionCallback(envProcAddedCb, NULL);
}

Document ID: Generated on Thu Oct 16 00:12:25 EDT 2025 from SVN revision 280738
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)