本文整理汇总了C++中StreamReaderLE::GetI4方法的典型用法代码示例。如果您正苦于以下问题:C++ StreamReaderLE::GetI4方法的具体用法?C++ StreamReaderLE::GetI4怎么用?C++ StreamReaderLE::GetI4使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamReaderLE
的用法示例。
在下文中一共展示了StreamReaderLE::GetI4方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadBitM_Binary
// ------------------------------------------------------------------------------------------------
void COBImporter::ReadBitM_Binary(COB::Scene& /*out*/, StreamReaderLE& reader, const ChunkInfo& nfo)
{
if(nfo.version > 1) {
return UnsupportedChunk_Binary(reader,nfo,"BitM");
}
const chunk_guard cn(nfo,reader);
const uint32_t len = reader.GetI4();
reader.IncPtr(len);
reader.GetI4();
reader.IncPtr(reader.GetI4());
}
示例2: ReadPolH_Binary
// ------------------------------------------------------------------------------------------------
void COBImporter::ReadPolH_Binary(COB::Scene& out, StreamReaderLE& reader, const ChunkInfo& nfo)
{
if(nfo.version > 8) {
return UnsupportedChunk_Binary(reader,nfo,"PolH");
}
const chunk_guard cn(nfo,reader);
out.nodes.push_back(std::shared_ptr<Mesh>(new Mesh()));
Mesh& msh = (Mesh&)(*out.nodes.back().get());
msh = nfo;
ReadBasicNodeInfo_Binary(msh,reader,nfo);
msh.vertex_positions.resize(reader.GetI4());
for(aiVector3D& v : msh.vertex_positions) {
v.x = reader.GetF4();
v.y = reader.GetF4();
v.z = reader.GetF4();
}
msh.texture_coords.resize(reader.GetI4());
for(aiVector2D& v : msh.texture_coords) {
v.x = reader.GetF4();
v.y = reader.GetF4();
}
const size_t numf = reader.GetI4();
msh.faces.reserve(numf);
for(size_t i = 0; i < numf; ++i) {
// XXX backface culling flag is 0x10 in flags
// hole?
bool hole;
if ((hole = (reader.GetI1() & 0x08) != 0)) {
// XXX Basically this should just work fine - then triangulator
// should output properly triangulated data even for polygons
// with holes. Test data specific to COB is needed to confirm it.
if (msh.faces.empty()) {
ThrowException(format("A hole is the first entity in the `PolH` chunk with id ") << nfo.id);
}
}
else msh.faces.push_back(Face());
Face& f = msh.faces.back();
const size_t num = reader.GetI2();
f.indices.reserve(f.indices.size() + num);
if(!hole) {
f.material = reader.GetI2();
f.flags = 0;
}
for(size_t x = 0; x < num; ++x) {
f.indices.push_back(VertexIndex());
VertexIndex& v = f.indices.back();
v.pos_idx = reader.GetI4();
v.uv_idx = reader.GetI4();
}
if(hole) {
std::reverse(f.indices.rbegin(),f.indices.rbegin()+num);
}
}
if (nfo.version>4) {
msh.draw_flags = reader.GetI4();
}
nfo.version>5 && nfo.version<8 ? reader.GetI4() : 0;
}