diff options
Diffstat (limited to 'indra/newview/llmaterialmgr.h')
-rw-r--r-- | indra/newview/llmaterialmgr.h | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index 9b3d7a0246..e317a791ad 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -47,10 +47,8 @@ public: const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id); boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb); -#if USE_TE_SPECIFIC_REGISTRATION typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr, U32 te)> get_callback_te_t; boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb); -#endif typedef boost::signals2::signal<void (const LLUUID&, const material_map_t&)> getall_callback_t; void getAll(const LLUUID& region_id); @@ -84,27 +82,34 @@ protected: typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t; get_callback_map_t mGetCallbacks; -#if USE_TE_SPECIFIC_REGISTRATION // struct for TE-specific material ID query - struct TEMaterialPair + class TEMaterialPair { + public: + U32 te; LLMaterialID materialID; - }; - // needed for std::map compliance only - // + bool operator==(const TEMaterialPair& b) const { return (materialID == b.materialID) && (te == b.te); } + }; + friend inline bool operator<( - const struct LLMaterialMgr::TEMaterialPair& lhs, - const struct LLMaterialMgr::TEMaterialPair& rhs) + const LLMaterialMgr::TEMaterialPair& lhs, + const LLMaterialMgr::TEMaterialPair& rhs) { - return (lhs.materialID < rhs.materialID) ? TRUE : - (lhs.te < rhs.te) ? TRUE : FALSE; + return (lhs.te < rhs.te) ? TRUE : + (lhs.materialID < rhs.materialID); } - typedef std::map<TEMaterialPair, get_callback_te_t*> get_callback_te_map_t; + struct TEMaterialPairHasher + { + enum { bucket_size = 8 }; + size_t operator()(const TEMaterialPair& key_value) const { return *((size_t*)key_value.materialID.get()); } // cheesy, but effective + bool operator()(const TEMaterialPair& left, const TEMaterialPair& right) const { return left < right; } + }; + + typedef boost::unordered_map<TEMaterialPair, get_callback_te_t*, TEMaterialPairHasher> get_callback_te_map_t; get_callback_te_map_t mGetTECallbacks; -#endif typedef std::set<LLUUID> getall_queue_t; getall_queue_t mGetAllQueue; |