本文整理汇总了C++中BinaryReader::ReadIn方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryReader::ReadIn方法的具体用法?C++ BinaryReader::ReadIn怎么用?C++ BinaryReader::ReadIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryReader
的用法示例。
在下文中一共展示了BinaryReader::ReadIn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnStart
void OnStart()
{
asd::Engine::GetFile()->AddRootDirectory(asd::ToAString("Data/Texture.pack").c_str());
for (auto loop = 0; loop < 2; loop++)
{
//普通に読み込んだバイナリ
BinaryReader reader;
auto data = GetBinaryData(asd::ToAString("Data/Texture/Surface/Tile_Normal.png"));
reader.ReadIn(data.begin(), data.end());
//ファイル機能で読み込んだバイナリ
auto staticFile = asd::Engine::GetFile()->CreateStaticFile(asd::ToAString("Surface/Tile_Normal.png").c_str());
auto staticFileData = staticFile->GetBuffer();
int cnt = 0;
while (!reader.IsEmpty())
{
int8_t byteFromRaw = reader.Get<int8_t>();
int8_t byteFromFile = staticFileData[cnt++];
ASSERT_EQ(byteFromRaw, byteFromFile);
}
ASSERT_EQ(cnt, staticFileData.size());
}
}
示例2: OnStart
void OnStart()
{
//普通に読み込んだバイナリ
BinaryReader reader;
auto data = GetBinaryData(asd::ToAString("Data/Texture/Surface/Tile_Normal.png"));
reader.ReadIn(data.begin(), data.end());
//ファイル機能で読み込んだバイナリ
asd::Engine::GetFile()->AddRootPackage(asd::ToAString("Data/Texture.pack").c_str());
auto streamFile = asd::Engine::GetFile()->CreateStreamFile(asd::ToAString("Surface/Tile_Normal.png").c_str());
std::vector<uint8_t> buffer;
streamFile->Read(buffer, streamFile->GetSize());
int cnt = 0;
while (!reader.IsEmpty())
{
auto byteFromRaw = reader.Get<uint8_t>();
auto byteFromFile = buffer[cnt++];
ASSERT_EQ(byteFromRaw, byteFromFile);
}
ASSERT_EQ(cnt, buffer.size());
}
示例3: distance
AffLoader::AffLoader(std::vector<uint8_t> &data)
{
BinaryReader reader;
reader.ReadIn(data.begin(), data.end());
auto header = AffHeader::Get(reader);
auto table = AffIndexTable::Get(reader);
auto indexes = table.GetIndexes();
auto fontNum = header.GetFontCount();
for (int16_t i = 0; i < fontNum; ++i)
{
auto charactor = distance(indexes.begin(), find(indexes.begin(), indexes.end(), i));
result[charactor] = GlyphData::Get(reader, charactor);
}
}
示例4: Load
bool Model_IO::Load(const std::vector<uint8_t>& data, const achar* path)
{
Meshes.clear();
BinaryReader reader;
reader.ReadIn(data.begin(), data.end());
// ヘッダーチェック
uint8_t header_true [] = "MDL";
for (int32_t i = 0; i < 4; i++)
{
auto h = reader.Get<uint8_t>();
if (header_true[i] != h) return false;
}
// バージョン
int32_t version = reader.Get<int32_t>();
// ボーン
LoadDeformer(Deformer_, reader, path, version);
// メッシュ
LoadMeshes(Meshes, reader, path);
// アニメーション
int32_t sourceCount = reader.Get<int32_t>();
AnimationSources.resize(sourceCount);
for (int32_t i = 0; i < sourceCount; i++)
{
LoadAnimationSource(AnimationSources[i], reader, path);
}
int32_t clipCount = reader.Get<int32_t>();
AnimationClips.resize(clipCount);
for (int32_t i = 0; i < clipCount; i++)
{
LoadAnimationClip(AnimationClips[i], reader, path);
}
return true;
}