当前位置: 首页>>代码示例>>C++>>正文


C++ SeekableReadStream::seekTo方法代码示例

本文整理汇总了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);
}
开发者ID:Hellzed,项目名称:xoreos,代码行数:11,代码来源:model.cpp

示例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;

}
开发者ID:EffWun,项目名称:xoreos,代码行数:52,代码来源:wokfile.cpp

示例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);
}
开发者ID:cc9cii,项目名称:xoreos,代码行数:15,代码来源:model_kotor.cpp


注:本文中的common::SeekableReadStream::seekTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。