diff options
| author | simon <none@none> | 2013-05-09 15:30:49 -0700 |
|---|---|---|
| committer | simon <none@none> | 2013-05-09 15:30:49 -0700 |
| commit | 5687b0c4df5c28cb6aa6cb33cf0d2c4bbe1b912e (patch) | |
| tree | 8d1f9f3044adeb81778769fef0f57349fb5ca72f /indra/llprimitive/llmodel.cpp | |
| parent | ee2fce8790b69d61845cc32fbf7cdce8a33b0dab (diff) | |
| parent | 50bbb0b7ed542a5f9dee4f347531537beecddd26 (diff) | |
Merge
Diffstat (limited to 'indra/llprimitive/llmodel.cpp')
| -rwxr-xr-x | indra/llprimitive/llmodel.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index ef6eb75a6b..e236f98fe6 100755 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1122,6 +1122,43 @@ void LLModel::getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& tra translation_out = mNormalizedTranslation; } +LLVector3 LLModel::getTransformedCenter(const LLMatrix4& mat) +{ + LLVector3 ret; + + if (!mVolumeFaces.empty()) + { + LLMatrix4a m; + m.loadu(mat); + + LLVector4a minv,maxv; + + LLVector4a t; + m.affineTransform(mVolumeFaces[0].mPositions[0], t); + minv = maxv = t; + + for (S32 i = 0; i < mVolumeFaces.size(); ++i) + { + LLVolumeFace& face = mVolumeFaces[i]; + + for (U32 j = 0; j < face.mNumVertices; ++j) + { + m.affineTransform(face.mPositions[j],t); + update_min_max(minv, maxv, t); + } + } + + minv.add(maxv); + minv.mul(0.5f); + + ret.set(minv.getF32ptr()); + } + + return ret; +} + + + void LLModel::setNumVolumeFaces(S32 count) { mVolumeFaces.resize(count); |
