| 361 | } |
| 362 | |
| 363 | void TriVector::PyUnproject( |
| 364 | TriViewport* vp, |
| 365 | ITriMatrix* project, |
| 366 | ITriMatrix* view, |
| 367 | ITriMatrix* world ) |
| 368 | { |
| 369 | Vector3 preViewport; |
| 370 | x = 2.0f * ( x - vp->x ) / vp->width - 1.0f; |
| 371 | y = 1.0f - 2.0f * ( y - vp->y ) / vp->height; |
| 372 | z = ( z - vp->minZ ) / ( vp->maxZ - vp->minZ ); |
| 373 | |
| 374 | Matrix worldViewProjInv = Inverse( *world->GetMatrix() * *view->GetMatrix() * *project->GetMatrix() ); |
| 375 | |
| 376 | *static_cast<Vector3*>( this ) = TransformCoord( *this, worldViewProjInv ); |
| 377 | } |
| 378 | |
| 379 | void TriVector::PyTransformQuaternion( ITriQuaternion* rotation ) |
| 380 | { |