MCPcopy Create free account
hub / github.com/ValveSoftware/steam-audio / BakedPathData

Method BakedPathData

core/src/core/path_data.cpp:195–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193// --------------------------------------------------------------------------------------------------------------------
194
195BakedPathData::BakedPathData(const IScene& scene,
196 const ProbeBatch& probes,
197 int numSamples,
198 float radius,
199 float threshold,
200 float visRange,
201 float visRangeRealTime,
202 float pathRange,
203 bool asymmetricVisRange,
204 const Vector3f& down,
205 bool pruneVisGraph,
206 int numThreads,
207 ThreadPool& threadPool,
208 std::atomic<bool>& cancel,
209 ProgressCallback progressCallback,
210 void* callbackUserData)
211 : mBakedPathRefs(probes.numProbes(), probes.numProbes())
212{
213 // First, generate the visibility graph.
214 ProbeVisibilityTester visTester(numSamples, asymmetricVisRange, down);
215
216 JobGraph jobGraph{};
217 mVisGraph = ipl::make_unique<ProbeVisibilityGraph>(scene, probes, visTester, radius, threshold, visRange,
218 numThreads, jobGraph, cancel, progressCallback, callbackUserData);
219
220 threadPool.process(jobGraph, [progressCallback, callbackUserData](float percentComplete) { progressCallback(percentComplete, callbackUserData); });
221
222 // Next, using multiple threads, calculate shortest paths between every pair of probes.
223 PathFinder pathFinder(probes, numThreads);
224 Array<ProbePath, 2> probePaths(probes.numProbes(), probes.numProbes());
225
226 if (cancel)
227 {
228 cancel = false;
229 return;
230 }
231
232 jobGraph.reset();
233
234 for (auto i = 0; i < probes.numProbes(); i++)
235 {
236 jobGraph.addJob([this, i, &scene, &probes, &probePaths, &pathFinder, radius, threshold, pathRange](int threadIndex, std::atomic<bool>&)
237 {
238 PROFILE_ZONE("BakedPathData::bakeJob");
239
240 for (auto j = 0; j < probes.numProbes(); ++j)
241 {
242 probePaths[i][j].nodes.clear();
243 }
244
245 pathFinder.findAllShortestPaths(scene, probes, *mVisGraph, i, radius, threshold, pathRange, threadIndex, probePaths[i]);
246 });
247 }
248
249 threadPool.process(jobGraph, [progressCallback, callbackUserData](float percentComplete) { progressCallback(percentComplete, callbackUserData); });
250
251 // Remove all data with j > i, since they can be reconstructed from the data with j < i due to symmetry.
252 ProbePath invalidProbePath;

Callers

nothing calls this directly

Calls 14

SoundPathClass · 0.85
addJobMethod · 0.80
findAllShortestPathsMethod · 0.80
pruneMethod · 0.80
numProbesMethod · 0.45
processMethod · 0.45
resetMethod · 0.45
flatDataMethod · 0.45
totalSizeMethod · 0.45
sizeMethod · 0.45
isValidMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected