Go to the documentation of this file.00001 #include "orthographic.h"
00002
00003 #include <OGRE/OgreMatrix4.h>
00004
00005 namespace ogre_tools
00006 {
00007
00008 void buildScaledOrthoMatrix(Ogre::Matrix4& proj, float left, float right, float bottom, float top, float near, float far)
00009 {
00010 float invw = 1 / (right - left);
00011 float invh = 1 / (top - bottom);
00012 float invd = 1 / (far - near);
00013
00014 proj = Ogre::Matrix4::ZERO;
00015 proj[0][0] = 2 * invw;
00016 proj[0][3] = -(right + left) * invw;
00017 proj[1][1] = 2 * invh;
00018 proj[1][3] = -(top + bottom) * invh;
00019 proj[2][2] = -2 * invd;
00020 proj[2][3] = -(far + near) * invd;
00021 proj[3][3] = 1;
00022 }
00023
00024 }