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 (farZ == HUGE_VAL) {
70 projectionMatrix[10] = -1.;
71 projectionMatrix[14] = -2. * nearZ;
72 }
else if (nearZ == HUGE_VAL) {
74 projectionMatrix[10] = 1.;
75 projectionMatrix[14] = 2. * farZ;
78 projectionMatrix[10] = (nearZ + farZ) / (nearZ - farZ);
79 projectionMatrix[14] = (2. * nearZ * farZ) / (nearZ - farZ);
97 if (tangents == NULL) {
98 varjoMatrix.value[0] = 1.0f;
99 varjoMatrix.value[5] = 1.0f;
100 varjoMatrix.value[10] = 1.0f;
101 varjoMatrix.value[15] = 1.0f;
103 const double invSizeX = 1.0 / (tangents->right - tangents->left);
104 const double invSizeY = 1.0 / (tangents->top - tangents->bottom);
105 const double offsetX = (tangents->left + tangents->right) * invSizeX;
106 const double offsetY = (tangents->bottom + tangents->top) * invSizeY;
108 varjoMatrix.value[0] = 2.0 * invSizeX;
109 varjoMatrix.value[5] = 2.0 * invSizeY;
110 varjoMatrix.value[8] = offsetX;
111 varjoMatrix.value[9] = offsetY;
112 varjoMatrix.value[10] = -1.0;
113 varjoMatrix.value[11] = -1.0;
114 varjoMatrix.value[14] = -0.1;
121 #if defined __cplusplus
125 #endif // VARJO_MATH_H