00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "smartloader.h"
00024 #include "common/misc/progressmonitor.h"
00025 #include "common/misc/stringutils.h"
00026 #include "imeshbuilder.h"
00027
00028 #include "objloader.h"
00029 #include "aseloader.h"
00030 #include "triloader.h"
00031
00032 #include <cassert>
00033 #include <string>
00034
00035 using namespace sheep;
00036 using namespace std;
00037
00038 void SmartLoader::Load(const string &filename,
00039 IMeshBuilder &builder,
00040 int option_mask ,
00041 ProgressMonitor *progmon )
00042 {
00043 const string ext = StringUtils::GetExtension(filename);
00044
00045 if(!StringUtils::CompareNoCase(ext, "obj"))
00046 OBJLoader().Load(filename, builder, option_mask, progmon);
00047 else if(!StringUtils::CompareNoCase(ext, "ase"))
00048 ASELoader().Load(filename, builder, option_mask, progmon);
00049 else if(!StringUtils::CompareNoCase(ext, "tri"))
00050 TRILoader().Load(filename, builder, option_mask, progmon);
00051 else throw UnknownFileFormatException();
00052 }