diff options
author | MatejaMaric <matejamaricz@gmail.com> | 2019-07-10 17:01:21 +0200 |
---|---|---|
committer | MatejaMaric <matejamaricz@gmail.com> | 2019-07-10 17:01:21 +0200 |
commit | 50cc0da2add9d85ad1e9d854dabd2e0fd863d881 (patch) | |
tree | d389dd6b5e5bc9f56d9a0ccf990ab998de439daa /source | |
parent | a6627cad1696500c5d5ee40a517345cb4477c169 (diff) | |
download | erender-50cc0da2add9d85ad1e9d854dabd2e0fd863d881.tar.gz erender-50cc0da2add9d85ad1e9d854dabd2e0fd863d881.zip |
Another
Diffstat (limited to 'source')
-rw-r--r-- | source/Matrix4f.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/Matrix4f.cpp b/source/Matrix4f.cpp index c8be036..c26f066 100644 --- a/source/Matrix4f.cpp +++ b/source/Matrix4f.cpp @@ -58,22 +58,22 @@ Matrix4f Matrix4f::rotate(float xs, float ys, float zs) ys *= hlp;
zs *= hlp;
Matrix4f b;
- b.m[0][0] = 1; b.m[0][1] = 0; b.m[0][2] = 0; b.m[0][3] = 0;
+ b.m[0][0] = 1; b.m[0][1] = 0; b.m[0][2] = 0; b.m[0][3] = 0;
b.m[1][0] = 0; b.m[1][1] = cos(xs); b.m[1][2] = -sin(xs); b.m[1][3] = 0;
b.m[2][0] = 0; b.m[2][1] = sin(xs); b.m[2][2] = cos(xs); b.m[2][3] = 0;
- b.m[3][0] = 0; b.m[3][1] = 0; b.m[3][2] = 0; b.m[3][3] = 1;
+ b.m[3][0] = 0; b.m[3][1] = 0; b.m[3][2] = 0; b.m[3][3] = 1;
Matrix4f c;
c.m[0][0] = cos(ys); c.m[0][1] = 0; c.m[0][2] = sin(ys); c.m[0][3] = 0;
- c.m[1][0] = 0; c.m[1][1] = 1; c.m[1][2] = 0; c.m[1][3] = 0;
+ c.m[1][0] = 0; c.m[1][1] = 1; c.m[1][2] = 0; c.m[1][3] = 0;
c.m[2][0] = -sin(ys); c.m[2][1] = 0; c.m[2][2] = cos(ys); c.m[2][3] = 0;
- c.m[3][0] = 0; c.m[3][1] = 0; c.m[3][2] = 0; c.m[3][3] = 1;
+ c.m[3][0] = 0; c.m[3][1] = 0; c.m[3][2] = 0; c.m[3][3] = 1;
Matrix4f d;
d.m[0][0] = cos(zs); d.m[0][1] = -sin(zs); d.m[0][2] = 0; d.m[0][3] = 0;
d.m[1][0] = sin(zs); d.m[1][1] = cos(zs); d.m[1][2] = 0; d.m[1][3] = 0;
- d.m[2][0] = 0; d.m[2][1] = 0; d.m[2][2] = 1; d.m[2][3] = 0;
- d.m[3][0] = 0; d.m[3][1] = 0; d.m[3][2] = 0; d.m[3][3] = 1;
+ d.m[2][0] = 0; d.m[2][1] = 0; d.m[2][2] = 1; d.m[2][3] = 0;
+ d.m[3][0] = 0; d.m[3][1] = 0; d.m[3][2] = 0; d.m[3][3] = 1;
return d * c * b;
}
@@ -96,9 +96,9 @@ Matrix4f Matrix4f::perspective(float n, float f, float fov, float aspectRatio) r = aspectRatio * t;
l = -r;
Matrix4f a;
- a.m[0][0] = ((2.0f * n) / (r - l)); a.m[0][1] = 0; a.m[0][2] = - ((r + l) / (r - l)); a.m[0][3] = 0;
- a.m[1][0] = 0; a.m[1][1] = ((2.0f * n) / (t - b)); a.m[1][2] = - ((t + b) / (t - b)); a.m[1][3] = 0;
- a.m[2][0] = 0; a.m[2][1] = 0; a.m[2][2] = - (f / (n - f)); a.m[2][3] = ((n * f) / (n - f));
- a.m[3][0] = 0; a.m[3][1] = 0; a.m[3][2] = 1; a.m[3][3] = 0;
+ a.m[0][0] = ((2.0f * n) / (r - l)); a.m[0][1] = 0; a.m[0][2] = - ((r + l) / (r - l)); a.m[0][3] = 0;
+ a.m[1][0] = 0; a.m[1][1] = ((2.0f * n) / (t - b)); a.m[1][2] = - ((t + b) / (t - b)); a.m[1][3] = 0;
+ a.m[2][0] = 0; a.m[2][1] = 0; a.m[2][2] = - (f / (n - f)); a.m[2][3] = ((n * f) / (n - f));
+ a.m[3][0] = 0; a.m[3][1] = 0; a.m[3][2] = 1; a.m[3][3] = 0;
return a;
}
|