//*********************************************************************************************** void CParticleWorkspace::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.xmlPush("PARTICLE_WORKSPACE"); f.serialVersion(0); f.xmlSerial(_Name, "NAME"); f.xmlPush("PS_LIST"); uint32 numNodes = (uint32)_Nodes.size(); // TODO : avoid to store the number of nodes f.xmlSerial(numNodes, "NUM_NODES"); if (f.isReading()) { for(uint k = 0; k < numNodes; ++k) { _Nodes.push_back(new CNode()); _Nodes.back()->init(this); f.serial(*_Nodes.back()); } } else { for(uint k = 0; k < numNodes; ++k) { f.serial(*_Nodes[k]); } } f.xmlPop(); f.xmlPop(); }
void CPrimitiveBlock::serial (NLMISC::IStream &s) { s.xmlPush ("PRIMITIVE_BLOCK"); // Serial checks s.serialCheck ((uint32)'KBRP'); // Serial the version (void)s.serialVersion (0); s.xmlPush ("PRIMITIVES"); s.serialCont (Primitives); s.xmlPop (); s.xmlPop (); }
// --------------------------------------------------------------------------- void CZoneRegion::serial (NLMISC::IStream &f) { f.xmlPush ("LAND"); sint32 version = f.serialVersion (1); f.serialCheck ((uint32)'DNAL'); f.xmlSerial (_MinX, "MIN_X"); f.xmlSerial (_MinY, "MIN_Y"); f.xmlSerial (_MaxX, "MAX_X"); f.xmlSerial (_MaxY, "MAX_Y"); if (version == 1) { f.serialCont (_Zones); } if (version == 0) { std::vector<SZoneUnit> vZonesTmp; f.serialCont (vZonesTmp); _Zones.resize (vZonesTmp.size()); for (uint32 i = 0; i < vZonesTmp.size(); ++i) _Zones[i] = vZonesTmp[i]; } f.xmlPop (); }
void CZoneEdge::serial (NLMISC::IStream& s) { // Serial the version /*sint ver =*/ s.serialVersion (0); s.xmlPush ("VERTICES"); s.serialCont (_TheEdge); s.xmlPop (); s.xmlPush ("VERTICES_ID"); s.serialCont (_Id); s.xmlPop (); s.xmlSerial (_Rotation, "ROTATION"); s.xmlSerial (_OffsetX, _OffsetY, "OFFSET"); }
void CPrimitiveDesc::serial (NLMISC::IStream &s) { // Serial the version sint ver = s.serialVersion (1); s.xmlPush ("LENGTH"); s.serial (Length[0]); s.serial (Length[1]); s.xmlPop (); s.xmlSerial (Height, "HEIGHT"); s.xmlSerial (Attenuation, "ATTENUATION"); s.xmlPush ("TYPE"); s.serialEnum (Type); s.xmlPop (); s.xmlPush ("REACTION"); s.serialEnum (Reaction); s.xmlPop (); s.xmlPush ("TRIGGER"); s.serialEnum (Trigger); s.xmlPop (); s.xmlSerial (Obstacle, "OBSTACLE"); s.xmlSerial (OcclusionMask, "OCCLUSION_MASK"); s.xmlSerial (CollisionMask, "COLLISION_MASK"); s.xmlSerial (Position, "POSITION"); s.xmlSerial (Orientation, "ORIENTATION"); if (ver>=1) { s.xmlSerial (UserData, "USER_DATA"); } else { UserData = 0; } }
//*********************************************************************************************** void CParticleWorkspace::CNode::serial(NLMISC::IStream &f) { nlassert(_WS); f.xmlPush("PROJECT_FILE"); sint version = f.serialVersion(2); f.xmlSerial(_RelativePath, "RELATIVE_PATH"); if (version >= 1) { f.xmlSerial(_TriggerAnim, "TRIGGER_ANIMATION"); } if (version >= 2) { f.xmlSerial(_ParentSkelName, "PARENT_SKEL_NAME"); f.xmlSerial(_ParentBoneName, "PARENT_BONE_NAME"); } f.xmlPop(); }
/* * Serial method */ void CDatabaseState::serial(NLMISC::IStream& s) { s.xmlPush("database_state"); s.serialCheck((uint32)'DBST'); uint version = s.serialVersion(0); s.xmlPush("name"); s.serial(Name); s.xmlPop(); s.xmlPush("id"); s.serial(Id); s.xmlPop(); s.xmlPush("lastupdateid"); s.serial(LastUpdateId); s.xmlPop(); s.xmlPush("currentindex"); s.serial(CurrentIndex); s.xmlPop(); s.xmlPush("endtimestamp"); if (s.isReading()) { std::string ts; s.serial(ts); EndTimestamp.fromString(ts.c_str()); } else { std::string ts = EndTimestamp.toString(); s.serial(ts); } s.xmlPop(); s.xmlPop(); }