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


C++ filebuf::pubseekoff方法代码示例

本文整理汇总了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;
}
开发者ID:Xaymar,项目名称:BlitzNext,代码行数:12,代码来源:loader_3ds.cpp

示例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;
}
开发者ID:Xaymar,项目名称:BlitzNext,代码行数:25,代码来源:loader_3ds.cpp

示例3: enterChunk

static void enterChunk()
{
	parent_end.push_back(chunk_end);
	chunk_end = (int)in.pubseekoff(0, std::ios_base::cur);
}
开发者ID:Xaymar,项目名称:BlitzNext,代码行数:5,代码来源:loader_3ds.cpp

示例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;
		}
	}
}
开发者ID:Xaymar,项目名称:BlitzNext,代码行数:64,代码来源:loader_3ds.cpp


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