| 713 | } |
| 714 | |
| 715 | Vec2 Director::convertToGL(const Vec2& uiPoint) |
| 716 | { |
| 717 | Mat4 transform; |
| 718 | GLToClipTransform(&transform); |
| 719 | |
| 720 | Mat4 transformInv = transform.getInversed(); |
| 721 | |
| 722 | // Calculate z=0 using -> transform*[0, 0, 0, 1]/w |
| 723 | float zClip = transform.m[14] / transform.m[15]; |
| 724 | |
| 725 | Vec2 glSize = _renderView->getDesignResolutionSize(); |
| 726 | Vec4 clipCoord(2.0f * uiPoint.x / glSize.width - 1.0f, 1.0f - 2.0f * uiPoint.y / glSize.height, zClip, 1); |
| 727 | |
| 728 | Vec4 glCoord; |
| 729 | // transformInv.transformPoint(clipCoord, &glCoord); |
| 730 | transformInv.transformVector(clipCoord, &glCoord); |
| 731 | float factor = 1.0f / glCoord.w; |
| 732 | return Vec2(glCoord.x * factor, glCoord.y * factor); |
| 733 | } |
| 734 | |
| 735 | Vec2 Director::convertToUI(const Vec2& glPoint) |
| 736 | { |