summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llmath/lloctree.h4
-rwxr-xr-xindra/llprimitive/llmodel.cpp54
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp25
3 files changed, 67 insertions, 16 deletions
diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h
index ed97ff76ba..276f7b0f06 100644
--- a/indra/llmath/lloctree.h
+++ b/indra/llmath/lloctree.h
@@ -33,11 +33,7 @@
#include <vector>
#include <set>
-#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
-#define OCT_ERRS LL_ERRS("OctreeErrors")
-#else
#define OCT_ERRS LL_WARNS("OctreeErrors")
-#endif
#define LL_OCTREE_PARANOIA_CHECK 0
#if LL_DARWIN
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 28f152f49c..1869e1dd47 100755
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1878,21 +1878,57 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
}
else
{ //no exact match found, get closest point
- iter = mSkinWeights.begin();
- weight_map::iterator best = iter;
+ const F32 epsilon = 2.f/65536;
+ weight_map::iterator iter_up = mSkinWeights.lower_bound(pos);
+ weight_map::iterator iter_down = ++iter_up;
+
+ weight_map::iterator best = iter_up;
F32 min_dist = (iter->first - pos).magVecSquared();
- while (++iter != mSkinWeights.end())
- {
- F32 dist = (iter->first - pos).magVecSquared();
- if (dist < min_dist)
+ bool done = false;
+ while (!done)
+ { //search up and down mSkinWeights from lower bound of pos until a
+ //match is found within epsilon. If no match is found within epsilon,
+ //return closest match
+ done = true;
+ if (iter_up != mSkinWeights.end() && ++iter_up != mSkinWeights.end())
{
- best = iter;
- min_dist = dist;
+ done = false;
+ F32 dist = (iter_up->first - pos).magVecSquared();
+
+ if (dist < epsilon)
+ {
+ return iter_up->second;
+ }
+
+ if (dist < min_dist)
+ {
+ best = iter_up;
+ min_dist = dist;
+ }
}
- }
+ if (iter_down != mSkinWeights.begin() && --iter_down != mSkinWeights.begin())
+ {
+ done = false;
+
+ F32 dist = (iter_down->first - pos).magVecSquared();
+
+ if (dist < epsilon)
+ {
+ return iter_down->second;
+ }
+
+ if (dist < min_dist)
+ {
+ best = iter_down;
+ min_dist = dist;
+ }
+
+ }
+ }
+
return best->second;
}
}
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index f96c02d9b7..552e1d9fe1 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -1562,11 +1562,23 @@ void LLModelLoader::run()
//add instance to scene for this model
- LLMatrix4 transform;
+ LLMatrix4 transformation = mTransform;
+ // adjust the transformation to compensate for mesh normalization
+
+ LLMatrix4 mesh_translation;
+ mesh_translation.setTranslation(mesh_translation_vector);
+ mesh_translation *= transformation;
+ transformation = mesh_translation;
+
+ LLMatrix4 mesh_scale;
+ mesh_scale.initScale(mesh_scale_vector);
+ mesh_scale *= transformation;
+ transformation = mesh_scale;
+
std::vector<LLImportMaterial> materials;
materials.resize(model->getNumVolumeFaces());
- mScene[transform].push_back(LLModelInstance(model, transform, materials));
- stretch_extents(model, transform, mExtents[0], mExtents[1], mFirstTransform);
+ mScene[transformation].push_back(LLModelInstance(model, transformation, materials));
+ stretch_extents(model, transformation, mExtents[0], mExtents[1], mFirstTransform);
}
}
}
@@ -2881,6 +2893,13 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation)
{
start = end = which_lod;
}
+ else
+ {
+ //SH-632 -- incremenet triangle count to avoid removing any triangles from
+ //highest LoD when auto-generating LoD
+ triangle_count++;
+ }
+
mMaxTriangleLimit = base_triangle_count;