2 #define _MODELMANAGER 1
11 #include <osg/ShadeModel>
12 #include <osg/CullFace>
13 #include <osg/StateSet>
15 #include <osgDB/Registry>
16 #include <osgDB/ReadFile>
17 #include <osgUtil/Optimizer>
19 #include <osgCal/CoreModel>
20 #include <osgCal/Model>
23 using namespace vrecko;
24 using namespace ArtificialWorld;
40 void RemoveReference()
48 osg::ref_ptr<EnvironmentObject>
geometry;
67 void RemoveReference()
75 osg::ref_ptr<osgCal::CoreModel> coreModel;
86 virtual void DeleteUpdate(osg::ref_ptr<EnvironmentObject> deletingObject,
int num,
ModelType modelType) = 0;
95 virtual void GetUpdate(
string modelFilename,
int num,
ModelType modelType) = 0;
104 virtual void AddUpdate(
string modelFilename,
ModelType modelType) = 0;
113 static vector<DeleteObserver*> delObservers;
114 static vector<GetObserver*> getObservers;
115 static vector<AddObserver*> addObservers;
119 static osg::ref_ptr<EnvironmentObject> GetModelGeometry(
string modelFilename);
121 static void DeleteModelGeometry(osg::ref_ptr<EnvironmentObject> *ptr);
124 static bool ContainsModelGeometry(
string modelFilename);
126 static bool ContainsAnimatedModelGeometry(
string modelFilename);
128 static bool ContainsModelGeometry(
string modelFilename,
ModelType modelType);
131 static osg::ref_ptr<EnvironmentObject> GetAnimatedModelGeometry(
string modelFilename,
int animationIndex,
bool startAnimation);
133 static void DeleteAnimatedModelGeometry(osg::ref_ptr<EnvironmentObject> *ptr);
135 static void DeleteModelGeometry(osg::ref_ptr<EnvironmentObject> *ptr,
ModelType modelType);
138 static void AddModelGeometry(
string modelFilename, osg::ref_ptr<EnvironmentObject> newGeometry);
143 static void AddGetObserver(
GetObserver* newObserver);
145 static void AddAddObserver(
AddObserver *newObserver);
149 static void RemoveGetObserver(
GetObserver* observer);
151 static void RemoveAddObserver(
AddObserver *observer);
156 static map<string, GeometryState> geoms;
158 static map<string, AnimatedGeometryState> animGeoms;
161 static void DeleteNotify(osg::ref_ptr<EnvironmentObject> deletingObject,
int remaining_count,
ModelType modelType);
162 static void GetNotify(
string modelFilename,
int existing_count,
ModelType modelType);
163 static void AddNotify(
string modelFilename,
ModelType modelType);
168 static bool SubLoadAnimatedGeometry(osgCal::CoreModel &coreModel, std::string &modelFilename, osgCal::MeshParameters &meshParameters);