本文整理汇总了C++中NetIO::getTimeline方法的典型用法代码示例。如果您正苦于以下问题:C++ NetIO::getTimeline方法的具体用法?C++ NetIO::getTimeline怎么用?C++ NetIO::getTimeline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetIO
的用法示例。
在下文中一共展示了NetIO::getTimeline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: entityStateManager
//------------------------------------------------------------------------------
// entityStateManager() -- (Output support)
// -- Update the entity object for this NIB(Player)
//------------------------------------------------------------------------------
bool Nib::entityStateManager(const LCreal curExecTime)
{
bool ok = false;
// Get the player pointer
const Simulation::Player* player = getPlayer();
if (player == nullptr) return ok;
// Dummy weapon?
const Simulation::Weapon* ww = dynamic_cast<const Simulation::Weapon*>( player );
if (ww != nullptr) {
if (ww->isDummy()) return ok;
}
if (isPlayerStateUpdateRequired(curExecTime)) {
//
// Send an entity state PDU
// 1) create buffer
// 2) set state information
// 3) send data
//
// Get our NetIO and the main simulation
NetIO* disIO = static_cast<NetIO*>(getNetIO());
Simulation::Simulation* sim = disIO->getSimulation();
// Capture the player data, reset the dead reckoning and
// mark the current time.
playerState2Nib();
// ---
// Create buffer and cast it as an entity state PDU
// ---
char pduBuffer[NetIO::MAX_PDU_SIZE];
EntityStatePDU* pdu = (EntityStatePDU*) &pduBuffer[0];
//
// Entity state PDU structure
// =========================================================
// PDUHeader header;
// EntityIdentifierDIS entityID;
// uint8_t forceID;
// uint8_t numberOfArticulationParameters;
// EntityType entityType;
// EntityType alternativeType;
// VectorDIS entityLinearVelocity;
// WorldCoordinates entityLocation;
// EulerAngles entityOrientation;
// uint32_t appearance;
// uint8_t deadReckoningAlgorithm;
// uint8_t otherParameters[15];
// VectorDIS DRentityLinearAcceleration;
// AngularVelocityVectorDIS DRentityAngularVelocity;
// EntityMarking entityMarking;
// uint32_t capabilities;
// =========================================================
//
// ---
// Standard header (PDUHeader)
// ---
pdu->header.protocolVersion = disIO->getVersion();
pdu->header.exerciseIdentifier = disIO->getExerciseID();
pdu->header.PDUType = NetIO::PDU_ENTITY_STATE;
pdu->header.protocolFamily = NetIO::PDU_FAMILY_ENTITY_INFO;
//
if (disIO->getTimeline() == Simulation::NetIO::UTC)
pdu->header.timeStamp = disIO->makeTimeStamp( getTimeUtc(), true );
else
pdu->header.timeStamp = disIO->makeTimeStamp( getTimeExec(), false );
//
pdu->header.status = 0;
pdu->header.padding = 0;
// ---
// Entity ID (EntityIdentifierID)
// ---
pdu->entityID.simulationID.siteIdentification = getSiteID();
pdu->entityID.simulationID.applicationIdentification = getApplicationID();
pdu->entityID.ID = getPlayerID();
// ---
// Force ID: When mapping Player side to force IDs ...
// ---
if (getSide() == Simulation::Player::BLUE) {
// blue's are friendly, ...
pdu->forceID = NetIO::FRIENDLY_FORCE;
}
else if (getSide() == Simulation::Player::RED) {
// red's are not, ...
pdu->forceID = NetIO::OPPOSING_FORCE;
}
else if (getSide() == Simulation::Player::WHITE) {
// white is neutral, ...
pdu->forceID = NetIO::NEUTRAL_FORCE;
//.........这里部分代码省略.........