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


C++ FileStream::GetPosition方法代码示例

本文整理汇总了C++中FileStream::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ FileStream::GetPosition方法的具体用法?C++ FileStream::GetPosition怎么用?C++ FileStream::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileStream的用法示例。


在下文中一共展示了FileStream::GetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ImportSkl


//.........这里部分代码省略.........

		// Version two contains bone IDs.
		if (mLOLSkeleton.Version == 2)
		{
			uint32_t numBoneIDs = stream.ReadUInt();
			for (uint32_t i = 0; i < numBoneIDs; ++i)
				mLOLSkeleton.BoneIDs.push_back(stream.ReadUInt());
		}
	}
	else if (mLOLSkeleton.Version == 0)
	{
		uint16_t zero = stream.ReadUShort();
		uint16_t numBones = stream.ReadUShort();
		uint32_t numBoneIDs = stream.ReadUInt();
		uint16_t offsetToVertexData = stream.ReadUShort(); // Should be 64.

		int unknown = stream.ReadShort(); // ?

		int offset1 = stream.ReadInt();
		int offsetToAnimationIndices = stream.ReadInt();
		int offset2 = stream.ReadInt();
		int offset3 = stream.ReadInt();
		int offsetToStrings = stream.ReadInt();

		// Not sure what this data represents.
		// I think it's padding incase more header data is required later.
		//stream.Seek(stream.GetPosition() + 20);

		mLOLSkeleton.Bones.resize(numBones);
		stream.Seek(offsetToVertexData);	
		for (int i = 0; i < numBones; ++i)
		{
			LOLBone& bone = mLOLSkeleton.Bones[i];

			// The old scale was always 0.1. For now, just go with it.
			bone.Scale = 0.1f;

			zero = stream.ReadShort(); // ?
			bone.Index = stream.ReadShort();
			bone.ParentIndex = stream.ReadShort();
			unknown = stream.ReadShort(); // ?

			int namehash = stream.ReadInt();
			float twoPointOne = stream.ReadFloat();

			stream.Read(&bone.Position, sizeof(float3));

			float one = stream.ReadFloat(); // ? Maybe scales for X, Y, and Z
			one = stream.ReadFloat();
			one = stream.ReadFloat();

			stream.Read(&bone.Orientation, sizeof(Quaternionf));

			float ctx = stream.ReadFloat(); // ctx
			float cty = stream.ReadFloat(); // cty
			float ctz = stream.ReadFloat(); // ctz

			// The rest of the bone data is unknown. Maybe padding?
			stream.Seek(stream.GetPosition() + 32);
		}

		stream.Seek(offset1);
		for (uint32_t i = 0; i < numBones; ++i) // Inds for version 4 animation.
		{
			// 8 bytes
			uint32_t sklID = stream.ReadUInt();
			uint32_t anmID = stream.ReadUInt();
			mLOLSkeleton.BoneIDMap[anmID] = sklID;
		}

		stream.Seek(offsetToAnimationIndices);
		for (uint32_t i = 0; i < numBoneIDs; ++i) // Inds for animation
		{
			// 2 bytes
			uint16_t boneID = stream.ReadUShort();
			mLOLSkeleton.BoneIDs.push_back(boneID);
		}

		stream.Seek(offsetToStrings);
		char nameBuffer[4];
		for (int i = 0; i < numBones; ++i)
		{
			bool finished = false;
			do 
			{
				stream.Read(nameBuffer, 4);
				for (char c : nameBuffer)
				{
					if (c == '\0')
					{
						finished = true;
						break;
					}
					
					mLOLSkeleton.Bones[i].Name.push_back(c);
				}
			} while (!finished);		
		}
	}
}
开发者ID:hustruan,项目名称:RcEngine,代码行数:101,代码来源:LOLExporter.cpp


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