diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-09-01 18:35:23 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-09-04 21:58:53 +0800 |
| commit | 00bb3bb6f07660bd914d29a1389342bb3060d254 (patch) | |
| tree | 431f574922494d2201718f13085f17bc6bd7fb42 /indra/llprimitive | |
| parent | a8636720129952c10cf49ab80da21bf8b340b96c (diff) | |
| parent | 4ef9f8f14b35ed388c294d53767a0dca0e890924 (diff) | |
Merge remote-tracking branch 'secondlife/release/26.4' into 26.4
Diffstat (limited to 'indra/llprimitive')
| -rw-r--r-- | indra/llprimitive/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | indra/llprimitive/lldaeloader.cpp | 2 | ||||
| -rw-r--r-- | indra/llprimitive/llmaterialid.cpp | 21 | ||||
| -rw-r--r-- | indra/llprimitive/llmaterialid.h | 5 | ||||
| -rw-r--r-- | indra/llprimitive/llmodel.h | 14 | ||||
| -rw-r--r-- | indra/llprimitive/llmodelloader.cpp | 2 | ||||
| -rw-r--r-- | indra/llprimitive/llprimitive.cpp | 12 | ||||
| -rw-r--r-- | indra/llprimitive/llprimitive.h | 3 | ||||
| -rw-r--r-- | indra/llprimitive/llprimlinkinfo.h | 393 | ||||
| -rw-r--r-- | indra/llprimitive/llprimtexturelist.cpp | 11 | ||||
| -rw-r--r-- | indra/llprimitive/llprimtexturelist.h | 2 | ||||
| -rw-r--r-- | indra/llprimitive/tests/llprimitive_test.cpp | 4 |
12 files changed, 35 insertions, 438 deletions
diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt index e8a0601852..cc87a20782 100644 --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -81,6 +81,10 @@ endif () include(LibraryInstall) +if (USE_PRECOMPILED_HEADERS) + target_precompile_headers(llprimitive REUSE_FROM llprecompiled) +endif () + #add unit tests if (LL_TESTS) INCLUDE(LLAddBuildTest) diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 81ebe631c5..71fc2b4fc0 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -1078,7 +1078,7 @@ bool LLDAELoader::OpenFile(const std::string& filename) LLModel* mdl = *i; if(mdl->getStatus() != LLModel::NO_ERRORS) { - setLoadState(ERROR_MODEL + mdl->getStatus()) ; + setLoadState(static_cast<U32>(ERROR_MODEL) + static_cast<U32>(mdl->getStatus())); return false; //abort } diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp index 4992b282f3..b417f095ca 100644 --- a/indra/llprimitive/llmaterialid.cpp +++ b/indra/llprimitive/llmaterialid.cpp @@ -56,20 +56,11 @@ LLMaterialID::LLMaterialID(const void* pMemory) set(pMemory); } -LLMaterialID::LLMaterialID(const LLMaterialID& pOtherMaterialID) -{ - copyFromOtherMaterialID(pOtherMaterialID); -} - LLMaterialID::LLMaterialID(const LLUUID& lluid) { set(lluid.mData); } -LLMaterialID::~LLMaterialID() -{ -} - bool LLMaterialID::operator == (const LLMaterialID& pOtherMaterialID) const { return (compareToOtherMaterialID(pOtherMaterialID) == 0); @@ -100,12 +91,6 @@ bool LLMaterialID::operator >= (const LLMaterialID& pOtherMaterialID) const return (compareToOtherMaterialID(pOtherMaterialID) >= 0); } -LLMaterialID& LLMaterialID::operator = (const LLMaterialID& pOtherMaterialID) -{ - copyFromOtherMaterialID(pOtherMaterialID); - return (*this); -} - bool LLMaterialID::isNull() const { return (compareToOtherMaterialID(LLMaterialID::null) == 0); @@ -168,18 +153,12 @@ std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id) return s; } - void LLMaterialID::parseFromBinary (const LLSD::Binary& pMaterialID) { llassert(pMaterialID.size() == (MATERIAL_ID_SIZE * sizeof(U8))); memcpy(mID, &pMaterialID[0], MATERIAL_ID_SIZE * sizeof(U8)); } -void LLMaterialID::copyFromOtherMaterialID(const LLMaterialID& pOtherMaterialID) -{ - memcpy(mID, pOtherMaterialID.get(), MATERIAL_ID_SIZE * sizeof(U8)); -} - int LLMaterialID::compareToOtherMaterialID(const LLMaterialID& pOtherMaterialID) const { int retVal = 0; diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h index 41dd5a8710..3ed80eaab9 100644 --- a/indra/llprimitive/llmaterialid.h +++ b/indra/llprimitive/llmaterialid.h @@ -39,9 +39,7 @@ public: LLMaterialID(const LLSD& pMaterialID); LLMaterialID(const LLSD::Binary& pMaterialID); LLMaterialID(const void* pMemory); - LLMaterialID(const LLMaterialID& pOtherMaterialID); LLMaterialID(const LLUUID& lluid); - ~LLMaterialID(); bool operator == (const LLMaterialID& pOtherMaterialID) const; bool operator != (const LLMaterialID& pOtherMaterialID) const; @@ -51,8 +49,6 @@ public: bool operator > (const LLMaterialID& pOtherMaterialID) const; bool operator >= (const LLMaterialID& pOtherMaterialID) const; - LLMaterialID& operator = (const LLMaterialID& pOtherMaterialID); - bool isNull() const; const U8* get() const; @@ -73,7 +69,6 @@ private: friend size_t hash_value(const LLMaterialID&) noexcept; void parseFromBinary(const LLSD::Binary& pMaterialID); - void copyFromOtherMaterialID(const LLMaterialID& pOtherMaterialID); int compareToOtherMaterialID(const LLMaterialID& pOtherMaterialID) const; U8 mID[MATERIAL_ID_SIZE]; diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 854c77e63a..efe20f1bb4 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -33,8 +33,6 @@ #include "m4math.h" #include <queue> -#include <boost/align/aligned_allocator.hpp> - #if 0 class daeElement; class domMesh; @@ -42,8 +40,7 @@ class domMesh; #define MAX_MODEL_FACES 8 -LL_ALIGN_PREFIX(16) -class LLMeshSkinInfo : public LLRefCount +class alignas(16) LLMeshSkinInfo : public LLRefCount { LL_ALIGN_NEW public: @@ -67,17 +64,16 @@ public: // cached multiply of mBindShapeMatrix and mInvBindMatrix matrix_list_t mBindPoseMatrix; - LL_ALIGN_16(LLMatrix4a mBindShapeMatrix); + LLMatrix4a mBindShapeMatrix; float mPelvisOffset; bool mLockScaleIfJointPosition; bool mInvalidJointsScrubbed; bool mJointNumsInitialized; U64 mHash = 0; -} LL_ALIGN_POSTFIX(16); +}; -LL_ALIGN_PREFIX(16) -class LLModel : public LLVolume +class alignas(16) LLModel : public LLVolume { LL_ALIGN_NEW public: @@ -325,7 +321,7 @@ public: // A model/object can only have 8 faces, spillover faces will // be moved to new model/object and assigned a submodel id. int mSubmodelID; -} LL_ALIGN_POSTFIX(16); +}; typedef std::vector<LLPointer<LLModel> > model_list; typedef std::queue<LLPointer<LLModel> > model_queue; diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 6ff62bc282..41982c08a6 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -24,6 +24,8 @@ * $/LicenseInfo$ */ +#include "linden_common.h" + #include "llmodelloader.h" #include "llapp.h" diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index e74adc16b8..fd755e35dd 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -274,7 +274,7 @@ void LLPrimitive::setAllTETextures(const LLUUID &tex_id) //=============================================================== void LLPrimitive::setTE(const U8 index, const LLTextureEntry& te) { - if(mTextureList.copyTexture(index, &te) != TEM_CHANGE_NONE && te.getBumpmap() > 0) + if(mTextureList.copyTexture(index, te) != TEM_CHANGE_NONE && te.getBumpmap() > 0) { mNumBumpmapTEs++; } @@ -753,7 +753,7 @@ void LLPrimitive::copyTEs(const LLPrimitive *primitivep) } for (i = 0; i < num_tes; i++) { - mTextureList.copyTexture(i, primitivep->getTE(i)); + mTextureList.copyTexture(i, *(primitivep->getTE(i))); } } @@ -1370,6 +1370,12 @@ bool LLPrimitive::packTEMessage(LLDataPacker &dp) const S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec) { + return parseTEMessage(mesgsys, block_name, block_num, tec, getNumTEs()); +} + +// static +S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec, U8 face_count) +{ S32 retval = 0; // temp buffer for material ID processing // data will end up in tec.material_id[] @@ -1403,7 +1409,7 @@ S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name tec.packed_buffer[tec.size] = 0x00; ++tec.size; - tec.face_count = llmin((U32)getNumTEs(),(U32)LLTEContents::MAX_TES); + tec.face_count = llmin((U32)face_count,(U32)LLTEContents::MAX_TES); U8 *cur_ptr = tec.packed_buffer; LL_DEBUGS("TEXTUREENTRY") << "Texture Entry with buffere sized: " << tec.size << LL_ENDL; diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index c3e3e19ee9..21bf52610e 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -502,6 +502,9 @@ public: S32 unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num); // Variable num of blocks S32 unpackTEMessage(LLDataPacker &dp); S32 parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec); + // Same as above, but usable before an instance exists to derive the face count from + // (e.g. decoding a message for an object that hasn't been created yet). + static S32 parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec, U8 face_count); S32 applyParsedTEMessage(LLTEContents& tec); #ifdef CHECK_FOR_FINITE diff --git a/indra/llprimitive/llprimlinkinfo.h b/indra/llprimitive/llprimlinkinfo.h deleted file mode 100644 index 67e40fd5be..0000000000 --- a/indra/llprimitive/llprimlinkinfo.h +++ /dev/null @@ -1,393 +0,0 @@ -/** - * @file llprimlinkinfo.h - * @author andrew@lindenlab.com - * @brief A template for determining which prims in a set are linkable - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - -#ifndef LL_PRIM_LINK_INFO_H -#define LL_PRIM_LINK_INFO_H - -// system includes -#include <iostream> -#include <map> -#include <list> -#include <vector> - -// common includes -#include "stdtypes.h" -#include "v3math.h" -#include "llquaternion.h" -#include "llsphere.h" - - -const F32 MAX_OBJECT_SPAN = 54.f; // max distance from outside edge of an object to the farthest edge -const F32 OBJECT_SPAN_BONUS = 2.f; // infinitesimally small prims can always link up to this distance -const S32 MAX_PRIMS_PER_OBJECT = 256; - - -template < typename DATA_TYPE > -class LLPrimLinkInfo -{ -public: - LLPrimLinkInfo(); - LLPrimLinkInfo( DATA_TYPE data, const LLSphere& sphere ); - ~LLPrimLinkInfo(); - - void set( DATA_TYPE data, const LLSphere& sphere ); - void append( DATA_TYPE data, const LLSphere& sphere ); - void getData( std::list< DATA_TYPE >& data_list ) const; - F32 getDiameter() const; - LLVector3 getCenter() const; - - // returns 'true' if this info can link with other_info - bool canLink( const LLPrimLinkInfo< DATA_TYPE >& other_info ); - - S32 getPrimCount() const { return mDataMap.size(); } - - void mergeLinkableSet( typename std::list< LLPrimLinkInfo < DATA_TYPE > >& unlinked ); - - void transform(const LLVector3& position, const LLQuaternion& rotation); - -private: - // returns number of merges made - S32 merge(LLPrimLinkInfo< DATA_TYPE >& other_info); - - // returns number of collapses made - static S32 collapse(typename std::list< LLPrimLinkInfo < DATA_TYPE > >& unlinked ); - - void computeBoundingSphere(); - - // Internal utility to encapsulate the link rules - F32 get_max_linkable_span(const LLSphere& first, const LLSphere& second); - F32 get_span(const LLSphere& first, const LLSphere& second); - -private: - std::map< DATA_TYPE, LLSphere > mDataMap; - LLSphere mBoundingSphere; -}; - - - -template < typename DATA_TYPE > -LLPrimLinkInfo< DATA_TYPE >::LLPrimLinkInfo() -: mBoundingSphere( LLVector3(0.f, 0.f, 0.f), 0.f ) -{ -} - -template < typename DATA_TYPE > -LLPrimLinkInfo< DATA_TYPE >::LLPrimLinkInfo( DATA_TYPE data, const LLSphere& sphere) -: mBoundingSphere(sphere) -{ - mDataMap[data] = sphere; -} - -template < typename DATA_TYPE > -LLPrimLinkInfo< DATA_TYPE >::~LLPrimLinkInfo() -{ - mDataMap.clear(); -} - -template < typename DATA_TYPE > -void LLPrimLinkInfo< DATA_TYPE>::set( DATA_TYPE data, const LLSphere& sphere ) -{ - if (!mDataMap.empty()) - { - mDataMap.clear(); - } - mDataMap[data] = sphere; - mBoundingSphere = sphere; -} - -template < typename DATA_TYPE > -void LLPrimLinkInfo< DATA_TYPE>::append( DATA_TYPE data, const LLSphere& sphere ) -{ - mDataMap[data] = sphere; - if (!mBoundingSphere.contains(sphere)) - { - computeBoundingSphere(); - } -} - -template < typename DATA_TYPE > -void LLPrimLinkInfo< DATA_TYPE >::getData( std::list< DATA_TYPE >& data_list) const -{ - typename std::map< DATA_TYPE, LLSphere >::const_iterator map_itr; - for (map_itr = mDataMap.begin(); map_itr != mDataMap.end(); ++map_itr) - { - data_list.push_back(map_itr->first); - } -} - -template < typename DATA_TYPE > -F32 LLPrimLinkInfo< DATA_TYPE >::getDiameter() const -{ - return 2.f * mBoundingSphere.getRadius(); -} - -template < typename DATA_TYPE > -LLVector3 LLPrimLinkInfo< DATA_TYPE >::getCenter() const -{ - return mBoundingSphere.getCenter(); -} - -template < typename DATA_TYPE > -F32 LLPrimLinkInfo< DATA_TYPE >::get_max_linkable_span(const LLSphere& first, const LLSphere& second) -{ - F32 max_span = 3.f * (first.getRadius() + second.getRadius()) + OBJECT_SPAN_BONUS; - if (max_span > MAX_OBJECT_SPAN) - { - max_span = MAX_OBJECT_SPAN; - } - - return max_span; -} - -template < typename DATA_TYPE > -F32 LLPrimLinkInfo< DATA_TYPE >::get_span(const LLSphere& first, const LLSphere& second) -{ - F32 span = (first.getCenter() - second.getCenter()).length() - + first.getRadius() + second.getRadius(); - return span; -} - -// static -// returns 'true' if this info can link with any part of other_info -template < typename DATA_TYPE > -bool LLPrimLinkInfo< DATA_TYPE >::canLink(const LLPrimLinkInfo& other_info) -{ - F32 max_span = get_max_linkable_span(mBoundingSphere, other_info.mBoundingSphere); - - F32 span = get_span(mBoundingSphere, other_info.mBoundingSphere); - - if (span <= max_span) - { - // The entire other_info fits inside the max span. - return TRUE; - } - else if (span > max_span + 2.f * other_info.mBoundingSphere.getRadius()) - { - // there is no way any piece of other_info could link with this one - return FALSE; - } - - // there may be a piece of other_info that is linkable - typename std::map< DATA_TYPE, LLSphere >::const_iterator map_itr; - for (map_itr = other_info.mDataMap.begin(); map_itr != other_info.mDataMap.end(); ++map_itr) - { - const LLSphere& other_sphere = (*map_itr).second; - max_span = get_max_linkable_span(mBoundingSphere, other_sphere); - - span = get_span(mBoundingSphere, other_sphere); - - if (span <= max_span) - { - // found one piece that is linkable - return TRUE; - } - } - return FALSE; -} - -// merges elements of 'unlinked' -// returns number of links made (NOT final prim count, NOR linked prim count) -// and removes any linkable infos from 'unlinked' -template < typename DATA_TYPE > -void LLPrimLinkInfo< DATA_TYPE >::mergeLinkableSet(std::list< LLPrimLinkInfo< DATA_TYPE > > & unlinked) -{ - bool linked_something = true; - while (linked_something) - { - linked_something = false; - - typename std::list< LLPrimLinkInfo< DATA_TYPE > >::iterator other_itr = unlinked.begin(); - while ( other_itr != unlinked.end() - && getPrimCount() < MAX_PRIMS_PER_OBJECT ) - { - S32 merge_count = merge(*other_itr); - if (merge_count > 0) - { - linked_something = true; - } - if (0 == (*other_itr).getPrimCount()) - { - unlinked.erase(other_itr++); - } - else - { - ++other_itr; - } - } - if (!linked_something - && unlinked.size() > 1) - { - S32 collapse_count = collapse(unlinked); - if (collapse_count > 0) - { - linked_something = true; - } - } - } -} - -// transforms all of the spheres into a new reference frame -template < typename DATA_TYPE > -void LLPrimLinkInfo< DATA_TYPE >::transform(const LLVector3& position, const LLQuaternion& rotation) -{ - typename std::map< DATA_TYPE, LLSphere >::iterator map_itr; - for (map_itr = mDataMap.begin(); map_itr != mDataMap.end(); ++map_itr) - { - (*map_itr).second.setCenter((*map_itr).second.getCenter() * rotation + position); - } - mBoundingSphere.setCenter(mBoundingSphere.getCenter() * rotation + position); -} - -// private -// returns number of links made -template < typename DATA_TYPE > -S32 LLPrimLinkInfo< DATA_TYPE >::merge(LLPrimLinkInfo& other_info) -{ - S32 link_count = 0; - -// F32 other_radius = other_info.mBoundingSphere.getRadius(); -// other_info.computeBoundingSphere(); -// if ( other_radius != other_info.mBoundingSphere.getRadius() ) -// { -// LL_INFOS() << "Other bounding sphere changed!!" << LL_ENDL; -// } - -// F32 this_radius = mBoundingSphere.getRadius(); -// computeBoundingSphere(); -// if ( this_radius != mBoundingSphere.getRadius() ) -// { -// LL_INFOS() << "This bounding sphere changed!!" << LL_ENDL; -// } - - - F32 max_span = get_max_linkable_span(mBoundingSphere, other_info.mBoundingSphere); - - // F32 center_dist = (mBoundingSphere.getCenter() - other_info.mBoundingSphere.getCenter()).length(); - // LL_INFOS() << "objects are " << center_dist << "m apart" << LL_ENDL; - F32 span = get_span(mBoundingSphere, other_info.mBoundingSphere); - - F32 span_limit = max_span + (2.f * other_info.mBoundingSphere.getRadius()); - if (span > span_limit) - { - // there is no way any piece of other_info could link with this one - // LL_INFOS() << "span too large: " << span << " vs. " << span_limit << LL_ENDL; - return 0; - } - - bool completely_linkable = (span <= max_span) ? true : false; - - typename std::map< DATA_TYPE, LLSphere >::iterator map_itr = other_info.mDataMap.begin(); - while (map_itr != other_info.mDataMap.end() - && getPrimCount() < MAX_PRIMS_PER_OBJECT ) - { - DATA_TYPE other_data = (*map_itr).first; - LLSphere& other_sphere = (*map_itr).second; - - if (!completely_linkable) - { - max_span = get_max_linkable_span(mBoundingSphere, other_sphere); - - F32 span = get_span(mBoundingSphere, other_sphere); - - if (span > max_span) - { - ++map_itr; - continue; - } - } - - mDataMap[other_data] = other_sphere; - ++link_count; - - if (!mBoundingSphere.contains(other_sphere) ) - { - computeBoundingSphere(); - } - - // remove from the other info - other_info.mDataMap.erase(map_itr++); - } - - if (link_count > 0 && other_info.getPrimCount() > 0) - { - other_info.computeBoundingSphere(); - } - return link_count; -} - -// links any linkable elements of unlinked -template < typename DATA_TYPE > -S32 LLPrimLinkInfo< DATA_TYPE >::collapse(std::list< LLPrimLinkInfo< DATA_TYPE > > & unlinked) -{ - S32 link_count = 0; - bool linked_something = true; - while (linked_something) - { - linked_something = false; - - typename std::list< LLPrimLinkInfo< DATA_TYPE > >::iterator this_itr = unlinked.begin(); - typename std::list< LLPrimLinkInfo< DATA_TYPE > >::iterator other_itr = this_itr; - ++other_itr; - while ( other_itr != unlinked.end() ) - - { - S32 merge_count = (*this_itr).merge(*other_itr); - if (merge_count > 0) - { - linked_something = true; - link_count += merge_count; - } - if (0 == (*other_itr).getPrimCount()) - { - unlinked.erase(other_itr++); - } - else - { - ++other_itr; - } - } - } - return link_count; -} - - -template < typename DATA_TYPE > -void LLPrimLinkInfo< DATA_TYPE >::computeBoundingSphere() -{ - std::vector< LLSphere > sphere_list; - typename std::map< DATA_TYPE, LLSphere >::const_iterator map_itr; - for (map_itr = mDataMap.begin(); map_itr != mDataMap.end(); ++map_itr) - { - sphere_list.push_back(map_itr->second); - } - mBoundingSphere = LLSphere::getBoundingSphere(sphere_list); -} - - -#endif - diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp index 7f60d8025a..c70a8f6483 100644 --- a/indra/llprimitive/llprimtexturelist.cpp +++ b/indra/llprimitive/llprimtexturelist.cpp @@ -125,7 +125,7 @@ void LLPrimTextureList::take(LLPrimTextureList& other_list) // virtual // copies LLTextureEntry 'te' // returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE -S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry* te) +S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te) { if (size_t(index) >= mEntryList.size()) { @@ -137,7 +137,14 @@ S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry* te) // we're changing an existing entry llassert(mEntryList[index]); delete (mEntryList[index]); - mEntryList[index] = te->newCopy(); + if (te != LLTextureEntry::null) + { + mEntryList[index] = te.newCopy(); + } + else + { + mEntryList[index] = LLPrimTextureList::newTextureEntry(); + } return TEM_CHANGE_TEXTURE; } diff --git a/indra/llprimitive/llprimtexturelist.h b/indra/llprimitive/llprimtexturelist.h index b8bdad60b3..79744e9f08 100644 --- a/indra/llprimitive/llprimtexturelist.h +++ b/indra/llprimitive/llprimtexturelist.h @@ -71,7 +71,7 @@ public: // copies LLTextureEntry 'te' // returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE - S32 copyTexture(const U8 index, const LLTextureEntry* te); + S32 copyTexture(const U8 index, const LLTextureEntry& te); // takes ownership of LLTextureEntry* 'te' // returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE diff --git a/indra/llprimitive/tests/llprimitive_test.cpp b/indra/llprimitive/tests/llprimitive_test.cpp index 0213a3e8b6..75c3613ece 100644 --- a/indra/llprimitive/tests/llprimitive_test.cpp +++ b/indra/llprimitive/tests/llprimitive_test.cpp @@ -71,9 +71,7 @@ private: S32 mCurrDetailTest; }; -LLMaterialID::LLMaterialID() {} -LLMaterialID::LLMaterialID(LLMaterialID const &m) = default; -LLMaterialID::~LLMaterialID() {} +LLMaterialID::LLMaterialID() = default; void LLMaterialID::set(void const*) { } U8 const * LLMaterialID::get() const { return mID; } |
