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

Method serialize

core/src/core/path_data.cpp:525–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525flatbuffers::Offset<Serialized::BakedPathingData> BakedPathData::serialize(SerializedObject& serializedObject) const
526{
527 auto& fbb = serializedObject.fbb();
528
529 auto visGraphOffset = mVisGraph->serialize(serializedObject);
530
531 vector<flatbuffers::Offset<Serialized::SoundPath>> soundPathOffsets(mUniqueBakedPaths.totalSize());
532 for (auto i = 0u; i < mUniqueBakedPaths.totalSize(); ++i)
533 {
534 soundPathOffsets[i] = Serialized::CreateSoundPath(fbb, mUniqueBakedPaths[i].firstProbe,
535 mUniqueBakedPaths[i].lastProbe,
536 mUniqueBakedPaths[i].probeAfterFirst,
537 mUniqueBakedPaths[i].probeBeforeLast,
538 mUniqueBakedPaths[i].direct,
539 mUniqueBakedPaths[i].distanceInternal,
540 mUniqueBakedPaths[i].deviationInternal);
541 }
542
543 auto soundPathsOffset = fbb.CreateVector(soundPathOffsets.data(), soundPathOffsets.size());
544
545 auto numProbes = mBakedPathRefs.size(0);
546 auto numValidPaths = 0;
547 for (auto i = 0u; i < numProbes; ++i)
548 {
549 for (auto j = 0u; j < numProbes; ++j)
550 {
551 if (mUniqueBakedPaths[mBakedPathRefs[i][j].index].isValid())
552 {
553 ++numValidPaths;
554 }
555 }
556 }
557
558 vector<int32_t> pathIndices;
559 vector<int32_t> paths;
560 pathIndices.reserve(numValidPaths);
561 paths.reserve(numValidPaths);
562 for (auto i = 0u; i < numProbes; ++i)
563 {
564 for (auto j = 0u; j < numProbes; ++j)
565 {
566 if (mUniqueBakedPaths[mBakedPathRefs[i][j].index].isValid())
567 {
568 pathIndices.push_back(static_cast<int>(i * numProbes + j));
569 paths.push_back(mBakedPathRefs[i][j].index);
570 }
571 }
572 }
573
574 auto pathIndicesOffset = fbb.CreateVector(pathIndices.data(), pathIndices.size());
575 auto pathsOffset = fbb.CreateVector(paths.data(), paths.size());
576
577 return Serialized::CreateBakedPathingData(fbb, visGraphOffset, soundPathsOffset, pathIndicesOffset, pathsOffset);
578}
579
580void BakedPathData::updateVisGraphCosts(const ProbeBatch& probeBatch)
581{

Callers

nothing calls this directly

Calls 4

totalSizeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected