| 610 | glmatrixf clipmatrix; |
| 611 | |
| 612 | void genclipmatrix(float a, float b, float c, float d) |
| 613 | { |
| 614 | // transform the clip plane into camera space |
| 615 | float clip[4]; |
| 616 | loopi(4) clip[i] = a*invmvmatrix[i*4 + 0] + b*invmvmatrix[i*4 + 1] + c*invmvmatrix[i*4 + 2] + d*invmvmatrix[i*4 + 3]; |
| 617 | |
| 618 | float x = ((clip[0]<0 ? -1 : (clip[0]>0 ? 1 : 0)) + projmatrix[8]) / projmatrix[0], |
| 619 | y = ((clip[1]<0 ? -1 : (clip[1]>0 ? 1 : 0)) + projmatrix[9]) / projmatrix[5], |
| 620 | w = (1 + projmatrix[10]) / projmatrix[14], |
| 621 | scale = 2 / (x*clip[0] + y*clip[1] - clip[2] + w*clip[3]); |
| 622 | clipmatrix = projmatrix; |
| 623 | clipmatrix[2] = clip[0]*scale; |
| 624 | clipmatrix[6] = clip[1]*scale; |
| 625 | clipmatrix[10] = clip[2]*scale + 1.0f; |
| 626 | clipmatrix[14] = clip[3]*scale; |
| 627 | } |
| 628 | |
| 629 | bool reflecting = false, refracting = false; |
| 630 | GLuint reflecttex = 0, refracttex = 0; |
no test coverage detected