| 537 | } |
| 538 | |
| 539 | void PathSimulator::calcDistanceRatioForPaths(const Vector3f& source, |
| 540 | const ProbeBatch& probes, |
| 541 | int* starts, |
| 542 | int* ends, |
| 543 | int numPaths, |
| 544 | const SoundPath* paths, |
| 545 | const float* weights, |
| 546 | float* avgDistanceRatio) |
| 547 | { |
| 548 | PROFILE_FUNCTION(); |
| 549 | |
| 550 | if (!avgDistanceRatio) |
| 551 | return; |
| 552 | |
| 553 | float ratio = .0f; |
| 554 | for (auto i = 0; i < numPaths; ++i) |
| 555 | { |
| 556 | if (!paths[i].isValid()) |
| 557 | continue; |
| 558 | |
| 559 | float pathRatio = 1.0; |
| 560 | |
| 561 | if (starts[i] >= 0 && ends[i] >= 0) |
| 562 | { |
| 563 | Vector3f virtualSource = paths[i].toVirtualSource(probes, source, ends[i]); |
| 564 | float pathDistance = (virtualSource - probes[ends[i]].influence.center).length(); |
| 565 | float directDistance = (source - probes[ends[i]].influence.center).length(); |
| 566 | pathRatio = (pathDistance > 1.0f && directDistance > 1.0f) ? directDistance / pathDistance : 1.0f; |
| 567 | } |
| 568 | |
| 569 | ratio += weights[i] * pathRatio; |
| 570 | } |
| 571 | |
| 572 | // Returns ratio of 1.0 if no valid path is found. Probably should return a large distance ratio instead. |
| 573 | *avgDistanceRatio = ratio; |
| 574 | } |
| 575 | |
| 576 | } |
nothing calls this directly
no test coverage detected