blob: ba7c30c11aac6bb82b5ced26cb55b28e770738b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "projection.hpp"
namespace dp
{
void MakeProjection(array<float, 16> & result, float left, float right, float bottom, float top)
{
result.fill(0.0f);
float width = right - left;
float height = top - bottom;
float depth = maxDepth - minDepth;
result[0] = 2.0f / width;
result[3] = -(right + left) / width;
result[5] = 2.0f / height;
result[7] = -(top + bottom) / height;
result[10] = -2.0f / depth;
result[11] = -(maxDepth + minDepth) / depth;
result[15] = 1.0;
}
} // namespace dp
|