本文整理汇总了C++中IEntityPhysicalProxy::SerializeTyped方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntityPhysicalProxy::SerializeTyped方法的具体用法?C++ IEntityPhysicalProxy::SerializeTyped怎么用?C++ IEntityPhysicalProxy::SerializeTyped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityPhysicalProxy
的用法示例。
在下文中一共展示了IEntityPhysicalProxy::SerializeTyped方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NetSerialize
//------------------------------------------------------------------------
bool CProjectile::NetSerialize(TSerialize ser, EEntityAspects aspect, uint8 profile, int pflags)
{
if(aspect == eEA_Physics)
{
pe_type type = PE_NONE;
switch(profile)
{
case ePT_Rigid:
type = PE_RIGID;
break;
case ePT_Particle:
type = PE_PARTICLE;
break;
case ePT_None:
return true;
case ePT_Static:
{
Vec3 pos = GetEntity()->GetWorldPos();
Quat ori = GetEntity()->GetWorldRotation();
ser.Value("pos", pos, 'wrld');
ser.Value("ori", ori, 'ori1');
if(ser.IsReading())
GetEntity()->SetWorldTM(Matrix34::Create(Vec3(1,1,1), ori, pos));
}
return true;
default:
return false;
}
IEntityPhysicalProxy *pEPP = (IEntityPhysicalProxy *) GetEntity()->GetProxy(ENTITY_PROXY_PHYSICS);
if(ser.IsWriting())
{
if(!pEPP || !pEPP->GetPhysicalEntity() || pEPP->GetPhysicalEntity()->GetType() != type)
{
gEnv->pPhysicalWorld->SerializeGarbageTypedSnapshot(ser, type, 0);
return true;
}
}
else if(!pEPP)
{
return false;
}
pEPP->SerializeTyped(ser, type, pflags);
}
return true;
}
示例2: NetSerialize
//-----------------------------------------------------------------------------
bool CNetworkedPhysicsEntity::NetSerialize( TSerialize ser, EEntityAspects aspect, uint8 profile, int flags )
{
NET_PROFILE_SCOPE("NetworkedPhysicsEntity", ser.IsReading());
if (aspect == eEA_Physics)
{
pe_type type = PE_NONE;
switch (profile)
{
case ePhys_PhysicalizedRigid:
{
type = PE_RIGID;
break;
}
case ePhys_PhysicalizedStatic:
{
type = PE_STATIC;
// Serialise the position ourselves - physics system won't do it for static entities
const Matrix34 &worldTM = GetEntity()->GetWorldTM();
Vec3 worldPos = worldTM.GetTranslation();
ser.Value("worldPos", worldPos, 'wrld');
if (ser.IsReading())
{
Matrix34 newTM = worldTM;
newTM.SetTranslation(worldPos);
GetEntity()->SetWorldTM(newTM);
}
break;
}
}
if (type == PE_NONE)
return true;
IEntityPhysicalProxy * pEPP = (IEntityPhysicalProxy *) GetEntity()->GetProxy(ENTITY_PROXY_PHYSICS);
if (ser.IsWriting())
{
if (!pEPP || !pEPP->GetPhysicalEntity() || pEPP->GetPhysicalEntity()->GetType() != type)
{
gEnv->pPhysicalWorld->SerializeGarbageTypedSnapshot( ser, type, 0 );
return true;
}
}
else if (!pEPP)
{
return false;
}
pEPP->SerializeTyped( ser, type, flags );
}
return true;
}