Example #1
0
        public RoadLink(BinaryReaderEx input)
        {
            ConnectionCount = input.ReadInt16();
            Positions       = new Vector3P[ConnectionCount];
            for (int i = 0; i < ConnectionCount; i++)
            {
                Positions[i] = new Vector3P(input);
            }

            if (input.Version >= 24)
            {
                ConnectionTypes = new byte[ConnectionCount];
                for (int i = 0; i < ConnectionCount; i++)
                {
                    ConnectionTypes[i] = input.ReadByte();
                }
            }

            ObjectID = input.ReadInt32();

            if (input.Version >= 16)
            {
                P3dPath = input.ReadAsciiz();
                ToWorld = new Matrix4P(input);
            }
        }
Example #2
0
 public Object(BinaryReaderEx input)
 {
     ObjectID   = input.ReadInt32();
     ModelIndex = input.ReadInt32();
     Transform  = new Matrix4P(input);
     if (input.Version >= 14)
     {
         ShapeParam = input.ReadInt32();
     }
 }
Example #3
0
        private void ReadRTM(BinaryReaderEx input)
        {
            Displacement = new Vector3P(input);
            var nFrames = input.ReadInt32();

            BoneNames = input.ReadArray(inp => inp.ReadAscii(32));

            var nBones = BoneNames.Length;

            FrameTimes      = new float[nFrames];
            FrameTransforms = new Matrix4P[nFrames, nBones];
            for (int frame = 0; frame < nFrames; frame++)
            {
                FrameTimes[frame] = input.ReadSingle();
                for (int b = 0; b < nBones; b++)
                {
                    input.ReadAscii(32); //redundand boneName
                    FrameTransforms[frame, b] = new Matrix4P(input);
                }
            }
        }
 public EditableWrpObject(BinaryReaderEx input)
 {
     Transform = new Matrix4P(input);
     ObjectID  = input.ReadInt32();
     Model     = input.ReadAscii32();
 }
Example #5
0
        private void Read(BinaryReaderEx input)
        {
            if ("BMTR" != input.ReadAscii(4))
            {
                throw new FormatException();
            }

            Version       = input.ReadInt32();
            input.Version = Version;
            if (Version >= 3)
            {
                input.UseLZOCompression = true;
            }
            if (Version >= 5)
            {
                input.UseCompressionFlag = true;
            }

            Reversed = input.ReadBoolean();
            Step     = new Vector3P(input);
            var nPhases = input.ReadInt32();

            PreloadCount = input.ReadInt32();
            var nAnimatedBones = input.ReadInt32();

            BoneNames = input.ReadStringArray();

            //metadata
            if (Version >= 4)
            {
                MetaDataValues = input.ReadStringArray();
                AnimKeyStones  = input.ReadArray(inp => new AnimKeyStone(inp));
            }

            PhaseTimes = input.ReadCompressedFloatArray();
            Phases     = Enumerable.Range(0, nPhases).Select(_ => input.ReadCompressedArray(inp => Matrix4P.ReadMatrix4Quat16b(inp), 14)).ToArray();
        }