本文整理汇总了C++中common::SeekableReadStream::seekTo方法的典型用法代码示例。如果您正苦于以下问题:C++ SeekableReadStream::seekTo方法的具体用法?C++ SeekableReadStream::seekTo怎么用?C++ SeekableReadStream::seekTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::SeekableReadStream
的用法示例。
在下文中一共展示了SeekableReadStream::seekTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readArray
void Model::readArray(Common::SeekableReadStream &stream,
uint32 offset, uint32 count, std::vector<T> &values) {
uint32 pos = stream.seekTo(offset);
values.resize(count);
for (uint32 i = 0; i < count; i++)
readValue(stream, values[i]);
stream.seekTo(pos);
}
示例2: load
void WOKFile::load(Common::SeekableReadStream &s) {
auto header = doLoad<wok::Header>(s);
fu::fold(header, xxofs, dump());
*xxofs << "--Vertices--" << std::endl;
for (auto i = 0; i < header.verticesCount; ++i) {
s.seekTo(header.offsetToVertices + i * sizeof(wok::Vertex));
auto vertex = doLoad<wok::Vertex>(s);
*xxofs << vertex.X << "," << vertex.Y << "," << vertex.Z << std::endl;
Vector3 pt;
pt.x = vertex.X;
pt.y = vertex.Y;
pt.z = vertex.Z;
_vertices.push_back(pt);
}
*xxofs << "--Normals--" << std::endl;
for (auto i = 0; i < header.verticesCount; ++i) {
s.seekTo(header.offsetToNormalizedInvertedNormals + i * sizeof(wok::Vertex));
auto vertex = doLoad<wok::Vertex>(s);
*xxofs << vertex.X << "," << vertex.Y << "," << vertex.Z << std::endl;
Vector3 pt;
pt.x = vertex.X;
pt.y = vertex.Y;
pt.z = vertex.Z;
_normals.push_back(pt);
}
*xxofs << "--Triangles--" << std::endl;
for (auto i = 0; i < header.facesCount; ++i) {
s.seekTo(header.offsetToFaces + i * sizeof(wok::Face));
auto face = doLoad<wok::Face>(s);
*xxofs << face.V1_Index << "," << face.V2_Index << "," << face.V3_Index << std::endl;
Triangle t;
t[0] = face.V1_Index;
t[1] = face.V2_Index;
t[2] = face.V3_Index;
_triangles.push_back(t);
}
_position[0] = header.positionX;
_position[1] = header.positionY;
_position[2] = header.positionZ;
}
示例3: readStrings
void Model_KotOR::readStrings(Common::SeekableReadStream &mdl,
const std::vector<uint32> &offsets, uint32 offset,
std::vector<Common::UString> &strings) {
uint32 pos = mdl.pos();
strings.reserve(offsets.size());
for (std::vector<uint32>::const_iterator o = offsets.begin(); o != offsets.end(); ++o) {
mdl.seekTo(offset + *o);
strings.push_back(Common::readString(mdl, Common::kEncodingASCII));
}
mdl.seekTo(pos);
}