diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-12-29 14:08:47 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-12-29 14:08:47 -0500 |
commit | 93ee0b044f77ab07bb9df08bf52c9f4afa713caa (patch) | |
tree | 08490033f3628dadb0073bf2b07d5e7af0ec1798 /indra/llprimitive/llmodel.cpp | |
parent | 28b628ab7b92243a6e40fcdf87f4e2c5b44150e7 (diff) | |
parent | 8204145ab1c4b8f8a509db15f61bbdd264532508 (diff) |
merge
Diffstat (limited to 'indra/llprimitive/llmodel.cpp')
-rwxr-xr-x | indra/llprimitive/llmodel.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 2a8505e16e..28f152f49c 100755 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -27,6 +27,7 @@ #include "linden_common.h" #include "llmodel.h" +#include "llconvexdecomposition.h" #include "llsdserialize.h" #include "llvector4a.h" @@ -57,7 +58,15 @@ const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string); LLModel::LLModel(LLVolumeParams& params, F32 detail) : LLVolume(params, detail), mNormalizedScale(1,1,1), mNormalizedTranslation(0,0,0) { + mDecompID = -1; +} +LLModel::~LLModel() +{ + if (mDecompID >= 0) + { + LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID); + } } void load_face_from_dom_inputs(LLVolumeFace& face, const domInputLocalOffset_Array& inputs, U32 min_idx, U32 max_idx) @@ -941,11 +950,10 @@ void LLModel::normalizeVolumeFaces() LLVector4a size; size.setSub(max, min); - // To make the model fit within - // the unit cube with only the largest - // dimensions fitting on the surface of the cube, - // calculate the largest extent on any axis - F32 scale = 1.f/llmax(llmax(size[0], size[1]), size[2]); + // Compute scale as reciprocal of size + LLVector4a scale; + scale.splat(1.f); + scale.div(size); for (U32 i = 0; i < mVolumeFaces.size(); ++i) { @@ -974,7 +982,10 @@ void LLModel::normalizeVolumeFaces() // we would need to multiply the model // by to get the original size of the // model instead of the normalized size. - mNormalizedScale = LLVector3(1,1,1) / scale; + LLVector4a normalized_scale; + normalized_scale.splat(1.f); + normalized_scale.div(scale); + mNormalizedScale.set(normalized_scale.getF32ptr()); mNormalizedTranslation.set(trans.getF32ptr()); mNormalizedTranslation *= -1.f; } |