コード例 #1
0
void OLMeshTracker::DoReload(Ogre::MeshPtr meshP) {
	if (!m_shouldQueueMeshOperations) {
		ReloadMeshQm* rmq = new ReloadMeshQm(10, meshP);
		rmq->Process();
		delete(rmq);
		return;
	}
	LGLOCK_ALOCK trackerLock;
	meshP->unload();	// DEBUG
	trackerLock.Lock(MeshTrackerLock);
	// check to see if in unloaded list, if so, remove it and claim success
	Ogre::String meshName = meshP->getName();
	GenericQm* reloadEntry = m_meshesToLoad->Find(meshName);
	if (reloadEntry != NULL) {
		// if already being loaded, we're done
		LG::Log("OLMeshTracker::DoReload: asked to reload but already loading: %s", meshName.c_str());
		trackerLock.Unlock();
		return;
	}
	// add this to the loading list
	LG::Log("OLMeshTracker::DoReload: queuing reloading: %s", meshName.c_str());
	ReloadMeshQm* rmq = new ReloadMeshQm(10, meshP);
	m_meshesToLoad->AddLast(rmq);
	trackerLock.Unlock();
	LGLOCK_NOTIFY_ALL(MeshTrackerLock);
	/*	OLD CODE
	// for the moment, don't do anything fancy
	if (meshP->isLoaded()) {
		meshP->reload();
	}
	UpdateSceneNodesForMesh(meshP);
	// do we need to call update on all scene nodes that use this mesh?
	*/
}
コード例 #2
0
// Call for an unload when list is already locked
void OLMeshTracker::MakeUnLoadedLocked(Ogre::String meshName, Ogre::String stringParam, Ogre::Entity* entityParam) {
	// see if in the loading list. Remove if  there.
	GenericQm* loadEntry = m_meshesToLoad->Find(meshName);
	if (loadEntry != NULL) {
		loadEntry->Abort();
		m_meshesToLoad->Remove(meshName);
	}
	// see if in the serialize list. Mark for unload if it's there
	GenericQm* serialEntry = m_meshesToSerialize->Find(meshName);
	if (serialEntry != NULL) {
		serialEntry->stringParam = "unload";
	}
	else {
		Ogre::MeshPtr meshP = Ogre::MeshManager::getSingleton().getByName(meshName);
		if (!meshP.isNull()) {
			if (meshP.useCount() == 1) {
				meshP->unload();
			}
			else {
				LG::Log("OLMeshTracker::MakeUnLoaded: Didn't unload mesh because count = %d", meshP.useCount());
			}
		}
	}
}