Game Development Reference
In-Depth Information
CString braceline, line, name;
int filepos, strpos;
//If the function is called with a zero value for endpos then
//this value is set to the file length of bvhfile
if (!endpos) endpos = bvhfile.GetLength();
//The file is scanned to find the next ROOT or JOINT element
//If ROOT or JOINT is not found then the funciton returns FALSE
while(1){
if (!bvhfile.ReadString(line)) return FALSE;
filepos = bvhfile.GetPosition();
if (filepos > endpos) return TRUE;
strpos = line.Find(”ROOT”);
if (strpos!=-1){
name = line.Right(line.GetLength() - 5 - strpos);
break;
}
strpos = line.Find(”JOINT”);
if (strpos!=-1){
name = line.Right(line.GetLength() - 6 - strpos);
break;
}
}
//Add the new item
bone = bones.AddBone(name, parent);
if (!bone) return FALSE;
//Allow for finding end brace by storing current brace line and
//Altering the opening brace to a closing brace
bvhfile.ReadString(braceline);
strpos = braceline.Find('{');
if (strpos==-1) return FALSE;
braceline.SetAt(strpos, '}');
bone->SetOffset(bvhfile);
bone->SetChannels(bvhfile);
filepos = bvhfile.GetPosition();
Search Nedrilad ::




Custom Search