summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/lldaeloader.cpp4
-rw-r--r--indra/llprimitive/llgltfloader.cpp2
-rw-r--r--indra/llprimitive/llmodel.cpp3
-rw-r--r--indra/llprimitive/llmodel.h29
-rw-r--r--indra/llprimitive/llprimitive.h9
-rw-r--r--indra/llprimitive/llvolumemessage.cpp8
-rw-r--r--indra/llprimitive/tests/llmediaentry_test.cpp2
7 files changed, 35 insertions, 22 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index cf7b40dc73..b3ae249951 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -53,8 +53,6 @@
#pragma warning (default : 4264)
#endif
-#include <boost/lexical_cast.hpp>
-
#include "lldaeloader.h"
#include "llsdserialize.h"
#include "lljoint.h"
@@ -2385,7 +2383,7 @@ std::string LLDAELoader::getElementLabel(daeElement *element)
if (ind > 0)
{
- index_string = "_" + boost::lexical_cast<std::string>(ind);
+ index_string = "_" + std::to_string(ind);
}
// if parent has a name or ID, use it
diff --git a/indra/llprimitive/llgltfloader.cpp b/indra/llprimitive/llgltfloader.cpp
index 7394f99794..8e498158d6 100644
--- a/indra/llprimitive/llgltfloader.cpp
+++ b/indra/llprimitive/llgltfloader.cpp
@@ -48,8 +48,6 @@
// TODO: includes inherited from dae loader. Validate / prune
-#include <boost/lexical_cast.hpp>
-
#include "llsdserialize.h"
#include "lljoint.h"
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index d7c17be779..c208e538fc 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -50,7 +50,7 @@ std::string model_names[] =
const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string);
-LLModel::LLModel(LLVolumeParams& params, F32 detail)
+LLModel::LLModel(const LLVolumeParams& params, F32 detail)
: LLVolume(params, detail),
mNormalizedScale(1,1,1),
mNormalizedTranslation(0, 0, 0),
@@ -68,6 +68,7 @@ LLModel::~LLModel()
{
LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID);
}
+ mPhysics.mMesh.clear();
}
//static
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index f6c0061b3e..37e76c895c 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -106,6 +106,8 @@ public:
std::vector<LLVector3> mPositions;
std::vector<LLVector3> mNormals;
+ ~PhysicsMesh() {}
+
void clear()
{
mPositions.clear();
@@ -131,6 +133,7 @@ public:
public:
Decomposition() { }
Decomposition(LLSD& data);
+ ~Decomposition() { }
void fromLLSD(LLSD& data);
LLSD asLLSD() const;
bool hasHullList() const;
@@ -147,7 +150,7 @@ public:
LLModel::PhysicsMesh mPhysicsShapeMesh;
};
- LLModel(LLVolumeParams& params, F32 detail);
+ LLModel(const LLVolumeParams& params, F32 detail);
~LLModel();
bool loadModel(std::istream& is);
@@ -253,17 +256,18 @@ public:
}
};
-
//Are the doubles the same w/in epsilon specified tolerance
bool areEqual( double a, double b )
{
const float epsilon = 1e-5f;
- return (fabs((a - b)) < epsilon) ? true : false ;
+ return fabs(a - b) < epsilon;
}
+
//Make sure that we return false for any values that are within the tolerance for equivalence
bool jointPositionalLookup( const LLVector3& a, const LLVector3& b )
{
- return ( areEqual( a[0],b[0]) && areEqual( a[1],b[1] ) && areEqual( a[2],b[2]) ) ? true : false;
+ const float epsilon = 1e-5f;
+ return (a - b).length() < epsilon;
}
//copy of position array for this model -- mPosition[idx].mV[X,Y,Z]
@@ -365,13 +369,13 @@ class LLModelInstanceBase
{
public:
LLPointer<LLModel> mModel;
- LLPointer<LLModel> mLOD[5];
+ LLPointer<LLModel> mLOD[LLModel::NUM_LODS];
LLUUID mMeshID;
LLMatrix4 mTransform;
material_map mMaterial;
- LLModelInstanceBase(LLModel* model, LLMatrix4& transform, material_map& materials)
+ LLModelInstanceBase(LLModel* model, const LLMatrix4& transform, const material_map& materials)
: mModel(model), mTransform(transform), mMaterial(materials)
{
}
@@ -380,6 +384,15 @@ public:
: mModel(NULL)
{
}
+
+ virtual ~LLModelInstanceBase()
+ {
+ mModel = NULL;
+ for (int j = 0; j < LLModel::NUM_LODS; ++j)
+ {
+ mLOD[j] = NULL;
+ }
+ };
};
typedef std::vector<LLModelInstanceBase> model_instance_list;
@@ -391,7 +404,7 @@ public:
LLUUID mMeshID;
S32 mLocalMeshID;
- LLModelInstance(LLModel* model, const std::string& label, LLMatrix4& transform, material_map& materials)
+ LLModelInstance(LLModel* model, const std::string& label, const LLMatrix4& transform, const material_map& materials)
: LLModelInstanceBase(model, transform, materials), mLabel(label)
{
mLocalMeshID = -1;
@@ -399,6 +412,8 @@ public:
LLModelInstance(LLSD& data);
+ ~LLModelInstance() {}
+
LLSD asLLSD();
};
diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h
index 45307d567c..1c04e0b595 100644
--- a/indra/llprimitive/llprimitive.h
+++ b/indra/llprimitive/llprimitive.h
@@ -563,6 +563,7 @@ public:
void addFlags(U32 flags) { mMiscFlags |= flags; }
void removeFlags(U32 flags) { mMiscFlags &= ~flags; }
U32 getFlags() const { return mMiscFlags; }
+ bool checkFlags(U32 flags) const { return (mMiscFlags & flags) != 0; }
static std::string pCodeToString(const LLPCode pcode);
static LLPCode legacyToPCode(const U8 legacy);
@@ -600,21 +601,19 @@ public:
inline bool LLPrimitive::isAvatar() const
{
- return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode ) ? true : false;
+ return LL_PCODE_LEGACY_AVATAR == mPrimitiveCode;
}
inline bool LLPrimitive::isSittingAvatar() const
{
// this is only used server-side
- return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode
- && ((getFlags() & (PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND)) != 0) ) ? true : false;
+ return isAvatar() && checkFlags(PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND);
}
inline bool LLPrimitive::isSittingAvatarOnGround() const
{
// this is only used server-side
- return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode
- && ((getFlags() & PRIM_FLAG_SITTING_ON_GROUND) != 0) ) ? true : false;
+ return isAvatar() && checkFlags(PRIM_FLAG_SITTING_ON_GROUND);
}
// static
diff --git a/indra/llprimitive/llvolumemessage.cpp b/indra/llprimitive/llvolumemessage.cpp
index 8d47a7147f..1b3422ab6d 100644
--- a/indra/llprimitive/llvolumemessage.cpp
+++ b/indra/llprimitive/llvolumemessage.cpp
@@ -478,13 +478,15 @@ bool LLVolumeMessage::constrainVolumeParams(LLVolumeParams& params)
bad |= params.setRevolutions(params.getPathParams().getRevolutions()) ? 0 : 0x200;
bad |= params.setRadiusOffset(params.getPathParams().getRadiusOffset()) ? 0 : 0x400;
bad |= params.setSkew(params.getPathParams().getSkew()) ? 0 : 0x800;
- if(bad)
+
+ if (bad)
{
LL_WARNS() << "LLVolumeMessage::constrainVolumeParams() - "
<< "forced to constrain incoming volume params: "
- << llformat("0x%04x",bad) << LL_ENDL;
+ << llformat("0x%04x", bad) << LL_ENDL;
}
- return bad ? false : true;
+
+ return bad == 0;
}
bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params, LLMessageSystem *mesgsys)
diff --git a/indra/llprimitive/tests/llmediaentry_test.cpp b/indra/llprimitive/tests/llmediaentry_test.cpp
index b072ce3964..c3e17d1267 100644
--- a/indra/llprimitive/tests/llmediaentry_test.cpp
+++ b/indra/llprimitive/tests/llmediaentry_test.cpp
@@ -211,7 +211,7 @@ namespace tut
void whitelist_test(int num, bool enable, const char *whitelist, const char *candidate_url, bool expected_pass)
{
- std::string message = "Whitelist test " + boost::lexical_cast<std::string>(num);
+ std::string message = "Whitelist test " + std::to_string(num);
LLMediaEntry entry;
entry.setWhiteListEnable(enable);
set_whitelist(entry, whitelist);