Пример #1
0
		public RoRsmMesh(BinaryReader bin, GenericFileFormatVersion version)
			: base(bin, version) {
			int count;

			Head = new RoRsmMeshHeader(bin, version);

			count = bin.ReadInt32();
			if ((bin.BaseStream.Length - bin.BaseStream.Position) < (4 * count)) {
				IsValid = false;
				return;
			}
			for (int i = 0; i < count; i++) {
				TextureIndexs.Add(bin.ReadInt32());
			}

			Matrix = new RoRsmMeshTransMatrix(bin, version);

			count = bin.ReadInt32();
			if ((bin.BaseStream.Length - bin.BaseStream.Position) < (9 * count)) {
				IsValid = false;
				return;
			}
			for (int i = 0; i < count; i++) {
				MainVectors.Add(bin.ReadVector3());
			}

			count = bin.ReadInt32();
			for (int i = 0; i < count; i++) {
				TextureVectors.Add(new RoRsmMeshTextureVertex(bin, version));
			}


			count = bin.ReadInt32();
			for (int i = 0; i < count; i++) {
				Surfaces.Add(new RoRsmMeshSurface(bin, version));
			}

			if (version.IsCompatible(1, 5)) {
				count = bin.ReadInt32();
				for (int i = 0; i < count; i++) {
					PositionFrames.Add(new RoRsmMeshPositionFrame(bin, version));
				}
			}

			count = bin.ReadInt32();
			for (int i = 0; i < count; i++) {
				RotationFrames.Add(new RoRsmMeshRotationFrame(bin, version));
			}

			IsValid = true;
		}
Пример #2
0
        public RoRsmMesh(BinaryReader bin, GenericFileFormatVersion version)
            : base(bin, version)
        {
            int count;

            Head = new RoRsmMeshHeader(bin, version);

            count = bin.ReadInt32();
            if ((bin.BaseStream.Length - bin.BaseStream.Position) < (4 * count))
            {
                IsValid = false;
                return;
            }
            for (int i = 0; i < count; i++)
            {
                TextureIndexs.Add(bin.ReadInt32());
            }

            Matrix = new RoRsmMeshTransMatrix(bin, version);

            count = bin.ReadInt32();
            if ((bin.BaseStream.Length - bin.BaseStream.Position) < (9 * count))
            {
                IsValid = false;
                return;
            }
            for (int i = 0; i < count; i++)
            {
                MainVectors.Add(bin.ReadVector3());
            }

            count = bin.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                TextureVectors.Add(new RoRsmMeshTextureVertex(bin, version));
            }


            count = bin.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Surfaces.Add(new RoRsmMeshSurface(bin, version));
            }

            if (version.IsCompatible(1, 5))
            {
                count = bin.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    PositionFrames.Add(new RoRsmMeshPositionFrame(bin, version));
                }
            }

            count = bin.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                RotationFrames.Add(new RoRsmMeshRotationFrame(bin, version));
            }

            IsValid = true;
        }