public void Load(BinaryReader br) { Header = new ScmHeader(br); int padding = 32 - (int)br.BaseStream.Position % 32 - 4; br.BaseStream.Seek(padding, SeekOrigin.Current); if (ReadFourCC(br) != "NAME") { throw new Exception("cant find bone names."); } BoneNames = ReadStrings(br, (int)Header.mWeightedBoneCount); br.BaseStream.Seek(Header.mBoneOffset, SeekOrigin.Begin); BoneData = ReadBoneData(br, (int)Header.mWeightedBoneCount); br.BaseStream.Seek(Header.mVertexOffset, SeekOrigin.Begin); VertexData = ReadVertexData(br, (int)Header.mVertexCount); br.BaseStream.Seek(Header.mIndexOffset, SeekOrigin.Begin); TriangleData = ReadTriangleData(br, (int)Header.mIndexCount / 3); br.BaseStream.Seek(Header.mInfoOffset, SeekOrigin.Begin); Infos = Encoding.ASCII.GetString(br.ReadBytes((int)Header.mInfoCount)).Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries); }
public void Load(BinaryReader br) { Header = new ScmHeader(br); int padding = 32 - (int)br.BaseStream.Position % 32 - 4; br.BaseStream.Seek(padding, SeekOrigin.Current); if (ReadFourCC(br) != "NAME") throw new Exception("cant find bone names."); BoneNames = ReadStrings(br, (int)Header.mWeightedBoneCount); br.BaseStream.Seek(Header.mBoneOffset, SeekOrigin.Begin); BoneData = ReadBoneData(br, (int)Header.mWeightedBoneCount); br.BaseStream.Seek(Header.mVertexOffset, SeekOrigin.Begin); VertexData = ReadVertexData(br, (int)Header.mVertexCount); br.BaseStream.Seek(Header.mIndexOffset, SeekOrigin.Begin); TriangleData = ReadTriangleData(br, (int)Header.mIndexCount/3); br.BaseStream.Seek(Header.mInfoOffset, SeekOrigin.Begin); Infos = Encoding.ASCII.GetString(br.ReadBytes((int)Header.mInfoCount)).Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries); }