| 450 | } |
| 451 | |
| 452 | void OBB::transform(const Mat4& mat) |
| 453 | { |
| 454 | Vec4 newcenter = mat * Vec4(_center.x, _center.y, _center.z, 1.0f); // center; |
| 455 | _center.x = newcenter.x; |
| 456 | _center.y = newcenter.y; |
| 457 | _center.z = newcenter.z; |
| 458 | |
| 459 | _xAxis = mat * _xAxis; |
| 460 | _yAxis = mat * _yAxis; |
| 461 | _zAxis = mat * _zAxis; |
| 462 | |
| 463 | _xAxis.normalize(); |
| 464 | _yAxis.normalize(); |
| 465 | _zAxis.normalize(); |
| 466 | |
| 467 | Vec3 scale, trans; |
| 468 | Quaternion quat; |
| 469 | mat.decompose(&scale, &quat, &trans); |
| 470 | |
| 471 | _extents.x *= scale.x; |
| 472 | _extents.y *= scale.y; |
| 473 | _extents.z *= scale.z; |
| 474 | |
| 475 | computeExtAxis(); |
| 476 | } |
| 477 | |
| 478 | } |