25 #include "glm/gtc/type_ptr.hpp" 87 for (ModelList::iterator m =
_models.begin();
90 m->model->flushNodeBuffers();
98 while (!
_killThread.load(boost::memory_order_relaxed)) {
124 for (ModelList::iterator m =
_models.begin();
145 if (m->lastChanged > 0)
146 dt = (now - m->lastChanged) / 1000.f;
147 m->lastChanged = now;
149 m->model->manageAnimations(dt);
159 for (ModelList::iterator m =
_models.begin(); m !=
_models.end(); ++m) {
160 if (m->model == model)
167 ModelList::iterator m;
169 if (m->model == model)
177 const float *campos =
CameraMan.getPosition();
182 float dist = glm::distance(glm::make_vec3(campos), glm::vec3(x, y, z));
183 return roundf(dist) / 8;
void getPosition(float &x, float &y, float &z) const
Get the current position of the model.
void unregisterModelInternal(Model *model)
boost::atomic< bool > _killThread
bool lock(uint32 timeout=0)
boost::atomic< bool > _flushing
boost::atomic< bool > _paused
void unregisterModel(Model *model)
Remove a model from the processing pool.
Threading system helpers.
The global events manager.
void registerModel(Model *model)
Add a model to the processing pool.
void flush()
Apply changes to position and geometry of all models in the processing pool.
#define EventMan
Shortcut for accessing the events manager.
ModelQueue _registerQueue
uint8 getNumIterationsToSkip(Model *model) const
#define CameraMan
Shortcut for accessing the camera manager.
Common::Semaphore _modelsSem
Semaphore protecting access to the model list.
Dedicated animation thread.
Common::Semaphore _registerSem
Semaphore protecting access to the registration queue.
void registerModelInternal(Model *model)