| 784 | } |
| 785 | |
| 786 | MatrixF PlaneReflector::getCameraReflection( const MatrixF &camTrans ) |
| 787 | { |
| 788 | Point3F normal = refplane; |
| 789 | |
| 790 | // Figure out new cam position |
| 791 | Point3F camPos = camTrans.getPosition(); |
| 792 | F32 dist = refplane.distToPlane( camPos ); |
| 793 | Point3F newCamPos = camPos - normal * dist * 2.0; |
| 794 | |
| 795 | // Figure out new look direction |
| 796 | Point3F i, j, k; |
| 797 | camTrans.getColumn( 0, &i ); |
| 798 | camTrans.getColumn( 1, &j ); |
| 799 | camTrans.getColumn( 2, &k ); |
| 800 | |
| 801 | i = MathUtils::reflect( i, normal ); |
| 802 | j = MathUtils::reflect( j, normal ); |
| 803 | k = MathUtils::reflect( k, normal ); |
| 804 | //mCross( i, j, &k ); |
| 805 | |
| 806 | |
| 807 | MatrixF newTrans(true); |
| 808 | newTrans.setColumn( 0, i ); |
| 809 | newTrans.setColumn( 1, j ); |
| 810 | newTrans.setColumn( 2, k ); |
| 811 | |
| 812 | newTrans.setPosition( newCamPos ); |
| 813 | |
| 814 | return newTrans; |
| 815 | } |
| 816 | |
| 817 | inline F32 sgn(F32 a) |
| 818 | { |
nothing calls this directly
no test coverage detected