Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

meshmanager.h

Go to the documentation of this file.
00001 // meshmanager.h
00002 //
00003 // Copyright (C) 2001 Chris Laurel <claurel@shatters.net>
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 #ifndef _CELENGINE_MODELMANAGER_H_
00011 #define _CELENGINE_MODELMANAGER_H_
00012 
00013 #include <string>
00014 #include <map>
00015 #include <celutil/resmanager.h>
00016 #include <celengine/model.h>
00017 
00018 
00019 class ModelInfo : public ResourceInfo<Model>
00020 {
00021  public:
00022     std::string source;
00023     std::string path;
00024     bool resolvedToPath;
00025     Vec3f center;
00026 
00027     ModelInfo(const std::string _source,
00028               const std::string _path = "") :
00029         source(_source),
00030         path(_path),
00031         resolvedToPath(false),
00032         center(0.0, 0.0f, 0.0f)
00033         {};
00034 
00035     ModelInfo(const std::string _source,
00036               const std::string _path,
00037               const Vec3f& _center) :
00038         source(_source),
00039         path(_path),
00040         resolvedToPath(false),
00041         center(_center)
00042         {};
00043 
00044     virtual std::string resolve(const std::string&);
00045     virtual Model* load(const std::string&);
00046 };
00047 
00048 inline bool operator<(const ModelInfo& mi0, const ModelInfo& mi1)
00049 {
00050     if (mi0.source != mi1.source)
00051         return mi0.source < mi1.source;
00052     else if (mi0.path != mi1.path)
00053         return mi0.path < mi1.path;
00054     else if (mi0.center.x != mi1.center.x)
00055         return mi0.center.x < mi1.center.x;
00056     else if (mi0.center.y != mi1.center.y)
00057         return mi0.center.y < mi1.center.y;
00058     else
00059         return mi0.center.z < mi1.center.z;
00060 }
00061 
00062 typedef ResourceManager<ModelInfo> ModelManager;
00063 
00064 extern ModelManager* GetModelManager();
00065 
00066 #endif // _CELENGINE_MODELMANAGER_H_
00067 

Generated on Sat Jan 14 22:30:27 2006 for Celestia by  doxygen 1.4.1