| 783 | //----------------------------------------------------------------------------- |
| 784 | |
| 785 | bool VPathEditor::getPointOnPath( VPath *pPath, const Gui3DMouseEvent &pEvent, S32 &pNode, MatrixF &pTransform ) |
| 786 | { |
| 787 | if ( pPath->getNodeCount() < 2 ) |
| 788 | { |
| 789 | // Start / End Points. |
| 790 | const Point3F pt0 = pEvent.pos; |
| 791 | const Point3F pt1 = pEvent.pos + pEvent.vec * gProjectDistance; |
| 792 | |
| 793 | // Create Intersection Plane. |
| 794 | const PlaneF plane( pPath->getPosition(), VPath::gBezierUp ); |
| 795 | |
| 796 | // Intersection Point. |
| 797 | Point3F intersectionPoint; |
| 798 | if ( !plane.intersect( pEvent.pos, pEvent.vec, &intersectionPoint ) ) |
| 799 | { |
| 800 | // No Intersection. |
| 801 | return false; |
| 802 | } |
| 803 | |
| 804 | // I'th Node. |
| 805 | pNode = pPath->getNodeCount(); |
| 806 | // Set Identity. |
| 807 | pTransform.identity(); |
| 808 | // Set Position. |
| 809 | pTransform.setPosition( intersectionPoint ); |
| 810 | |
| 811 | // Return. |
| 812 | return true; |
| 813 | } |
| 814 | |
| 815 | switch ( pPath->mPathType ) |
| 816 | { |
| 817 | case VPath::k_PathLinear : |
| 818 | { |
| 819 | |
| 820 | return getPointOnLinearPath( pPath, pEvent, pNode, pTransform ); |
| 821 | |
| 822 | } break; |
| 823 | |
| 824 | case VPath::k_PathBezier : |
| 825 | { |
| 826 | |
| 827 | return getPointOnBezierPath( pPath, pEvent, pNode, pTransform ); |
| 828 | |
| 829 | } break; |
| 830 | } |
| 831 | |
| 832 | return false; |
| 833 | } |
| 834 | |
| 835 | bool VPathEditor::getPointOnLinearPath( VPath *pPath, const Gui3DMouseEvent &pEvent, S32 &pNode, MatrixF &pTransform ) |
| 836 | { |
nothing calls this directly
no test coverage detected