Ejemplo n.º 1
0
        private void ReadSourceVtxModels(Stream stream, long bodyPartOffset, SourceVtxBodyPart bodyPart)
        {
            if (bodyPart.modelCount > 0 && bodyPart.modelOffset != 0)
            {
                long[] modelOffsets = new long[bodyPart.modelCount];
                stream.Position       = bodyPartOffset + bodyPart.modelOffset;
                bodyPart.theVtxModels = new SourceVtxModel[bodyPart.modelCount];

                for (int i = 0; i < bodyPart.theVtxModels.Length; i++)
                {
                    modelOffsets[i]                    = stream.Position;
                    bodyPart.theVtxModels[i]           = new SourceVtxModel();
                    bodyPart.theVtxModels[i].lodCount  = DataParser.ReadInt(stream);
                    bodyPart.theVtxModels[i].lodOffset = DataParser.ReadInt(stream);
                }
                for (int i = 0; i < bodyPart.theVtxModels.Length; i++)
                {
                    ReadSourceVtxModelLods(stream, modelOffsets[i], bodyPart.theVtxModels[i]);
                }
            }
        }
Ejemplo n.º 2
0
        private void ReadSourceVtxBodyParts(Stream stream)
        {
            if (header.numBodyParts > 0 && header.version <= 7)
            {
                long[] bodyPartOffsets = new long[header.numBodyParts];

                stream.Position = fileOffsetPosition + header.bodyPartOffset;
                bodyParts       = new SourceVtxBodyPart[header.numBodyParts];
                for (int i = 0; i < bodyParts.Length; i++)
                {
                    bodyPartOffsets[i] = stream.Position;

                    bodyParts[i]             = new SourceVtxBodyPart();
                    bodyParts[i].modelCount  = DataParser.ReadInt(stream);
                    bodyParts[i].modelOffset = DataParser.ReadInt(stream);
                }
                for (int i = 0; i < bodyParts.Length; i++)
                {
                    ReadSourceVtxModels(stream, bodyPartOffsets[i], bodyParts[i]);
                }
            }
        }