| 445 | } |
| 446 | |
| 447 | void Spline::UpdateSpline() |
| 448 | { |
| 449 | auto& keyframes = Curve.GetKeyframes(); |
| 450 | const int32 count = keyframes.Count(); |
| 451 | |
| 452 | // Always keep last point in the loop |
| 453 | if (_loop && count > 1) |
| 454 | { |
| 455 | auto& first = keyframes[0]; |
| 456 | auto& last = keyframes[count - 1]; |
| 457 | last.Value = first.Value; |
| 458 | last.TangentIn = first.TangentIn; |
| 459 | last.TangentOut = first.TangentOut; |
| 460 | } |
| 461 | |
| 462 | // Update bounds |
| 463 | _localBounds = BoundingBox(count != 0 ? keyframes[0].Value.Translation : Vector3::Zero); |
| 464 | for (int32 i = 1; i < count; i++) |
| 465 | _localBounds.Merge(keyframes[i].Value.Translation); |
| 466 | Matrix world; |
| 467 | GetLocalToWorldMatrix(world); |
| 468 | BoundingBox::Transform(_localBounds, world, _box); |
| 469 | BoundingSphere::FromBox(_box, _sphere); |
| 470 | |
| 471 | SplineUpdated(); |
| 472 | } |
| 473 | |
| 474 | #if !COMPILE_WITHOUT_CSHARP |
| 475 |
no test coverage detected