diff options
Diffstat (limited to 'indra/llappearance')
-rw-r--r-- | indra/llappearance/llpolymorph.h | 10 | ||||
-rw-r--r-- | indra/llappearance/llpolyskeletaldistortion.h | 13 | ||||
-rw-r--r-- | indra/llappearance/lltexturemanagerbridge.h | 2 | ||||
-rwxr-xr-x | indra/llappearance/llwearable.cpp | 13 | ||||
-rwxr-xr-x | indra/llappearance/llwearable.h | 10 | ||||
-rwxr-xr-x | indra/llappearance/llwearabledata.cpp | 64 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llappearance/llwearabledata.h | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llappearance/llwearabletype.cpp | 9 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llappearance/llwearabletype.h | 4 |
9 files changed, 104 insertions, 35 deletions
diff --git a/indra/llappearance/llpolymorph.h b/indra/llappearance/llpolymorph.h index 7e712f9e94..3c2c68079c 100644 --- a/indra/llappearance/llpolymorph.h +++ b/indra/llappearance/llpolymorph.h @@ -182,6 +182,16 @@ public: void applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert); void addPendingMorphMask() { mNumMorphMasksPending++; } + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + protected: LLPolyMorphTarget(const LLPolyMorphTarget& pOther); diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h index ea2adb8a87..ab1a132d19 100644 --- a/indra/llappearance/llpolyskeletaldistortion.h +++ b/indra/llappearance/llpolyskeletaldistortion.h @@ -73,6 +73,19 @@ public: /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); + + + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + + protected: typedef std::vector<LLPolySkeletalBoneInfo> bone_info_list_t; bone_info_list_t mBoneInfoList; diff --git a/indra/llappearance/lltexturemanagerbridge.h b/indra/llappearance/lltexturemanagerbridge.h index 4b814b522d..101704b162 100644 --- a/indra/llappearance/lltexturemanagerbridge.h +++ b/indra/llappearance/lltexturemanagerbridge.h @@ -35,6 +35,8 @@ class LLTextureManagerBridge { public: + virtual ~LLTextureManagerBridge() {} + virtual LLPointer<LLGLTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) = 0; virtual LLPointer<LLGLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) = 0; virtual LLGLTexture* getFetchedTexture(const LLUUID &image_id) = 0; diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 4bce3f99ed..5ca9f55ac8 100755 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -86,10 +86,10 @@ LLAssetType::EType LLWearable::getAssetType() const return LLWearableType::getAssetType(mType); } -BOOL LLWearable::exportFile(LLFILE* fp) const +BOOL LLWearable::exportFile(const std::string& filename) const { - llofstream ofs(fp); - return exportStream(ofs); + llofstream ofs(filename.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); + return ofs.is_open() && exportStream(ofs); } // virtual @@ -201,10 +201,11 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp) } } -LLWearable::EImportResult LLWearable::importFile(LLFILE* fp, LLAvatarAppearance* avatarp ) +LLWearable::EImportResult LLWearable::importFile(const std::string& filename, + LLAvatarAppearance* avatarp ) { - llifstream ifs(fp); - return importStream(ifs, avatarp); + llifstream ifs(filename.c_str(), std::ios_base::in | std::ios_base::binary); + return (! ifs.is_open())? FAILURE : importStream(ifs, avatarp); } // virtual diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h index 406fc7e883..875c2932f1 100755 --- a/indra/llappearance/llwearable.h +++ b/indra/llappearance/llwearable.h @@ -81,8 +81,8 @@ public: SUCCESS, BAD_HEADER }; - BOOL exportFile(LLFILE* file) const; - EImportResult importFile(LLFILE* file, LLAvatarAppearance* avatarp ); + BOOL exportFile(const std::string& filename) const; + EImportResult importFile(const std::string& filename, LLAvatarAppearance* avatarp ); virtual BOOL exportStream( std::ostream& output_stream ) const; virtual EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp ); @@ -113,6 +113,9 @@ public: // Update the baked texture hash. virtual void addToBakedTextureHash(LLMD5& hash) const = 0; + typedef std::map<S32, LLVisualParam *> visual_param_index_map_t; + visual_param_index_map_t mVisualParamIndexMap; + protected: typedef std::map<S32, LLLocalTextureObject*> te_map_t; void syncImages(te_map_t &src, te_map_t &dst); @@ -132,9 +135,6 @@ protected: typedef std::map<S32, F32> param_map_t; param_map_t mSavedVisualParamMap; // last saved version of visual params - typedef std::map<S32, LLVisualParam *> visual_param_index_map_t; - visual_param_index_map_t mVisualParamIndexMap; - te_map_t mTEMap; // maps TE to LocalTextureObject te_map_t mSavedTEMap; // last saved version of TEMap }; diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp index cf1ee435a8..2bf3b9085b 100755 --- a/indra/llappearance/llwearabledata.cpp +++ b/indra/llappearance/llwearabledata.cpp @@ -92,7 +92,7 @@ void LLWearableData::setWearable(const LLWearableType::EType type, U32 index, LL } } -U32 LLWearableData::pushWearable(const LLWearableType::EType type, +void LLWearableData::pushWearable(const LLWearableType::EType type, LLWearable *wearable, bool trigger_updated /* = true */) { @@ -100,9 +100,8 @@ U32 LLWearableData::pushWearable(const LLWearableType::EType type, { // no null wearables please! LL_WARNS() << "Null wearable sent for type " << type << LL_ENDL; - return MAX_CLOTHING_PER_TYPE; } - if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) + if (canAddWearable(type)) { mWearableDatas[type].push_back(wearable); if (trigger_updated) @@ -110,9 +109,7 @@ U32 LLWearableData::pushWearable(const LLWearableType::EType type, const BOOL removed = FALSE; wearableUpdated(wearable, removed); } - return mWearableDatas[type].size()-1; } - return MAX_CLOTHING_PER_TYPE; } // virtual @@ -125,7 +122,7 @@ void LLWearableData::wearableUpdated(LLWearable *wearable, BOOL removed) } } -void LLWearableData::popWearable(LLWearable *wearable) +void LLWearableData::eraseWearable(LLWearable *wearable) { if (wearable == NULL) { @@ -133,16 +130,16 @@ void LLWearableData::popWearable(LLWearable *wearable) return; } - U32 index = getWearableIndex(wearable); const LLWearableType::EType type = wearable->getType(); - if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type)) + U32 index; + if (getWearableIndex(wearable,index)) { - popWearable(type, index); + eraseWearable(type, index); } } -void LLWearableData::popWearable(const LLWearableType::EType type, U32 index) +void LLWearableData::eraseWearable(const LLWearableType::EType type, U32 index) { LLWearable *wearable = getWearable(type, index); if (wearable) @@ -173,8 +170,9 @@ bool LLWearableData::swapWearables(const LLWearableType::EType type, U32 index_a } wearableentry_vec_t& wearable_vec = wearable_iter->second; - if (0 > index_a || index_a >= wearable_vec.size()) return false; - if (0 > index_b || index_b >= wearable_vec.size()) return false; + // removed 0 > index_a and index_b comparisions - can never be true + if (index_a >= wearable_vec.size()) return false; + if (index_b >= wearable_vec.size()) return false; LLWearable* wearable = wearable_vec[index_a]; wearable_vec[index_a] = wearable_vec[index_b]; @@ -203,11 +201,11 @@ void LLWearableData::pullCrossWearableValues(const LLWearableType::EType type) } -U32 LLWearableData::getWearableIndex(const LLWearable *wearable) const +BOOL LLWearableData::getWearableIndex(const LLWearable *wearable, U32& index_found) const { if (wearable == NULL) { - return MAX_CLOTHING_PER_TYPE; + return FALSE; } const LLWearableType::EType type = wearable->getType(); @@ -215,18 +213,50 @@ U32 LLWearableData::getWearableIndex(const LLWearable *wearable) const if (wearable_iter == mWearableDatas.end()) { LL_WARNS() << "tried to get wearable index with an invalid type!" << LL_ENDL; - return MAX_CLOTHING_PER_TYPE; + return FALSE; } const wearableentry_vec_t& wearable_vec = wearable_iter->second; for(U32 index = 0; index < wearable_vec.size(); index++) { if (wearable_vec[index] == wearable) { - return index; + index_found = index; + return TRUE; } } - return MAX_CLOTHING_PER_TYPE; + return FALSE; +} + +U32 LLWearableData::getClothingLayerCount() const +{ + U32 count = 0; + for (S32 i = 0; i < LLWearableType::WT_COUNT; i++) + { + LLWearableType::EType type = (LLWearableType::EType)i; + if (LLWearableType::getAssetType(type)==LLAssetType::AT_CLOTHING) + { + count += getWearableCount(type); + } + } + return count; +} + +BOOL LLWearableData::canAddWearable(const LLWearableType::EType type) const +{ + LLAssetType::EType a_type = LLWearableType::getAssetType(type); + if (a_type==LLAssetType::AT_CLOTHING) + { + return (getClothingLayerCount() < MAX_CLOTHING_LAYERS); + } + else if (a_type==LLAssetType::AT_BODYPART) + { + return (getWearableCount(type) < 1); + } + else + { + return FALSE; + } } BOOL LLWearableData::isOnTop(LLWearable* wearable) const diff --git a/indra/llappearance/llwearabledata.h b/indra/llappearance/llwearabledata.h index 03bd179f25..a0c446ea9e 100644..100755 --- a/indra/llappearance/llwearabledata.h +++ b/indra/llappearance/llwearabledata.h @@ -60,11 +60,13 @@ public: const LLWearable* getBottomWearable(const LLWearableType::EType type) const; U32 getWearableCount(const LLWearableType::EType type) const; U32 getWearableCount(const U32 tex_index) const; - U32 getWearableIndex(const LLWearable *wearable) const; + BOOL getWearableIndex(const LLWearable *wearable, U32& index) const; + U32 getClothingLayerCount() const; + BOOL canAddWearable(const LLWearableType::EType type) const; BOOL isOnTop(LLWearable* wearable) const; - - static const U32 MAX_CLOTHING_PER_TYPE = 5; + + static const U32 MAX_CLOTHING_LAYERS = 60; //-------------------------------------------------------------------- // Setters @@ -72,11 +74,11 @@ public: protected: // Low-level data structure setter - public access is via setWearableItem, etc. void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable); - U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable, + void pushWearable(const LLWearableType::EType type, LLWearable *wearable, bool trigger_updated = true); virtual void wearableUpdated(LLWearable *wearable, BOOL removed); - void popWearable(LLWearable *wearable); - void popWearable(const LLWearableType::EType type, U32 index); + void eraseWearable(LLWearable *wearable); + void eraseWearable(const LLWearableType::EType type, U32 index); void clearWearableType(const LLWearableType::EType type); bool swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b); diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp index 618e2a1941..87109a5906 100644..100755 --- a/indra/llappearance/llwearabletype.cpp +++ b/indra/llappearance/llwearabletype.cpp @@ -27,6 +27,7 @@ #include "linden_common.h" #include "llwearabletype.h" #include "llinventorytype.h" +#include "llinventorydefines.h" static LLTranslationBridge* sTrans = NULL; @@ -160,7 +161,7 @@ BOOL LLWearableType::getDisableCameraSwitch(LLWearableType::EType type) return entry->mDisableCameraSwitch; } -// static +// static BOOL LLWearableType::getAllowMultiwear(LLWearableType::EType type) { const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); @@ -169,3 +170,9 @@ BOOL LLWearableType::getAllowMultiwear(LLWearableType::EType type) return entry->mAllowMultiwear; } +// static +LLWearableType::EType LLWearableType::inventoryFlagsToWearableType(U32 flags) +{ + return (LLWearableType::EType)(flags & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK); +} + diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h index e51e6731d3..519d5b92a2 100644..100755 --- a/indra/llappearance/llwearabletype.h +++ b/indra/llappearance/llwearabletype.h @@ -35,6 +35,9 @@ class LLTranslationBridge { public: + // clang needs this to be happy + virtual ~LLTranslationBridge() {} + virtual std::string getString(const std::string &xml_desc) = 0; }; @@ -77,6 +80,7 @@ public: static LLInventoryType::EIconName getIconName(EType type); static BOOL getDisableCameraSwitch(EType type); static BOOL getAllowMultiwear(EType type); + static EType inventoryFlagsToWearableType(U32 flags); protected: LLWearableType() {} |