class

SceneSnapshot

Compressed in-memory snapshot of a Scene's serialized state.

Module
Game
Header
#include "Scene/SceneSnapshot.h"
Namespace
Mowo

Used by PIE (edit → play state capture). The compressed buffer is owned by the SceneSnapshot — copy/move semantics are explicit so call sites stay obvious about lifetime.

Storage model: - Capture takes the Scene's serialized MDF text, re-encodes it to the compact mdfb binary form, then runs zstd on the binary and stores the compressed bytes — smaller than zstd(text) and cheaper to parse back on restore. - Restore decompresses into a temporary std::string holding the mdfb bytes; MdfDocument::ParseFromString auto-detects the MDFB magic, so Scene::DeserializeFromMDF consumes it unchanged (and old text snapshots would still parse).

This is intentionally not a full delta journal — the roadmap calls for per-mutation journaling for an additional ~20× win, but the immediate short-term goal is "stop holding the raw MDF string for the entire PIE session." Compression + immediate release accomplishes that.

Constructors

SignatureNameDescription
SceneSnapshot() = defaultSceneSnapshot
~SceneSnapshot() = default~SceneSnapshot
SceneSnapshot(const SceneSnapshot&) = defaultSceneSnapshot
SceneSnapshot(SceneSnapshot&&) noexcept = defaultSceneSnapshot

Public functions

ReturnsNameDescription
SceneSnapshot&operator=
SceneSnapshot&operator=
SceneSnapshotCaptureFromMdfCapture from a raw serialized MDF string.
std::stringDecompressToMdfDecompress the snapshot back into an MDF string.
boolIsEmpty
voidClear
size_tCompressedBytesStats — useful for logging PIE memory cost.
size_tUncompressedBytes

Function details

SceneSnapshot

C++
SceneSnapshot() = default

~SceneSnapshot

C++
~SceneSnapshot() = default

SceneSnapshot

C++
SceneSnapshot(const SceneSnapshot&) = default

SceneSnapshot

C++
SceneSnapshot(SceneSnapshot&&) noexcept = default

operator=

C++
SceneSnapshot& operator=(const SceneSnapshot&) = default

operator=

C++
SceneSnapshot& operator=(SceneSnapshot&&) noexcept = default

CaptureFromMdf

C++
static SceneSnapshot CaptureFromMdf(const std::string& mdf)

Capture from a raw serialized MDF string. The caller is responsible for producing the string (engine Scene::SerializeToMDF or the editor SceneSerializer::SerializeToString — different deserialize paths know how to handle each).

DecompressToMdf

C++
std::string DecompressToMdf() const

Decompress the snapshot back into an MDF string. Returns empty on failure (treat as a hard error — the snapshot is corrupt).

IsEmpty

C++
bool IsEmpty() const

Clear

C++
void Clear()

CompressedBytes

C++
size_t CompressedBytes() const

Stats — useful for logging PIE memory cost.

UncompressedBytes

C++
size_t UncompressedBytes() const
Generated from Scene/SceneSnapshot.h via game.json · Nov 5, 2026Version 1.0.0