本文整理汇总了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);
}
}
}