Jump to content

DIS Entity Marking ?


photo

Recommended Posts

Should have been more specific: I'm looking for API function or code sample to access the DIS entity marking, for both 2.13 and 2.15.1 (in case the api changed).

I couldn't find it in the doc.

Thanks!

Link to comment

OK, so first I'd suggest to add Marking support in a future version.

Second, I need to access it for a current project, so, how can I intercept the Entity PDU and then match it to an existing IG entity* ?

For future reference, here is the code I used:

Map<int, String> entitiesMarking;
int SystemLogic::init()
{
	// Note: this code is here because Unigine does not give acces to Entity Marking
	// To be removed when Unigine API is updated...
	if (auto dis = IG::DIS::Connector::get())
		dis->setCallbackOnRecvPacket( // 2.13; for 2.15 use addReceivePacketCallback
            KDIS::DATA_TYPE::ENUMS::Entity_State_PDU_Type,
            MakeCallback(this, &SystemLogic::on_receive_Entity_State_PDU)
        );

	return 1;
}
void SystemLogic::on_receive_Entity_State_PDU(KDIS::PDU::Header* packet)
{
	KDIS::PDU::Entity_State_PDU* es = static_cast<KDIS::PDU::Entity_State_PDU*>(packet);
	entitiesMarking[es->GetEntityIdentifier().GetEntityID()] = es->GetEntityMarking().GetEntityMarkingString().c_str();
}

Only problem now is you deliver a kdis.dll but not the kdis.lib! (so I have to recompile KDIS in my project, which is a risk in case the lib is not exactly the same as you used for the dll generation, for example if you have patched it).

Thanks!

Edited by Amerio.Stephane
Link to comment
×
×
  • Create New...