summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2026-08-11 21:39:19 -0400
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2026-08-11 21:39:19 -0400
commit8cabc33e960ca93fdc1a32c77cf611269d95d51b (patch)
tree931fcecac10bf73214efa07cc3d704ba2bd01272 /indra/llprimitive
parent9b7ab49575b54523128952af6686d17eb6696725 (diff)
parentd045f9aa32789a35628aced166145c182751acbf (diff)
Merge remote-tracking branch 'origin/develop-linux' into geenz/linux-to-develop
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/CMakeLists.txt4
-rw-r--r--indra/llprimitive/lldaeloader.cpp2
-rw-r--r--indra/llprimitive/llmaterialid.cpp21
-rw-r--r--indra/llprimitive/llmaterialid.h5
-rw-r--r--indra/llprimitive/llmodel.h14
-rw-r--r--indra/llprimitive/llmodelloader.cpp2
-rw-r--r--indra/llprimitive/llprimlinkinfo.h393
-rw-r--r--indra/llprimitive/llprimtexturelist.cpp2
-rw-r--r--indra/llprimitive/tests/llprimitive_test.cpp4
9 files changed, 14 insertions, 433 deletions
diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt
index ff0cad58d6..f05be03034 100644
--- a/indra/llprimitive/CMakeLists.txt
+++ b/indra/llprimitive/CMakeLists.txt
@@ -79,6 +79,10 @@ else()
)
endif ()
+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 ac88af18f0..d624b6dc7a 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -33,15 +33,12 @@
#include "m4math.h"
#include <queue>
-#include <boost/align/aligned_allocator.hpp>
-
class daeElement;
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:
@@ -65,17 +62,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:
@@ -323,7 +319,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 0383659f62..bce5f6adce 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/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 68f3f5ffac..c70a8f6483 100644
--- a/indra/llprimitive/llprimtexturelist.cpp
+++ b/indra/llprimitive/llprimtexturelist.cpp
@@ -137,7 +137,7 @@ S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te)
// we're changing an existing entry
llassert(mEntryList[index]);
delete (mEntryList[index]);
- if (&te)
+ if (te != LLTextureEntry::null)
{
mEntryList[index] = te.newCopy();
}
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; }