diff options
author | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
commit | b2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch) | |
tree | 3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/llmath/m4math.cpp | |
parent | Second Life viewer sources 1.14.0.1 (diff) | |
download | meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2 meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz |
Second Life viewer sources 1.15.0.2
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llmath/m4math.cpp | 67 |
1 files changed, 46 insertions, 21 deletions
diff --git a/linden/indra/llmath/m4math.cpp b/linden/indra/llmath/m4math.cpp index ee7e6f3..b6d91a1 100644 --- a/linden/indra/llmath/m4math.cpp +++ b/linden/indra/llmath/m4math.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2000-2007, Linden Research, Inc. | 5 | * Copyright (c) 2000-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -673,31 +674,55 @@ LLVector4 operator*(const LLMatrix4 &a, const LLVector4 &b) | |||
673 | } | 674 | } |
674 | */ | 675 | */ |
675 | 676 | ||
677 | // Operates "to the left" on row-vector a | ||
678 | // | ||
679 | // This used to be in the header file but was not actually inlined in practice. | ||
680 | // When avatar vertex programs are off, this function is a hot spot in profiles | ||
681 | // due to software skinning in LLViewerJointMesh::updateGeometry(). JC | ||
682 | LLVector3 operator*(const LLVector3 &a, const LLMatrix4 &b) | ||
683 | { | ||
684 | // This is better than making a temporary LLVector3. This eliminates an | ||
685 | // unnecessary LLVector3() constructor and also helps the compiler to | ||
686 | // realize that the output floats do not alias the input floats, hence | ||
687 | // eliminating redundant loads of a.mV[0], etc. JC | ||
688 | return LLVector3(a.mV[VX] * b.mMatrix[VX][VX] + | ||
689 | a.mV[VY] * b.mMatrix[VY][VX] + | ||
690 | a.mV[VZ] * b.mMatrix[VZ][VX] + | ||
691 | b.mMatrix[VW][VX], | ||
692 | |||
693 | a.mV[VX] * b.mMatrix[VX][VY] + | ||
694 | a.mV[VY] * b.mMatrix[VY][VY] + | ||
695 | a.mV[VZ] * b.mMatrix[VZ][VY] + | ||
696 | b.mMatrix[VW][VY], | ||
697 | |||
698 | a.mV[VX] * b.mMatrix[VX][VZ] + | ||
699 | a.mV[VY] * b.mMatrix[VY][VZ] + | ||
700 | a.mV[VZ] * b.mMatrix[VZ][VZ] + | ||
701 | b.mMatrix[VW][VZ]); | ||
702 | } | ||
676 | 703 | ||
677 | LLVector4 operator*(const LLVector4 &a, const LLMatrix4 &b) | 704 | LLVector4 operator*(const LLVector4 &a, const LLMatrix4 &b) |
678 | { | 705 | { |
679 | // Operate "to the left" on row-vector a | 706 | // Operate "to the left" on row-vector a |
680 | LLVector4 vec; | 707 | return LLVector4(a.mV[VX] * b.mMatrix[VX][VX] + |
681 | vec.mV[VX] = a.mV[VX] * b.mMatrix[VX][VX] + | 708 | a.mV[VY] * b.mMatrix[VY][VX] + |
682 | a.mV[VY] * b.mMatrix[VY][VX] + | 709 | a.mV[VZ] * b.mMatrix[VZ][VX] + |
683 | a.mV[VZ] * b.mMatrix[VZ][VX] + | 710 | a.mV[VW] * b.mMatrix[VW][VX], |
684 | a.mV[VW] * b.mMatrix[VW][VX]; | 711 | |
685 | 712 | a.mV[VX] * b.mMatrix[VX][VY] + | |
686 | vec.mV[VY] = a.mV[VX] * b.mMatrix[VX][VY] + | 713 | a.mV[VY] * b.mMatrix[VY][VY] + |
687 | a.mV[VY] * b.mMatrix[VY][VY] + | 714 | a.mV[VZ] * b.mMatrix[VZ][VY] + |
688 | a.mV[VZ] * b.mMatrix[VZ][VY] + | 715 | a.mV[VW] * b.mMatrix[VW][VY], |
689 | a.mV[VW] * b.mMatrix[VW][VY]; | 716 | |
690 | 717 | a.mV[VX] * b.mMatrix[VX][VZ] + | |
691 | vec.mV[VZ] = a.mV[VX] * b.mMatrix[VX][VZ] + | 718 | a.mV[VY] * b.mMatrix[VY][VZ] + |
692 | a.mV[VY] * b.mMatrix[VY][VZ] + | 719 | a.mV[VZ] * b.mMatrix[VZ][VZ] + |
693 | a.mV[VZ] * b.mMatrix[VZ][VZ] + | 720 | a.mV[VW] * b.mMatrix[VW][VZ], |
694 | a.mV[VW] * b.mMatrix[VW][VZ]; | 721 | |
695 | 722 | a.mV[VX] * b.mMatrix[VX][VW] + | |
696 | vec.mV[VW] = a.mV[VX] * b.mMatrix[VX][VW] + | 723 | a.mV[VY] * b.mMatrix[VY][VW] + |
697 | a.mV[VY] * b.mMatrix[VY][VW] + | 724 | a.mV[VZ] * b.mMatrix[VZ][VW] + |
698 | a.mV[VZ] * b.mMatrix[VZ][VW] + | 725 | a.mV[VW] * b.mMatrix[VW][VW]); |
699 | a.mV[VW] * b.mMatrix[VW][VW]; | ||
700 | return vec; | ||
701 | } | 726 | } |
702 | 727 | ||
703 | LLVector4 rotate_vector(const LLVector4 &a, const LLMatrix4 &b) | 728 | LLVector4 rotate_vector(const LLVector4 &a, const LLMatrix4 &b) |