summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/MathUtil.cpp
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2009-06-28 20:04:07 +0000
committerhrydgard <hrydgard@gmail.com>2009-06-28 20:04:07 +0000
commit3d9279a73f15667e94267820b0bc926394cefaa0 (patch)
tree9dfc99dde26bee7c950c38cd8996cb20c5f82f91 /Source/Core/Common/Src/MathUtil.cpp
parentfaa63713e2a645cc053c46967f24dbe79222ad35 (diff)
Graphics: (faked) bounding box support. Helps some Paper Mario effects although they're still a bit glitchy. Might also help other games? Enable with the #define in VideoCommon.h. Since there might be a speed hit it's off by default.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3580 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/MathUtil.cpp')
-rw-r--r--Source/Core/Common/Src/MathUtil.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/Source/Core/Common/Src/MathUtil.cpp b/Source/Core/Common/Src/MathUtil.cpp
index 8e15cef701..c30d3b6306 100644
--- a/Source/Core/Common/Src/MathUtil.cpp
+++ b/Source/Core/Common/Src/MathUtil.cpp
@@ -145,12 +145,15 @@ void SaveSSEState()
saved_sse_state = _mm_getcsr();
}
-void MatrixMul(int n, const float *a, const float *b, float *result)
+inline void MatrixMul(int n, const float *a, const float *b, float *result)
{
- for(int i = 0; i < n; ++i) {
- for(int j= 0; j < n; ++j) {
+ for (int i = 0; i < n; ++i)
+ {
+ for (int j = 0; j < n; ++j)
+ {
float temp = 0;
- for(int k = 0; k < n; ++k) {
+ for (int k = 0; k < n; ++k)
+ {
temp += a[i * n + k] * b[k * n + j];
}
result[i * n + j] = temp;
@@ -207,9 +210,9 @@ void Matrix33::Multiply(const Matrix33 &a, const Matrix33 &b, Matrix33 &result)
void Matrix33::Multiply(const Matrix33 &a, const float vec[3], float result[3])
{
- for(int i = 0; i < 3; ++i) {
+ for (int i = 0; i < 3; ++i) {
result[i] = 0;
- for(int k = 0; k < 3; ++k) {
+ for (int k = 0; k < 3; ++k) {
result[i] += a.data[i * 3 + k] * vec[k];
}
}
@@ -226,13 +229,16 @@ void Matrix44::LoadIdentity(Matrix44 &mtx)
void Matrix44::LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33)
{
- for(int i = 0; i < 3; ++i) {
- for(int j = 0; j < 3; ++j) {
+ for (int i = 0; i < 3; ++i)
+ {
+ for (int j = 0; j < 3; ++j)
+ {
mtx.data[i * 4 + j] = m33.data[i * 3 + j];
}
}
- for(int i = 0; i < 3; ++i) {
+ for (int i = 0; i < 3; ++i)
+ {
mtx.data[i * 4 + 3] = 0;
mtx.data[i + 12] = 0;
}