// *************************************************************************** void CVegetableShape::serial(NLMISC::IStream &f) { /* Version 1: - BestSidedPreComputeLighting */ sint ver= f.serialVersion(1); f.serialCheck((uint32)'_LEN'); f.serialCheck((uint32)'GEV_'); f.serialCheck((uint32)'BATE'); f.serialCheck((uint32)'__EL'); f.serial(Lighted); f.serial(DoubleSided); f.serial(PreComputeLighting); f.serial(AlphaBlend); f.serialEnum(BendCenterMode); f.serial(VB); f.serialCont(TriangleIndices); if(ver>=1) f.serial(BestSidedPreComputeLighting); else if(f.isReading()) BestSidedPreComputeLighting= false; // if reading if(f.isReading()) { // prepare for instanciation InstanceVertices.resize(VB.getNumVertices()); } }
///====================================================================================== void CPSFace::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { NL_PS_FUNC(CPSFace_IStream ) f.serialVersion(1); CPSQuad::serial(f); CPSRotated3DPlaneParticle::serialPlaneBasisScheme(f); if (f.isReading()) { uint32 nbConfigurations; f.serial(nbConfigurations); if (nbConfigurations) { f.serial(_MinAngularVelocity, _MaxAngularVelocity); } hintRotateTheSame(nbConfigurations, _MinAngularVelocity, _MaxAngularVelocity); init(); } else { uint32 nbConfigurations = (uint32)_PrecompBasis.size(); f.serial(nbConfigurations); if (nbConfigurations) { f.serial(_MinAngularVelocity, _MaxAngularVelocity); } } }
// *************************************************************************** void CAnimationSet::serial (NLMISC::IStream& f) { // serial not possible if header optimisation enabled nlassert(!_AnimHeaderOptimisation); // Serial an header f.serialCheck ((uint32)'_LEN'); f.serialCheck ((uint32)'MINA'); f.serialCheck ((uint32)'TES_'); // Serial a version uint ver= f.serialVersion (1); // Serial the class f.serialContPtr (_Animation); f.serialContPtr (_SkeletonWeight); f.serialCont (_AnimationName); f.serialCont (_SkeletonWeightName); f.serialCont(_ChannelIdByName); f.serialCont(_AnimationIdByName); f.serialCont(_SkeletonWeightIdByName); if(ver>=1) f.serialCont(_ChannelName); else buildChannelNameFromMap(); }
// --------------------------------------------------------------------------- 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 CSkeletonShape::CLod::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { (void)f.serialVersion(0); f.serial(Distance); f.serialCont(ActiveBones); }
//=========================================================== void CSegRemanenceShape::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { // version 2 : added default tracks // version 1 : rollup ratio // version 0 : base version sint ver = f.serialVersion(2); f.serial(_NumSlices); f.serial(_SliceTime); f.serialCont(_Corners); f.serial(_Mat); f.serial(_BBox); f.serial(_TextureShifting); f.serialPtr(_AnimatedMat); if (f.isReading()) { _GeomTouched = true; _MatTouched = true; } if (ver >= 1) { f.serial(_RollUpRatio); } if (ver >= 2) { f.serial(_DefaultPos); f.serial(_DefaultRotQuat); f.serial(_DefaultScale); } }
//*********************************************************************************************** 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 CVegetable::serial(NLMISC::IStream &f) { /* Version 1: - add BendFrequencyFactor Version 0: - base version */ sint ver= f.serialVersion(1); f.serial(ShapeName); f.serial(Density); f.serial(MaxDensity); f.serial(_CosAngleMin, _CosAngleMax, _CosAngleMiddle, _OOCosAngleDist); f.serialEnum(_AngleType); f.serial(Sxy, Sz); f.serial(Rx, Ry, Rz); f.serial(BendFactor); f.serial(BendPhase); f.serial(Color); f.serial(DistType); if(ver>=1) f.serial(BendFrequencyFactor); else BendFrequencyFactor= 1; }
// *************************************************************************** void CTrackSampledCommon::CTimeBlock::serial(NLMISC::IStream &f) { (void)f.serialVersion(0); f.serial(TimeOffset); f.serial(KeyOffset); f.serial(Times); }
// --------------------------------------------------------------------------- void CZoneRegion::SZoneUnit2::serial (NLMISC::IStream &f) { /*sint32 version =*/ f.serialVersion (0); SZoneUnit::serial (f); f.xmlSerial (DateLow, "LOW"); f.xmlSerial (DateHigh, "HIGH"); }
// *************************************************************************** void CSkills::serial(NLMISC::IStream &f) { if (ShowDebugInChat) nlinfo("Skill are about to..."); uint ver= f.serialVersion(0); f.serialCont(_I16Skills); f.serialCont(_I16Tallies); if (ShowDebugInChat) nlinfo("Skills are in!"); }
///=========================================================================== void CParticleSystemShape::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { /* *********************************************** * WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance * It can be loaded/called through CAsyncFileManager for instance * ***********************************************/ sint ver = f.serialVersion(6); /// version 6 : added sharing flag //NLMISC::CVector8 &buf = _ParticleSystemProto.bufferAsVector(); //f.serialCont(buf); if (f.isReading ()) { std::vector<uint8> buf; f.serialCont(buf); _ParticleSystemProto.fill(&buf[0], (uint32)buf.size()); } else { f.serialBufferWithSize ((uint8*)_ParticleSystemProto.buffer(), _ParticleSystemProto.length()); } if (ver > 1) { // serial default tracks for (uint k = 0; k < 4; ++k) { f.serial(_UserParamDefaultTrack[k]); } } if ( ver > 2) { f.serial (_DefaultPos); f.serial (_DefaultScale); f.serial (_DefaultRotQuat); } if ( ver > 3) { f.serial(_MaxViewDist); f.serial(_DestroyWhenOutOfFrustum); f.serial(_DestroyModelWhenOutOfRange); } if ( ver > 4) { f.serial(_UsePrecomputedBBox); if (_UsePrecomputedBBox) { f.serial(_PrecomputedBBox); } } if ( ver > 5) { f.serial(_Sharing); } }
// *************************************************************************** void CAABBox::serial(NLMISC::IStream &f) { /* *********************************************** * WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance * It can be loaded/called through CAsyncFileManager for instance * ***********************************************/ (void)f.serialVersion(0); f.serial(Center); f.serial(HalfSize); }
///======================================================================================= void CPSFloatCurveFunctor::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); f.serial(_NumSamples, _Smoothing); f.serialCont(_CtrlPoints); if (f.isReading()) { updateTab(); } }
// *************************************************************************** void CMaterial::CLightMap::serial2(NLMISC::IStream &f) { sint ver= f.serialVersion(1); f.serial(Factor); f.serial(LMCDiffuse); if(ver>=1) f.serial(LMCAmbient); // Serial texture descriptor. Texture.serialPolyPtr(f); }
// *************************************************************************** void CMeshMorpher::serial (NLMISC::IStream &f) throw(NLMISC::EStream) { /* *********************************************** * WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance * It can be loaded/called through CAsyncFileManager for instance * ***********************************************/ (void)f.serialVersion (0); f.serialCont (BlendShapes); }
// *************************************************************************** void CInterfaceConfig::SDBLeaf::serial(NLMISC::IStream &f) { // version 1 : added old value ( else some observers are not launched ) // version 0 : base version sint ver = f.serialVersion(1); f.serial(Name); f.serial(Value); if (ver >= 1) f.serial(OldValue); else OldValue = Value; }
/* * Serial Mapper */ void CPDStringMapper::serial(NLMISC::IStream& f) { f.serialCheck((uint32)'PDSM'); uint version = f.serialVersion(0); f.serialCont(_StringMap); if (f.isReading()) { buildIdMap(); } }
//*************************************************************************************************************** void CFlareShape::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { // Version 4 : - added occlusion test mesh, size reduction, angle modification when object is occluded // - added lookat mode for first flare sint ver = f.serialVersion(5); f.serial(_Color, _Persistence, _Spacing); f.serial(_Attenuable); if (_Attenuable) { f.serial(_AttenuationRange); } f.serial(_FirstFlareKeepSize); if (f.isReading() && ver <= 4) { _FirstFlareKeepSize = false; } for (uint k = 0; k < MaxFlareNum; ++k) { ITexture *tex = _Tex[k]; f.serialPolyPtr(tex); if (f.isReading()) { _Tex[k] = tex; } f.serial(_Size[k], _Pos[k]); } f.serial(_InfiniteDist); if (!_InfiniteDist) { f.serial(_MaxViewDist, _MaxViewDistRatio); } f.serial(_DazzleEnabled); if (_DazzleEnabled) { f.serial(_DazzleColor, _DazzleAttenuationRange); } f.serial(_InfiniteDist); if (ver >= 2) { f.serial( _DistMax ); } if (ver >= 4) { f.serial(_OcclusionTestMeshName); f.serial(_ScaleWhenDisappear); f.serial(_SizeDisappear); f.serial(_AngleDisappear); f.serial(_OcclusionTestMeshInheritScaleRot); f.serial(_LookAtMode); } }
// *************************************************************************** void CTrackSampledCommon::serialCommon(NLMISC::IStream &f) { (void)f.serialVersion(0); f.serial(_LoopMode); f.serial(_BeginTime); f.serial(_EndTime) ; f.serial(_TotalRange); f.serial(_OOTotalRange); f.serial(_DeltaTime); f.serial(_OODeltaTime); f.serial(_TimeBlocks); }
//======================================================= void CPSRibbonLookAt::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { NL_PS_FUNC(CPSRibbonLookAt_serial) /** Version 4 : added CPSRibbonBase has a base class instead of CPSParticle * */ sint ver = f.serialVersion(4); if (ver > 3) { CPSRibbonBase::serial(f); } else { CPSParticle::serial(f); } CPSColoredParticle::serialColorScheme(f); CPSSizedParticle::serialSizeScheme(f); serialMaterial(f); uint32 dummy = 0; /* _NbDyingRibbons */ if (ver <= 3) { f.serial(_SegDuration, _NbSegs, dummy /*_NbDyingRibbons*/); } ITexture *tex = NULL; if (ver > 2) { f.serial(_Parametric); } if (!f.isReading()) { tex = _Tex; f.serialPolyPtr(tex); } else { f.serialPolyPtr(tex); setTexture(tex); _Tex = tex; if (_Tex) { _Tex->setWrapS(ITexture::Clamp); _Tex->setWrapT(ITexture::Clamp); } setTailNbSeg(_NbSegs); // force to build the vb } }
// *************************************************************************** void CMaterialBase::serial(NLMISC::IStream &f) { sint ver= f.serialVersion(1); f.serial(Name); f.serial(DefaultAmbient, DefaultDiffuse, DefaultSpecular); f.serial(DefaultShininess, DefaultEmissive, DefaultOpacity, DefaultTexture); f.serialCont(_AnimatedTextures); if (ver > 0) { for (uint k = 0; k < IDRV_MAT_MAXTEXTURES; ++k) { f.serial(DefaultTexAnimTracks[k]); } } }
// *************************************************************************** void CInterfaceConfig::CDesktopImage::write(NLMISC::IStream &f) { nlassert(!f.isReading()); // Version is important when the stream will be saved on Disk. f.serialVersion(Version); f.serialCont(GCImages); // serial extra datas uint32 length = ExtraDatas.length(); if (length > 0) { uint8 *pBuffer = new uint8[length]; memcpy(pBuffer, ExtraDatas.buffer(), length); f.serialBuffer(pBuffer, length); delete [] pBuffer; } }
void CPSZone::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { NL_PS_FUNC(CPSZone_serial) f.serialVersion(1); CPSTargetLocatedBindable::serial(f); f.serialEnum(_CollisionBehaviour); f.serial(_BounceFactor); if (f.isReading()) { for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it) { // though this is not a force, this prevent parametric motion (*it)->addNonIntegrableForceRef(); } } }
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 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 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(); }
void NLPACS::CRetrievableSurface::serial(NLMISC::IStream &f) { /* Version 0: - base version. Version 1: - absolute water height and flag Version 2: - no more topologies in stream (obsolete) - no more height quad - quantized height (_QuantHeight) */ sint ver= f.serialVersion(2); if (ver < 2) throw EOlderStream(); uint i; f.serial(_NormalQuanta); f.serial(_OrientationQuanta); f.serial(_Material); f.serial(_Character); f.serial(_Level); f.serialCont(_Chains); f.serialCont(_Loops); if (ver <= 1) { f.serial(_Quad); for (i=0; i<NumMaxCreatureModels; ++i) f.serial(_Topologies[i]); } f.serial(_Center); f.serial(_IsFloor, _IsCeiling); f.serial(_Flags); if (ver >= 1) { f.serial(_WaterHeight); } if (ver >= 2) { f.serial(_QuantHeight); } }
// *************************************************************************** void CPortal::serial (NLMISC::IStream& f) { /* *********************************************** * WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance * It can be loaded/called through CAsyncFileManager for instance * ***********************************************/ int version = f.serialVersion (1); f.serialCont (_LocalPoly); if (f.isReading()) _Poly = _LocalPoly; f.serial (_Name); if (version >= 1) { if (f.isReading()) { std::string occName; f.serial(occName); if (occName.empty()) occName = "no occlusion"; _OcclusionModelId = CStringMapper::map(occName); f.serial(occName); if (occName.empty()) occName = "no occlusion"; _OpenOcclusionModelId = CStringMapper::map(occName); } else { std::string occName = CStringMapper::unmap(_OcclusionModelId); if (occName == "no occlusion") occName = ""; f.serial(occName); occName = CStringMapper::unmap(_OpenOcclusionModelId); if (occName == "no occlusion") occName = ""; f.serial(occName); } } }
// *************************************************************************** void CBlendShape::serial (NLMISC::IStream &f) throw(NLMISC::EStream) { /* *********************************************** * WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance * It can be loaded/called through CAsyncFileManager for instance * ***********************************************/ // version 1 : added tangent space support sint ver = f.serialVersion (1); f.serial (Name); f.serialCont (deltaPos); f.serialCont (deltaNorm); f.serialCont (deltaUV); f.serialCont (deltaCol); if (ver >= 1) f.serialCont(deltaTgSpace); f.serialCont (VertRefs); }