static public ParticleFrame Parse(BinaryReader br) { uint code = br.ReadUInt32(); if (code == 0xFABADA) { ParticleFrame frame = new ParticleFrame(); frame.fluidname = br.ReadBytes(250).ToString(); frame.version = br.ReadUInt16(); frame.scale = br.ReadSingle(); frame.ftype = br.ReadInt32(); frame.etime = br.ReadSingle(); frame.fnum = br.ReadInt32(); frame.fps = br.ReadInt32(); frame.numparticles = br.ReadInt32(); frame.radius = br.ReadSingle(); frame.pressure = ReadVector3(br); frame.speed = ReadVector3(br); frame.temperature = ReadVector3(br); if (frame.version >= 7.0f) { frame.emitpos = ReadVector3(br); frame.emitrot = ReadVector3(br); frame.emitscl = ReadVector3(br); } frame.particles = new RealFlowParticleData[frame.numparticles]; for (int i = 0; i < frame.numparticles; i++) { RealFlowParticleData p = RealFlowParticleData.Parse(br, frame.version); frame.particles[i] = p; } return(frame); } return(null); }
static public ParticleFrame Parse(BinaryReader br) { uint code = br.ReadUInt32(); if ( code == 0xFABADA ) { ParticleFrame frame = new ParticleFrame(); frame.fluidname = br.ReadBytes(250).ToString(); frame.version = br.ReadUInt16(); frame.scale = br.ReadSingle(); frame.ftype = br.ReadInt32(); frame.etime = br.ReadSingle(); frame.fnum = br.ReadInt32(); frame.fps = br.ReadInt32(); frame.numparticles = br.ReadInt32(); frame.radius = br.ReadSingle(); frame.pressure = ReadVector3(br); frame.speed = ReadVector3(br); frame.temperature = ReadVector3(br); if ( frame.version >= 7.0f ) { frame.emitpos = ReadVector3(br); frame.emitrot = ReadVector3(br); frame.emitscl = ReadVector3(br); } frame.particles = new RealFlowParticleData[frame.numparticles]; for ( int i = 0; i < frame.numparticles; i++ ) { RealFlowParticleData p = RealFlowParticleData.Parse(br, frame.version); frame.particles[i] = p; } return frame; } return null; }