const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id) { LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL; LLMaterialPtr material; material_map_t::const_iterator itMaterial = mMaterials.find(material_id); if (mMaterials.end() != itMaterial) { material = itMaterial->second; LL_DEBUGS("Materials") << " found material " << LL_ENDL; } else { if (!isGetPending(region_id, material_id)) { LL_DEBUGS("Materials") << " material pending " << material_id << LL_ENDL; get_queue_t::iterator itQueue = mGetQueue.find(region_id); if (mGetQueue.end() == itQueue) { LL_DEBUGS("Materials") << "mGetQueue add region " << region_id << " pending " << material_id << LL_ENDL; std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t())); itQueue = ret.first; } itQueue->second.insert(material_id); markGetPending(region_id, material_id); } LL_DEBUGS("Materials") << " returning empty material " << LL_ENDL; material = LLMaterialPtr(); } return material; }
LLMaterialPtr LLPrimTextureList::getMaterialParams(const U8 index) { if (index < mEntryList.size()) { return mEntryList[index]->getMaterialParams(); } return LLMaterialPtr(); }
LLMaterialMgr::LLMaterialMgr() { mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(LLMaterialID::null, LLMaterialPtr(NULL))); gIdleCallbacks.addFunction(&LLMaterialMgr::onIdle, NULL); LLWorld::instance().setRegionRemovedCallback(boost::bind(&LLMaterialMgr::onRegionRemoved, this, _1)); }