Game Development Reference
In-Depth Information
through the bones in the order in which they were allocated by using the
next member variable. We first read the next line and create a character
pointer to this line. The CBone class contains a member function SetKey
that takes the current frame and the character pointer as parameters. It
returns the position of the character pointer after the appropriate number
of channel values for the current bone have been read from the file. If the
returned pointer is NULL then the current bones are cleared and the
function returns. At this stage we have loaded all the data from the file and
it can be closed.
void CBVHViewerDoc::OnFileOpen()
//Initialise an open file dialog box
CFileDialog dlg(TRUE, ”bvh”, NULL, OFN_HIDEREADONLY |
”Biovision Hierarchy Files (*.bvh)|*.bvh|All Files
CString str = AfxGetApp()->GetProfileString(”Settings”,
dlg.m_ofn.lpstrInitialDir = str;
dlg.m_ofn.lpstrTitle=”Load a Biovision file”;
if (dlg.DoModal()==IDCANCEL) return;
int pos;
//Clear any existing animation
frames = 0;
CStdioFile file(dlg.GetPathName(), CFile::modeRead);
//Recursively load the file
if (LoadBVHHierarchy(NULL, file, 0)){
//Store new path
str = dlg.GetPathName();
pos = str.ReverseFind('\\');
if (pos!=-1) str=str.Left(pos);
Search Nedrilad ::

Custom Search