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

Method bake

core/src/core/reflection_baker.cpp:34–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32std::atomic<bool> ReflectionBaker::sBakeInProgress(false);
33
34void ReflectionBaker::bake(const IScene& scene,
35 IReflectionSimulator& simulator,
36 const BakedDataIdentifier& identifier,
37 bool bakeConvolution,
38 bool bakeParametric,
39 int numRays,
40 int numBounces,
41 float simDuration,
42 float bakeDuration,
43 int order,
44 float irradianceMinDistance,
45 int numThreads,
46 int bakeBatchSize,
47 SceneType sceneType,
48 shared_ptr<OpenCLDevice> openCL,
49 ProbeBatch& probeBatch,
50 ProgressCallback callback,
51 void* userData)
52{
53 PROFILE_FUNCTION();
54
55 assert(bakeConvolution || bakeParametric);
56 assert(identifier.type == BakedDataType::Reflections);
57 assert(identifier.variation != BakedDataVariation::Dynamic);
58
59 sBakeInProgress = true;
60
61 if (sceneType != SceneType::RadeonRays && identifier.variation != BakedDataVariation::StaticListener)
62 {
63 bakeBatchSize = 1;
64 }
65
66 BakedReflectionsData* reflectionsData = nullptr;
67
68 if (!probeBatch.hasData(identifier))
69 {
70 probeBatch.addData(identifier, make_unique<BakedReflectionsData>(identifier, probeBatch.numProbes(), bakeConvolution, bakeParametric));
71 }
72
73 reflectionsData = static_cast<BakedReflectionsData*>(&probeBatch[identifier]);
74
75 reflectionsData->setHasConvolution(bakeConvolution);
76 reflectionsData->setHasParametric(bakeParametric);
77
78 JobGraph jobGraph;
79 ThreadPool threadPool(numThreads);
80
81 AirAbsorptionModel airAbsorption{};
82 Array<CoordinateSpace3f> sources(bakeBatchSize);
83 Array<CoordinateSpace3f> listeners(bakeBatchSize);
84 Array<Directivity> directivities(bakeBatchSize);
85 Array<unique_ptr<EnergyField>> energyFields(bakeBatchSize);
86 Array<EnergyField*> energyFieldPtrs(bakeBatchSize);
87 Array<int> indices(bakeBatchSize);
88 auto numValidInBatch = 0;
89
90 for (auto i = 0; i < probeBatch.numProbes(); ++i)
91 {

Callers

nothing calls this directly

Calls 15

hasDataMethod · 0.80
addDataMethod · 0.80
setHasConvolutionMethod · 0.80
setHasParametricMethod · 0.80
setMethod · 0.80
copyFromMethod · 0.80
createFunction · 0.50
numProbesMethod · 0.45
containsMethod · 0.45
getMethod · 0.45
resetMethod · 0.45
simulateMethod · 0.45

Tested by

no test coverage detected