Пример #1
0
        public ParticleEmitter2(BinaryReader br)
        {
            TotalSize = br.ReadUInt32();
            long end = br.BaseStream.Position + TotalSize;

            ObjSize  = br.ReadUInt32();
            Name     = br.ReadCString(Constants.SizeName);
            ObjectId = br.ReadInt32();
            ParentId = br.ReadInt32();
            Flags    = (GENOBJECTFLAGS)br.ReadUInt32();

            LoadTracks(br);

            NodeSize     = br.ReadInt32();
            Type         = (PARTICLE_EMITTER_TYPE)br.ReadInt32();
            Speed        = br.ReadSingle();
            Variation    = br.ReadSingle();
            Latitude     = br.ReadSingle();
            Longitude    = br.ReadSingle();
            Gravity      = br.ReadSingle();
            ZSource      = br.ReadSingle();
            Lifespan     = br.ReadSingle();
            EmissionRate = br.ReadSingle();
            Length       = br.ReadSingle();
            Width        = br.ReadSingle();

            Rows         = br.ReadInt32();
            Cols         = br.ReadInt32();
            ParticleType = (PARTICLE_TYPE)br.ReadInt32();
            if (ParticleType > 0 && !Enum.IsDefined(typeof(PARTICLE_TYPE), ParticleType))
            {
                throw new Exception("Unknown PARTICLE_TYPE");
            }

            TailLength = br.ReadSingle();
            MiddleTime = br.ReadSingle();

            StartColor  = new CVector3(br);
            MiddleColor = new CVector3(br);
            EndColor    = new CVector3(br);

            StartAlpha  = br.ReadByte() / 255f;
            MiddleAlpha = br.ReadByte() / 255f;
            EndAlpha    = br.ReadByte() / 255f;

            StartScale  = br.ReadSingle();
            MiddleScale = br.ReadSingle();
            EndScale    = br.ReadSingle();

            LifespanUVAnimStart  = br.ReadUInt32();
            LifespanUVAnimEnd    = br.ReadUInt32();
            LifespanUVAnimRepeat = br.ReadUInt32();

            DecayUVAnimStart  = br.ReadUInt32();
            DecayUVAnimEnd    = br.ReadUInt32();
            DecayUVAnimRepeat = br.ReadUInt32();

            TailUVAnimStart  = br.ReadUInt32();
            TailUVAnimEnd    = br.ReadUInt32();
            TailUVAnimRepeat = br.ReadUInt32();

            TailDecayUVAnimStart  = br.ReadUInt32();
            TailDecayUVAnimEnd    = br.ReadUInt32();
            TailDecayUVAnimRepeat = br.ReadUInt32();

            BlendMode     = (PARTICLE_BLEND_MODE)br.ReadUInt32();
            TextureId     = br.ReadUInt32();
            PriorityPlane = br.ReadInt32();
            ReplaceableId = br.ReadUInt32();

            GeometryMdl  = br.ReadCString(Constants.SizeFileName);
            RecursionMdl = br.ReadCString(Constants.SizeFileName);

            TwinkleFPS      = br.ReadSingle();
            TwinkleOnOff    = br.ReadSingle();
            TwinkleScaleMin = br.ReadSingle();
            TwinkleScaleMax = br.ReadSingle();

            IvelScale    = br.ReadSingle();
            TumbleX      = new CVector2(br);
            TumbleY      = new CVector2(br);
            TumbleZ      = new CVector2(br);
            Drag         = br.ReadSingle();
            Spin         = br.ReadSingle();
            WindVector   = new CVector3(br);
            WindTime     = br.ReadSingle();
            FollowSpeed1 = br.ReadSingle();
            FollowScale1 = br.ReadSingle();
            FollowSpeed2 = br.ReadSingle();
            FollowScale2 = br.ReadSingle();

            NrOfSplines = br.ReadInt32();
            for (int i = 0; i < NrOfSplines; i++)
            {
                Splines.Add(new CVector3(br));
            }

            Squirts = br.ReadUInt32();              // 1 for footsteps and impact spell effects

            while (br.BaseStream.Position < end && !br.AtEnd())
            {
                string tagname = br.ReadString(4);
                switch (tagname)
                {
                case "KP2S": SpeedKeys = new Track <float>(br); break;

                case "KP2R": VariationKeys = new Track <float>(br); break;

                case "KP2G": GravityKeys = new Track <float>(br); break;

                case "KP2W": WidthKeys = new Track <float>(br); break;

                case "KP2N": LengthKeys = new Track <float>(br); break;

                case "KVIS": VisibilityKeys = new Track <float>(br); break;

                case "KP2E": EmissionRateKeys = new Track <float>(br); break;

                case "KP2L": LatitudeKeys = new Track <float>(br); break;

                case "KLIF": LifespanKeys = new Track <float>(br); break;

                case "KPLN": LongitudeKeys = new Track <float>(br); break;

                case "KP2Z": ZSourceKeys = new Track <float>(br); break;

                default:
                    br.BaseStream.Position -= 4;
                    return;
                }
            }
        }
Пример #2
0
        public ParticleEmitter2(BinaryReader br)
        {
            long end = br.BaseStream.Position + (TotalSize = br.ReadUInt32());

            ObjSize  = br.ReadUInt32();
            Name     = br.ReadCString(Constants.SizeName);
            ObjectId = br.ReadInt32();
            ParentId = br.ReadInt32();
            Flags    = (GENOBJECTFLAGS)br.ReadUInt32();

            LoadTracks(br);

            Speed        = br.ReadSingle();
            Variation    = br.ReadSingle();
            Latitude     = br.ReadSingle();
            Gravity      = br.ReadSingle();
            Lifespan     = br.ReadSingle();
            EmissionRate = br.ReadSingle();
            Length       = br.ReadSingle();
            Width        = br.ReadSingle();
            BlendMode    = (PARTICLE_BLEND_MODE)br.ReadUInt32();
            Rows         = br.ReadInt32();
            Cols         = br.ReadInt32();
            ParticleType = (PARTICLE_TYPE)br.ReadInt32();
            TailLength   = br.ReadSingle();
            MiddleTime   = br.ReadSingle();

            StartColor  = new CVector3(br);
            MiddleColor = new CVector3(br);
            EndColor    = new CVector3(br);
            StartAlpha  = br.ReadByte() / 255f;
            MiddleAlpha = br.ReadByte() / 255f;
            EndAlpha    = br.ReadByte() / 255f;
            StartScale  = br.ReadSingle();
            MiddleScale = br.ReadSingle();
            EndScale    = br.ReadSingle();

            LifespanUVAnimStart  = br.ReadUInt32();
            LifespanUVAnimEnd    = br.ReadUInt32();
            LifespanUVAnimRepeat = br.ReadUInt32();

            DecayUVAnimStart  = br.ReadUInt32();
            DecayUVAnimEnd    = br.ReadUInt32();
            DecayUVAnimRepeat = br.ReadUInt32();

            TailUVAnimStart  = br.ReadUInt32();
            TailUVAnimEnd    = br.ReadUInt32();
            TailUVAnimRepeat = br.ReadUInt32();

            TailDecayUVAnimStart  = br.ReadUInt32();
            TailDecayUVAnimEnd    = br.ReadUInt32();
            TailDecayUVAnimRepeat = br.ReadUInt32();

            TextureId     = br.ReadUInt32();
            Squirts       = br.ReadUInt32(); // 1 for footsteps and impact spell effects
            PriorityPlane = br.ReadInt32();
            ReplaceableId = br.ReadUInt32();

            while (br.BaseStream.Position < end && !br.AtEnd())
            {
                string tagname = br.ReadString(4);
                switch (tagname)
                {
                case "KP2S": SpeedKeys = new Track <float>(br); break;

                case "KP2R": VariationKeys = new Track <float>(br); break;

                case "KP2G": GravityKeys = new Track <float>(br); break;

                case "KP2W": WidthKeys = new Track <float>(br); break;

                case "KP2N": LengthKeys = new Track <float>(br); break;

                case "KP2V": VisibilityKeys = new Track <float>(br); break;

                case "KP2E": EmissionRateKeys = new Track <float>(br); break;

                case "KP2L": LatitudeKeys = new Track <float>(br); break;

                default:
                    br.BaseStream.Position -= 4;
                    return;
                }
            }
        }