diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-11-30 12:05:02 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:47:43 +0300 |
commit | 9ce0961712eb176b2f02b761c6e4e8491270e73b (patch) | |
tree | e0371021e3a62d0c0210335b660251f7dd787956 /graphics/coordinates.cpp | |
parent | bdb3c27342f5e1c1bbf8227f2b541b61eb7fa445 (diff) |
refactored coordinate system setting.
Diffstat (limited to 'graphics/coordinates.cpp')
-rw-r--r-- | graphics/coordinates.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/graphics/coordinates.cpp b/graphics/coordinates.cpp new file mode 100644 index 0000000000..c26babb775 --- /dev/null +++ b/graphics/coordinates.cpp @@ -0,0 +1,18 @@ +#include "coordinates.hpp" + +namespace graphics +{ + void getOrthoMatrix(math::Matrix<float, 4, 4> & m, + float l, + float r, + float b, + float t, + float n, + float f) + { + m(0, 0) = 2 / (r - l); m(0, 1) = 0; m(0, 2) = 0; m(0, 3) = -(r + l) / (r - l); + m(1, 0) = 0; m(1, 1) = 2 / (t - b);m(1, 2) = 0; m(1, 3) = -(t + b) / (t - b); + m(2, 0) = 0; m(2, 1) = 0; m(2, 2) = -2 / (f - n); m(2, 3) = - (f + n) / (f - n); + m(3, 0) = 0; m(3, 1) = 0; m(3, 2) = 0; m(3, 3) = 1; + } +} |