// Methods
        public override void Load(Stream fileStream)
        {
            // Header
            var reader = new GensReader(fileStream, true);

            Header = new GensHeader(reader);

            // Root Node
            uint instanceInfoCount         = reader.ReadUInt32();
            uint instanceInfoOffsetsOffset = reader.ReadUInt32();

            uint terrainModelCount         = reader.ReadUInt32();
            uint terrainModelOffsetsOffset = reader.ReadUInt32();

            // Instance Infos
            InstanceInfos = new InstanceInfoEntry[instanceInfoCount];
            reader.JumpTo(instanceInfoOffsetsOffset, false);

            for (uint i = 0; i < instanceInfoCount; ++i)
            {
                var  instanceInfo       = new InstanceInfoEntry();
                uint instanceInfoOffset = reader.ReadUInt32();
                long curPos             = reader.BaseStream.Position;
                reader.JumpTo(instanceInfoOffset, false);

                uint fileNameCount         = reader.ReadUInt32();
                uint fileNameOffsetsOffset = reader.ReadUInt32();
                uint boundingSphereOffset  = reader.ReadUInt32();
                reader.JumpTo(fileNameOffsetsOffset, false);

                // File Names
                instanceInfo.FileNames = new string[fileNameCount];
                for (uint i2 = 0; i2 < fileNameCount; ++i2)
                {
                    instanceInfo.FileNames[i2] = reader.GetString();
                }

                // Bounding Sphere
                reader.JumpTo(boundingSphereOffset, false);
                instanceInfo.BoundingSphereCenter = reader.ReadVector3();
                instanceInfo.BoundingSphereRadius = reader.ReadSingle();

                InstanceInfos[i]           = instanceInfo;
                reader.BaseStream.Position = curPos;
            }

            // Terrain Models
            TerrainModels = new string[terrainModelCount];
            reader.JumpTo(terrainModelOffsetsOffset, false);

            for (uint i = 0; i < terrainModelCount; ++i)
            {
                TerrainModels[i] = reader.GetString();
            }
        }
Exemplo n.º 2
0
        // Methods
        public override void Load(Stream fileStream)
        {
            // Header
            var reader = new GensReader(fileStream, true);

            Header = new GensHeader(reader);

            // Root Node
            uint lightTotal       = reader.ReadUInt32();
            uint lightTableOffset = reader.ReadUInt32();

            // Data
            reader.JumpTo(lightTableOffset, false);
            for (uint i = 0; i < lightTotal; ++i)
            {
                LightNames.Add(reader.GetString());
            }
        }