Пример #1
0
        private void ParseHeaderSection()
        {
            Header header = model.header;

            header.maxRadius      = reader.ReadFloat();
            header.objectFlags    = reader.ReadInt();
            header.subObjectCount = reader.ReadInt();
            header.minBounding    = reader.ReadVector3();
            header.maxBounding    = reader.ReadVector3();
            int detailLevels = reader.ReadInt();

            header.detailLevelIndices = new int[detailLevels];

            for (int i = 0; i < detailLevels; i++)
            {
                header.detailLevelIndices[i] = reader.ReadInt();
            }

            int debrisCount = reader.ReadInt();

            header.debrisCountIndices = new int[debrisCount];

            for (int i = 0; i < debrisCount; i++)
            {
                header.debrisCountIndices[i] = reader.ReadInt();
            }

            header.mass            = reader.ReadFloat();
            header.centerOfMass    = reader.ReadVector3();
            header.momentOfInertia = reader.ReadFloatArray(9);
            int crossSectionCount = reader.ReadInt();

            if (crossSectionCount < 0)
            {
                crossSectionCount = 0;
            }
            header.crossSections = new CrossSection[crossSectionCount];

            for (int i = 0; i < header.crossSections.Length; i++)
            {
                header.crossSections[i].depth  = reader.ReadFloat();
                header.crossSections[i].radius = reader.ReadFloat();
            }

            header.muzzleLights = new MuzzleLight[reader.ReadInt()];

            for (int i = 0; i < header.muzzleLights.Length; i++)
            {
                header.muzzleLights[i].location  = reader.ReadVector3();
                header.muzzleLights[i].lightType = reader.ReadInt();
            }
        }