- void WindowBase::updateProjectionMatrix()
- {
- //calculate orthogonal projection matrix
- //
- //l = left
- //r = right
- //b = bottom
- //t = top
- //n = near clipping plane
- //f = far clipping plane
- //
- //2/(r-l) 0 0 -(r+l)/(r-l)
- //0 2/(t-b) 0 -(t+b)/(t-b)
- //0 0 -2/(f-n) -(f+n)/(f-n)
- //0 0 0 1
- float left = mminX;
- float right = mwidth + mminX;
- float bottom = mheight + mminY;
- float top = mminY;
- float near = -1.0f;
- float far = 1.0f;
- float rml = right - left;
- float rpl = right + left;
- float tmb = top - bottom;
- float tpb = top + bottom;
- float fmn = far - near;
- float fpn = far + near;
- morthoMat = Matrix<float>(2.0f / rml, 0.0f, 0.0f, -rpl/rml,
- 0.0f, 2.0f / tmb, 0.0f, -tpb/tmb,
- 0.0f, 0.0f, -2.0f / fmn, -fpn/fmn,
- 0.0f, 0.0f, 0.0f, 1.0f);
- }