本文整理汇总了C++中std::filebuf::pubseekoff方法的典型用法代码示例。如果您正苦于以下问题:C++ filebuf::pubseekoff方法的具体用法?C++ filebuf::pubseekoff怎么用?C++ filebuf::pubseekoff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::filebuf
的用法示例。
在下文中一共展示了filebuf::pubseekoff方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nextChunk
static int nextChunk()
{
in.pubseekoff(chunk_end, std::ios_base::beg);
if (chunk_end == parent_end.back())
return 0;
unsigned short id;
int len;
in.sgetn((char*)&id, 2);
in.sgetn((char*)&len, 4);
chunk_end = (int)in.pubseekoff(0, std::ios_base::cur) + len - 6;
return id;
}
示例2: parseFile
static MeshModel* parseFile()
{
unsigned short id;
int len;
in.sgetn((char*)&id, 2);
in.sgetn((char*)&len, 4);
if (id != CHUNK_MAIN)
return 0;
chunk_end = (int)in.pubseekoff(0, std::ios_base::cur) + len - 6;
enterChunk();
MeshModel* root = new MeshModel();
while (int id = nextChunk()) {
switch (id) {
case CHUNK_SCENE:
parseScene(root);
break;
case CHUNK_KEYFRAMER:
parseKeyFramer(root);
break;
}
}
leaveChunk();
return root;
}
示例3: enterChunk
static void enterChunk()
{
parent_end.push_back(chunk_end);
chunk_end = (int)in.pubseekoff(0, std::ios_base::cur);
}
示例4: parseAnimKeys
static void parseAnimKeys(Animation* anim, int type)
{
int cnt = 0;
short t_flags;
in.sgetn((char*)&t_flags, 2);
in.pubseekoff(8, std::ios_base::cur);
in.sgetn((char*)&cnt, 2);
in.pubseekoff(2, std::ios_base::cur);
_log("ANIM_TRACK: frames=" + itoa(cnt));
Vector pos, axis, scale;
float angle;
Quat quat;
for (int k = 0; k < cnt; ++k) {
int time;
short flags;
in.sgetn((char*)&time, 4);
in.sgetn((char*)&flags, 2);
float tens = 0, cont = 0, bias = 0, ease_to = 0, ease_from = 0;
if (flags & 1)
in.sgetn((char*)&tens, 4);
if (flags & 2)
in.sgetn((char*)&cont, 4);
if (flags & 4)
in.sgetn((char*)&bias, 4);
if (flags & 8)
in.sgetn((char*)&ease_to, 4);
if (flags & 16)
in.sgetn((char*)&ease_from, 4);
switch (type) {
case 0xb020: //POS_TRACK_TAG
in.sgetn((char*)&pos, 12);
if (conv)
pos = conv_tform * pos;
// _log( "POS_KEY: time="+itoa(time)+" pos="+ftoa( pos.x )+","+ftoa( pos.y )+","+ftoa( pos.z ) );
if (time <= anim_len)
anim->setPositionKey(time, pos);
break;
case 0xb021: //ROT_TRACK_TAG
in.sgetn((char*)&angle, 4);
in.sgetn((char*)&axis, 12);
// _log( "ROT_KEY: time="+itoa(time)+" angle="+ftoa(angle)+" axis="+ftoa(axis.x)+","+ftoa(axis.y)+","+ftoa(axis.z) );
if (axis.length() > FLT_EPSILON) {
if (flip_tris)
angle = -angle;
if (conv)
axis = conv_tform.m * axis;
quat = Quat(cosf(angle / 2), axis.normalized() * sinf(angle / 2)) * quat;
quat.normalize();
}
if (time <= anim_len)
anim->setRotationKey(time, quat);
break;
case 0xb022: //SCL_TRACK_TAG
in.sgetn((char*)&scale, 12);
if (conv)
scale = conv_tform.m * scale;
// scale.x=fabs(scale.x);scale.y=fabs(scale.y);scale.z=fabs(scale.z);
_log("SCL_KEY: time=" + itoa(time) + " scale=" + ftoa(scale.x) + "," + ftoa(scale.y) + "," + ftoa(scale.z));
if (time <= anim_len)
anim->setScaleKey(time, scale);
break;
}
}
}