summaryrefslogtreecommitdiff
path: root/indra/llmath/llmatrix4a.h
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-05-22 19:04:52 +0200
committerAnsariel <ansariel.hiller@phoenixviewer.com>2024-05-22 19:04:52 +0200
commit1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch)
treeab243607f74f78200787bba5b9b88f07ef1b966f /indra/llmath/llmatrix4a.h
parent6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff)
parente1623bb276f83a43ce7a197e388720c05bdefe61 (diff)
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts: # autobuild.xml # indra/cmake/CMakeLists.txt # indra/cmake/GoogleMock.cmake # indra/llaudio/llaudioengine_fmodstudio.cpp # indra/llaudio/llaudioengine_fmodstudio.h # indra/llaudio/lllistener_fmodstudio.cpp # indra/llaudio/lllistener_fmodstudio.h # indra/llaudio/llstreamingaudio_fmodstudio.cpp # indra/llaudio/llstreamingaudio_fmodstudio.h # indra/llcharacter/llmultigesture.cpp # indra/llcharacter/llmultigesture.h # indra/llimage/llimage.cpp # indra/llimage/llimagepng.cpp # indra/llimage/llimageworker.cpp # indra/llimage/tests/llimageworker_test.cpp # indra/llmessage/tests/llmockhttpclient.h # indra/llprimitive/llgltfmaterial.h # indra/llrender/llfontfreetype.cpp # indra/llui/llcombobox.cpp # indra/llui/llfolderview.cpp # indra/llui/llfolderviewmodel.h # indra/llui/lllineeditor.cpp # indra/llui/lllineeditor.h # indra/llui/lltextbase.cpp # indra/llui/lltextbase.h # indra/llui/lltexteditor.cpp # indra/llui/lltextvalidate.cpp # indra/llui/lltextvalidate.h # indra/llui/lluictrl.h # indra/llui/llview.cpp # indra/llwindow/llwindowmacosx.cpp # indra/newview/app_settings/settings.xml # indra/newview/llappearancemgr.cpp # indra/newview/llappearancemgr.h # indra/newview/llavatarpropertiesprocessor.cpp # indra/newview/llavatarpropertiesprocessor.h # indra/newview/llbreadcrumbview.cpp # indra/newview/llbreadcrumbview.h # indra/newview/llbreastmotion.cpp # indra/newview/llbreastmotion.h # indra/newview/llconversationmodel.h # indra/newview/lldensityctrl.cpp # indra/newview/lldensityctrl.h # indra/newview/llface.inl # indra/newview/llfloatereditsky.cpp # indra/newview/llfloatereditwater.cpp # indra/newview/llfloateremojipicker.h # indra/newview/llfloaterimsessiontab.cpp # indra/newview/llfloaterprofiletexture.cpp # indra/newview/llfloaterprofiletexture.h # indra/newview/llgesturemgr.cpp # indra/newview/llgesturemgr.h # indra/newview/llimpanel.cpp # indra/newview/llimpanel.h # indra/newview/llinventorybridge.cpp # indra/newview/llinventorybridge.h # indra/newview/llinventoryclipboard.cpp # indra/newview/llinventoryclipboard.h # indra/newview/llinventoryfunctions.cpp # indra/newview/llinventoryfunctions.h # indra/newview/llinventorygallery.cpp # indra/newview/lllistbrowser.cpp # indra/newview/lllistbrowser.h # indra/newview/llpanelobjectinventory.cpp # indra/newview/llpanelprofile.cpp # indra/newview/llpanelprofile.h # indra/newview/llpreviewgesture.cpp # indra/newview/llsavedsettingsglue.cpp # indra/newview/llsavedsettingsglue.h # indra/newview/lltooldraganddrop.cpp # indra/newview/llurllineeditorctrl.cpp # indra/newview/llvectorperfoptions.cpp # indra/newview/llvectorperfoptions.h # indra/newview/llviewerparceloverlay.cpp # indra/newview/llviewertexlayer.cpp # indra/newview/llviewertexturelist.cpp # indra/newview/macmain.h # indra/test/test.cpp
Diffstat (limited to 'indra/llmath/llmatrix4a.h')
-rw-r--r--indra/llmath/llmatrix4a.h218
1 files changed, 109 insertions, 109 deletions
diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h
index 2cf50e9cd2..348feba27e 100644
--- a/indra/llmath/llmatrix4a.h
+++ b/indra/llmath/llmatrix4a.h
@@ -1,31 +1,31 @@
-/**
+/**
* @file llmatrix4a.h
* @brief LLMatrix4a class header file - memory aligned and vectorized 4x4 matrix
*
* $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_LLMATRIX4A_H
-#define LL_LLMATRIX4A_H
+#ifndef LL_LLMATRIX4A_H
+#define LL_LLMATRIX4A_H
#include "llvector4a.h"
#include "m4math.h"
@@ -34,7 +34,7 @@
class LLMatrix4a
{
public:
- LL_ALIGN_16(LLVector4a mMatrix[4]);
+ LL_ALIGN_16(LLVector4a mMatrix[4]);
LLMatrix4a()
{
@@ -56,13 +56,13 @@ public:
return (F32*)&mMatrix;
}
- inline void clear()
- {
- mMatrix[0].clear();
- mMatrix[1].clear();
- mMatrix[2].clear();
- mMatrix[3].clear();
- }
+ inline void clear()
+ {
+ mMatrix[0].clear();
+ mMatrix[1].clear();
+ mMatrix[2].clear();
+ mMatrix[3].clear();
+ }
inline void setIdentity()
{
@@ -72,14 +72,14 @@ public:
mMatrix[3].set(0.f, 0.f, 0.f, 1.f);
}
- inline void loadu(const LLMatrix4& src)
- {
- mMatrix[0] = _mm_loadu_ps(src.mMatrix[0]);
- mMatrix[1] = _mm_loadu_ps(src.mMatrix[1]);
- mMatrix[2] = _mm_loadu_ps(src.mMatrix[2]);
- mMatrix[3] = _mm_loadu_ps(src.mMatrix[3]);
- }
-
+ inline void loadu(const LLMatrix4& src)
+ {
+ mMatrix[0] = _mm_loadu_ps(src.mMatrix[0]);
+ mMatrix[1] = _mm_loadu_ps(src.mMatrix[1]);
+ mMatrix[2] = _mm_loadu_ps(src.mMatrix[2]);
+ mMatrix[3] = _mm_loadu_ps(src.mMatrix[3]);
+ }
+
inline void loadu(const F32* src)
{
mMatrix[0] = _mm_loadu_ps(src);
@@ -88,90 +88,90 @@ public:
mMatrix[3] = _mm_loadu_ps(src+12);
}
- inline void loadu(const LLMatrix3& src)
- {
- mMatrix[0].load3(src.mMatrix[0]);
- mMatrix[1].load3(src.mMatrix[1]);
- mMatrix[2].load3(src.mMatrix[2]);
- mMatrix[3].set(0,0,0,1.f);
- }
-
- inline void add(const LLMatrix4a& rhs)
- {
- mMatrix[0].add(rhs.mMatrix[0]);
- mMatrix[1].add(rhs.mMatrix[1]);
- mMatrix[2].add(rhs.mMatrix[2]);
- mMatrix[3].add(rhs.mMatrix[3]);
- }
-
- inline void setRows(const LLVector4a& r0, const LLVector4a& r1, const LLVector4a& r2)
- {
- mMatrix[0] = r0;
- mMatrix[1] = r1;
- mMatrix[2] = r2;
- }
-
- inline void setMul(const LLMatrix4a& m, const F32 s)
- {
- mMatrix[0].setMul(m.mMatrix[0], s);
- mMatrix[1].setMul(m.mMatrix[1], s);
- mMatrix[2].setMul(m.mMatrix[2], s);
- mMatrix[3].setMul(m.mMatrix[3], s);
- }
-
- inline void setLerp(const LLMatrix4a& a, const LLMatrix4a& b, F32 w)
- {
- LLVector4a d0,d1,d2,d3;
- d0.setSub(b.mMatrix[0], a.mMatrix[0]);
- d1.setSub(b.mMatrix[1], a.mMatrix[1]);
- d2.setSub(b.mMatrix[2], a.mMatrix[2]);
- d3.setSub(b.mMatrix[3], a.mMatrix[3]);
-
- // this = a + d*w
-
- d0.mul(w);
- d1.mul(w);
- d2.mul(w);
- d3.mul(w);
-
- mMatrix[0].setAdd(a.mMatrix[0],d0);
- mMatrix[1].setAdd(a.mMatrix[1],d1);
- mMatrix[2].setAdd(a.mMatrix[2],d2);
- mMatrix[3].setAdd(a.mMatrix[3],d3);
- }
-
- inline void rotate(const LLVector4a& v, LLVector4a& res) const
- {
- LLVector4a y,z;
-
- res = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));
- y = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
- z = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));
-
- res.mul(mMatrix[0]);
- y.mul(mMatrix[1]);
- z.mul(mMatrix[2]);
-
- res.add(y);
- res.add(z);
- }
-
- inline void affineTransformSSE(const LLVector4a& v, LLVector4a& res) const
- {
- LLVector4a x,y,z;
-
- x = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));
- y = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
- z = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));
-
- x.mul(mMatrix[0]);
- y.mul(mMatrix[1]);
- z.mul(mMatrix[2]);
-
- x.add(y);
- z.add(mMatrix[3]);
- res.setAdd(x,z);
- }
+ inline void loadu(const LLMatrix3& src)
+ {
+ mMatrix[0].load3(src.mMatrix[0]);
+ mMatrix[1].load3(src.mMatrix[1]);
+ mMatrix[2].load3(src.mMatrix[2]);
+ mMatrix[3].set(0,0,0,1.f);
+ }
+
+ inline void add(const LLMatrix4a& rhs)
+ {
+ mMatrix[0].add(rhs.mMatrix[0]);
+ mMatrix[1].add(rhs.mMatrix[1]);
+ mMatrix[2].add(rhs.mMatrix[2]);
+ mMatrix[3].add(rhs.mMatrix[3]);
+ }
+
+ inline void setRows(const LLVector4a& r0, const LLVector4a& r1, const LLVector4a& r2)
+ {
+ mMatrix[0] = r0;
+ mMatrix[1] = r1;
+ mMatrix[2] = r2;
+ }
+
+ inline void setMul(const LLMatrix4a& m, const F32 s)
+ {
+ mMatrix[0].setMul(m.mMatrix[0], s);
+ mMatrix[1].setMul(m.mMatrix[1], s);
+ mMatrix[2].setMul(m.mMatrix[2], s);
+ mMatrix[3].setMul(m.mMatrix[3], s);
+ }
+
+ inline void setLerp(const LLMatrix4a& a, const LLMatrix4a& b, F32 w)
+ {
+ LLVector4a d0,d1,d2,d3;
+ d0.setSub(b.mMatrix[0], a.mMatrix[0]);
+ d1.setSub(b.mMatrix[1], a.mMatrix[1]);
+ d2.setSub(b.mMatrix[2], a.mMatrix[2]);
+ d3.setSub(b.mMatrix[3], a.mMatrix[3]);
+
+ // this = a + d*w
+
+ d0.mul(w);
+ d1.mul(w);
+ d2.mul(w);
+ d3.mul(w);
+
+ mMatrix[0].setAdd(a.mMatrix[0],d0);
+ mMatrix[1].setAdd(a.mMatrix[1],d1);
+ mMatrix[2].setAdd(a.mMatrix[2],d2);
+ mMatrix[3].setAdd(a.mMatrix[3],d3);
+ }
+
+ inline void rotate(const LLVector4a& v, LLVector4a& res) const
+ {
+ LLVector4a y,z;
+
+ res = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));
+ y = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
+ z = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));
+
+ res.mul(mMatrix[0]);
+ y.mul(mMatrix[1]);
+ z.mul(mMatrix[2]);
+
+ res.add(y);
+ res.add(z);
+ }
+
+ inline void affineTransformSSE(const LLVector4a& v, LLVector4a& res) const
+ {
+ LLVector4a x,y,z;
+
+ x = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));
+ y = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
+ z = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));
+
+ x.mul(mMatrix[0]);
+ y.mul(mMatrix[1]);
+ z.mul(mMatrix[2]);
+
+ x.add(y);
+ z.add(mMatrix[3]);
+ res.setAdd(x,z);
+ }
inline void affineTransformNonSSE(const LLVector4a& v, LLVector4a& res) const
{
@@ -182,7 +182,7 @@ public:
res.set(x,y,z,w);
}
- inline void affineTransform(const LLVector4a& v, LLVector4a& res) const
+ inline void affineTransform(const LLVector4a& v, LLVector4a& res) const
{
affineTransformSSE(v,res);
}
@@ -226,7 +226,7 @@ inline std::ostream& operator<<(std::ostream& s, const LLMatrix4a& m)
{
s << "[" << m.mMatrix[0] << ", " << m.mMatrix[1] << ", " << m.mMatrix[2] << ", " << m.mMatrix[3] << "]";
return s;
-}
+}
void matMulBoundBox(const LLMatrix4a &a, const LLVector4a *in_extents, LLVector4a *out_extents);