11 #if defined __cplusplus
49 if (projectionMatrix == NULL) {
54 if (farZ == HUGE_VAL) {
56 projectionMatrix[10] = -1.;
57 projectionMatrix[14] = -nearZ;
58 }
else if (nearZ == HUGE_VAL) {
60 projectionMatrix[10] = 0.;
61 projectionMatrix[14] = farZ;
64 projectionMatrix[10] = farZ / (nearZ - farZ);
65 projectionMatrix[14] = (nearZ * farZ) / (nearZ - farZ);
68 if (nearZ == HUGE_VAL || farZ == HUGE_VAL) {
71 projectionMatrix[10] = -1.;
72 projectionMatrix[14] = nearZ <= farZ ? nearZ : farZ;
75 projectionMatrix[10] = (nearZ + farZ) / (nearZ - farZ);
76 projectionMatrix[14] = (2 * nearZ * farZ) / (nearZ - farZ);
93 if (tangents == NULL) {
94 varjoMatrix.value[0] = 1.0f;
95 varjoMatrix.value[5] = 1.0f;
96 varjoMatrix.value[10] = 1.0f;
97 varjoMatrix.value[15] = 1.0f;
99 const double invSizeX = 1.0 / (tangents->right - tangents->left);
100 const double invSizeY = 1.0 / (tangents->top - tangents->bottom);
101 const double offsetX = (tangents->left + tangents->right) * invSizeX;
102 const double offsetY = (tangents->bottom + tangents->top) * invSizeY;
104 varjoMatrix.value[0] = 2.0 * invSizeX;
105 varjoMatrix.value[5] = 2.0 * invSizeY;
106 varjoMatrix.value[8] = offsetX;
107 varjoMatrix.value[9] = offsetY;
108 varjoMatrix.value[10] = -1.0;
109 varjoMatrix.value[11] = -1.0;
110 varjoMatrix.value[14] = -0.1;
117 #if defined __cplusplus
121 #endif // VARJO_MATH_H