| 79 | //----------------------------------------------------------------------------- |
| 80 | |
| 81 | ViewProjMatrix::ViewProjMatrix(const Matrix4D& rclMtx) |
| 82 | : _clMtx(rclMtx) |
| 83 | { |
| 84 | double m30 = _clMtx[3][0]; |
| 85 | double m31 = _clMtx[3][1]; |
| 86 | double m32 = _clMtx[3][2]; |
| 87 | double m33 = _clMtx[3][3]; |
| 88 | isOrthographic = (m30 == 0.0 && m31 == 0.0 && m32 == 0.0 && m33 == 1.0); |
| 89 | |
| 90 | // Only for orthographic projection mode we can compute a single |
| 91 | // matrix performing all steps. |
| 92 | // For perspective projection the scaling and translation must |
| 93 | // be done afterwards because it depends on the input point. |
| 94 | if (isOrthographic) { |
| 95 | // Scale from [-1,1] to [0,1] |
| 96 | // As done in OpenInventor sources (see SbDPViewVolume::projectToScreen) |
| 97 | _clMtx.scale(0.5, 0.5, 0.5); |
| 98 | _clMtx.move(0.5, 0.5, 0.5); |
| 99 | } |
| 100 | |
| 101 | _clMtxInv = _clMtx; |
| 102 | _clMtxInv.inverseGauss(); |
| 103 | } |
| 104 | |
| 105 | Matrix4D ViewProjMatrix::getProjectionMatrix() const |
| 106 | { |
nothing calls this directly
no test coverage detected