本文整理汇总了C++中CFileHandler::ReadString方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileHandler::ReadString方法的具体用法?C++ CFileHandler::ReadString怎么用?C++ CFileHandler::ReadString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileHandler
的用法示例。
在下文中一共展示了CFileHandler::ReadString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void CMD5Model::LoadModel( const std::string& a_Path, const std::string& a_SubFolder )
{
if ( CFile::FileExists( a_Path.c_str() ) == false )
{
CLog::GetInstance()->OutMessage( "Model file does not exist (%s)", CLog::MESSAGETYPE_ERROR, a_Path.c_str() );
}
m_SubFolder = a_SubFolder;
CFlatFile modelFile;
modelFile.Open( a_Path.c_str(), CFile::FILEMODE_READ, CFile::FILETYPE_PLAIN );
CFileHandler fileHandler;
fileHandler.LinkFile( &modelFile );
std::string data;
std::string dataTwo;
Uint position = modelFile.GetPosition();
data = fileHandler.ReadString();
while ( ( position = modelFile.GetPosition() ) < modelFile.GetSize() )
{
if ( data == "MD5Version" )
{
dataTwo = fileHandler.ReadString();
Int versionNumber = atoi( dataTwo.c_str() );
assert( versionNumber == 10 && "Incorrect version number in MD5file" );
}
else if ( data == "commandline" )
{
//We don't need this so skip
dataTwo = fileHandler.ReadString();
}
else if ( data == "numJoints" )
{
dataTwo = fileHandler.ReadString();
m_JointCount = atoi( dataTwo.c_str() );
}
else if ( data == "numMeshes" )
{
dataTwo = fileHandler.ReadString();
m_MeshCount = atoi( dataTwo.c_str() );
}
else if ( data == "joints" )
{
//Read out all the joint
SJoint joint;
data = fileHandler.ReadString();
data = fileHandler.ReadString();
for ( Uint i = 0; i < m_JointCount; ++i )
{
joint.m_Name = fileHandler.ReadString();
joint.m_Name.pop_back();
joint.m_Name.erase( joint.m_Name.begin() );
data = fileHandler.ReadString();
joint.m_ParentID = atoi( data.c_str() );
data = fileHandler.ReadString();
for ( Uint j = 0; j < 3; ++j )
{
data = fileHandler.ReadString();
joint.m_Position.Cell[j] = (Float)atof( data.c_str() );
}
data = fileHandler.ReadString();
data = fileHandler.ReadString();
for ( Uint j = 0; j < 3; ++j )
{
data = fileHandler.ReadString();
joint.m_Orientation.Cell[j] = (Float)atof( data.c_str() );
}
joint.m_Orientation.ComputeW();
data = fileHandler.ReadString();
data = fileHandler.ReadString();
m_Joints.push_back( joint );
}
//}
data = fileHandler.ReadString();
}
else if ( data == "mesh" )
{
//Read the mesh
SMesh* mesh = LoadMesh( fileHandler );
//Prepare the mesh and generate normals
PrepareMesh( mesh );
PrepareNormals( mesh );
//Generate rendering buffers
CreateBuffers( mesh );
CreateVAO( mesh );
m_Meshes.push_back( mesh );
}
data = fileHandler.ReadString();
}
}