예제 #1
0
        // Private Methods
        private void Read(BinaryReader reader)
        {
            offset  = (int)reader.BaseStream.Position - HEADER_SIZE;
            _unused = reader.ReadUInt32();
            _addressRelocTableOffset = reader.ReadInt32();
            _addressRelocTableSize   = reader.ReadInt32();
            _unk1                  = reader.ReadUInt32();
            _unk2                  = reader.ReadUInt32();
            _nodeArrayOffset       = reader.ReadUInt32();
            _materialArrayOffset   = reader.ReadUInt32();
            _unk3                  = reader.ReadUInt32();
            _nodeNameSectionOffset = reader.ReadUInt32();

            reader.BaseStream.Seek(offset + DATA_START_ADDRESS + _nodeArrayOffset, SeekOrigin.Begin);
            _numNodes = reader.ReadUInt32();
            reader.AlignPosition(16);
            long nodeArrayPos = reader.BaseStream.Position;

            reader.BaseStream.Seek(offset + DATA_START_ADDRESS + _materialArrayOffset, SeekOrigin.Begin);
            _numMaterials = reader.ReadUInt32();
            _materials    = new MDMaterial[_numMaterials];
            for (int i = 0; i < _numMaterials; i++)
            {
                _materials[i] = new MDMaterial(reader);
            }

            if (_nodeNameSectionOffset != 0)
            {
                reader.BaseStream.Seek(offset + DATA_START_ADDRESS + _nodeNameSectionOffset, SeekOrigin.Begin);
                _nodeNameSection = new NDNM(_numNodes, reader);
            }

            _nodes = new MDNode[_numNodes];
            for (int i = 0; i < _numNodes; i++)
            {
                reader.BaseStream.Seek(nodeArrayPos + (i * MDNode.SIZE), SeekOrigin.Begin);
                _nodes[i] = new MDNode(this, reader);
            }

            for (int i = 0; i < _numNodes; i++)
            {
                _nodes[i].ReadMeshes(this, reader);
            }
        }
예제 #2
0
        // Private Methods
        private void Read(BinaryReader reader)
        {
            offset = (int)reader.BaseStream.Position - HEADER_SIZE; 
            _unused = reader.ReadUInt32();
            _addressRelocTableOffset = reader.ReadInt32();
            _addressRelocTableSize = reader.ReadInt32();
            _unk1 = reader.ReadUInt32();
            _unk2 = reader.ReadUInt32();
            _nodeArrayOffset = reader.ReadUInt32();
            _materialArrayOffset = reader.ReadUInt32();
            _unk3 = reader.ReadUInt32();
            _nodeNameSectionOffset = reader.ReadUInt32();

            reader.BaseStream.Seek(offset + DATA_START_ADDRESS + _nodeArrayOffset, SeekOrigin.Begin);
            _numNodes = reader.ReadUInt32();
            reader.AlignPosition(16);
            long nodeArrayPos = reader.BaseStream.Position;

            reader.BaseStream.Seek(offset + DATA_START_ADDRESS + _materialArrayOffset, SeekOrigin.Begin);
            _numMaterials = reader.ReadUInt32();
            _materials = new MDMaterial[_numMaterials];
            for (int i = 0; i < _numMaterials; i++)
            {
                _materials[i] = new MDMaterial(reader);
            }

            if (_nodeNameSectionOffset != 0)
            {
                reader.BaseStream.Seek(offset + DATA_START_ADDRESS + _nodeNameSectionOffset, SeekOrigin.Begin);
                _nodeNameSection = new NDNM(_numNodes, reader);
            }

            _nodes = new MDNode[_numNodes];
            for (int i = 0; i < _numNodes; i++)
            {
                reader.BaseStream.Seek(nodeArrayPos + (i * MDNode.SIZE), SeekOrigin.Begin);
                _nodes[i] = new MDNode(this, reader);
            }

            for (int i = 0; i < _numNodes; i++)
            {
                _nodes[i].ReadMeshes(this, reader);
            }
        }
예제 #3
0
 // Constructors
 internal MDSubMeshType2(MDChunk model, MDNode node, IntPtr ptr, BinaryReader reader)
 {
     _node = node;
     InternalRead(model, reader);
     _material = model.Materials[_materialID];
 }
예제 #4
0
 // Constructors
 internal MDSubMeshType2(MDChunk model, MDNode node, IntPtr ptr, BinaryReader reader)
 {
     _node = node;
     InternalRead(model, reader);
     _material = model.Materials[_materialID];
 }