#include <meshmanager.h>
Inheritance diagram for ModelInfo:


Public Member Functions | |
| virtual Model * | load (const std::string &) |
| ModelInfo (const std::string _source, const std::string _path, const Vec3f &_center) | |
| ModelInfo (const std::string _source, const std::string _path="") | |
| virtual std::string | resolve (const std::string &) |
Public Attributes | |
| Vec3f | center |
| std::string | path |
| bool | resolvedToPath |
| std::string | source |
|
||||||||||||
|
Definition at line 27 of file meshmanager.h. References center, path, resolvedToPath, and source. 00028 : 00029 source(_source), 00030 path(_path), 00031 resolvedToPath(false), 00032 center(0.0, 0.0f, 0.0f) 00033 {};
|
|
||||||||||||||||
|
Definition at line 35 of file meshmanager.h. References center, path, resolvedToPath, and source. 00037 : 00038 source(_source), 00039 path(_path), 00040 resolvedToPath(false), 00041 center(_center) 00042 {};
|
|
|
Implements ResourceInfo< Model >. Definition at line 64 of file meshmanager.cpp. References _, center, Content_3DStudio, Content_CelestiaMesh, Content_CelestiaModel, Convert3DSModel(), DetermineFileType(), LoadCelestiaMesh(), LoadModel(), Model::normalize(), path, Read3DSFile(), resolvedToPath, and Model::sortMeshes(). 00065 {
00066 clog << _("Loading model: ") << filename << '\n';
00067 Model* model = NULL;
00068 ContentType fileType = DetermineFileType(filename);
00069
00070 if (fileType == Content_3DStudio)
00071 {
00072 M3DScene* scene = Read3DSFile(filename);
00073 if (scene != NULL)
00074 {
00075 if (resolvedToPath)
00076 model = Convert3DSModel(*scene, path);
00077 else
00078 model = Convert3DSModel(*scene, "");
00079 model->normalize(center);
00080
00081 delete scene;
00082 }
00083 }
00084 else if (fileType == Content_CelestiaModel)
00085 {
00086 ifstream in(filename.c_str(), ios::binary);
00087 if (in.good())
00088 {
00089 model = LoadModel(in, path);
00090 if (model != NULL)
00091 model->normalize(center);
00092 }
00093 }
00094 else if (fileType == Content_CelestiaMesh)
00095 {
00096 model = LoadCelestiaMesh(filename);
00097 }
00098
00099 if (model != NULL)
00100 {
00101 // Sort the submeshes roughly by opacity. This will eliminate a
00102 // good number of the errors caused when translucent triangles are
00103 // rendered before geometry that they cover.
00104 model->sortMeshes(Model::OpacityComparator(*model));
00105 }
00106 else
00107 {
00108 cerr << _("Error loading model '") << filename << "'\n";
00109 }
00110
00111 return model;
00112 }
|
|
|
Implements ResourceInfo< Model >. Definition at line 47 of file meshmanager.cpp. References path, resolvedToPath, and source. 00048 {
00049 if (!path.empty())
00050 {
00051 string filename = path + "/models/" + source;
00052 ifstream in(filename.c_str());
00053 if (in.good())
00054 {
00055 resolvedToPath = true;
00056 return filename;
00057 }
00058 }
00059
00060 return baseDir + "/" + source;
00061 }
|
|
|
Definition at line 25 of file meshmanager.h. Referenced by load(), and ModelInfo(). |
|
|
Definition at line 23 of file meshmanager.h. Referenced by load(), ModelInfo(), and resolve(). |
|
|
Definition at line 24 of file meshmanager.h. Referenced by load(), ModelInfo(), and resolve(). |
|
|
Definition at line 22 of file meshmanager.h. Referenced by ModelInfo(), and resolve(). |
1.4.1