Adding support for Unicode input files to most text file loaders (BVH and MD5 missing for now).
IrrXML receives memmapped UTF-8 input data now, it's own (faulty) conversion is not used anymore. aiString's are explicitly UTF-8 now. Slight refactorings and improvements. Adding UTF-8/UTF-16 text files for ASE,obj,collada,ac3d. These contain various japanese/chinese character sequences. Changing assimp_view's node view to display UTF-8 multibyte sequences correctly. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@469 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
@@ -87,27 +87,20 @@ void PLYImporter::GetExtensionList(std::string& append)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
void PLYImporter::InternReadFile(
|
||||
const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
|
||||
void PLYImporter::InternReadFile( const std::string& pFile,
|
||||
aiScene* pScene, IOSystem* pIOHandler)
|
||||
{
|
||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if( file.get() == NULL)
|
||||
if( file.get() == NULL) {
|
||||
throw new ImportErrorException( "Failed to open PLY file " + pFile + ".");
|
||||
|
||||
// check whether the ply file is large enough to contain
|
||||
// at least the file header
|
||||
size_t fileSize = file->FileSize();
|
||||
if( fileSize < 10)
|
||||
throw new ImportErrorException( "PLY File is too small.");
|
||||
}
|
||||
|
||||
// allocate storage and copy the contents of the file to a memory buffer
|
||||
// (terminate it with zero)
|
||||
std::vector<unsigned char> mBuffer2(fileSize+1);
|
||||
file->Read( &mBuffer2[0], 1, fileSize);
|
||||
mBuffer = &mBuffer2[0];
|
||||
mBuffer[fileSize] = '\0';
|
||||
std::vector<char> mBuffer2;
|
||||
TextFileToBuffer(file.get(),mBuffer2);
|
||||
mBuffer = (unsigned char*)&mBuffer2[0];
|
||||
|
||||
// the beginning of the file must be PLY - magic, magic
|
||||
if (mBuffer[0] != 'P' && mBuffer[0] != 'p' ||
|
||||
|
||||
Reference in New Issue
Block a user