SharedResourcePtr GraphicsResourceManager::getResourceEntity(const SpaceObjectReference &id, GraphicsEntity *graphicsEntity) { WeakResourcePtr curWeakPtr = getResource(id.toString()); SharedResourcePtr curSharedPtr = curWeakPtr.lock(); if (curSharedPtr) return curSharedPtr; else { curSharedPtr = GraphicsResource::construct<GraphicsResourceEntity>(id, graphicsEntity); mIDResourceMap[id.toString()] = curSharedPtr; mEntities.insert(curSharedPtr.get()); return curSharedPtr; } }
std::string CameraEntity::ogreCameraName(const SpaceObjectReference&ref) { return "Camera:"+ref.toString(); }
void ObjectHost::registerHostedObject(const SpaceObjectReference &sporef_uuid, const HostedObjectPtr& obj) { HostedObjectMap::iterator iter = mHostedObjects.find(sporef_uuid); if (iter != mHostedObjects.end()) { SILOG(oh,error,"Two objects having the same internal name in the mHostedObjects map on connect"<<sporef_uuid.toString()); } mHostedObjects[sporef_uuid]=obj; }
void ObjectHost::unregisterHostedObject(const SpaceObjectReference& sporef_uuid, HostedObject* key_obj) { HostedObjectMap::iterator iter = mHostedObjects.find(sporef_uuid); if (iter != mHostedObjects.end()) { HostedObjectPtr obj (iter->second); // The NULL case covers the possibility that the connection finishes // after the HostedObject requests destruction and stops paying // attention to connection events if (key_obj == NULL || obj.get()==key_obj) mHostedObjects.erase(iter); else SILOG(oh,error,"Two objects having the same internal name in the mHostedObjects map on disconnect "<<sporef_uuid.toString()); } }
std::string LightEntity::ogreLightName(const SpaceObjectReference&ref) { return "Light:"+ref.toString(); }