pub struct Scene { /* private fields */ }Expand description
Top-level scene container. Holds a flat collection of grids
keyed by GridId.
S2.0 only exposes registration / removal / lookup. Address math helpers (S2.x), edit API (S2.x), and rendering composition (S3) land in later sub-substages.
Implementations§
Source§impl Scene
impl Scene
Sourcepub fn to_snapshot(&self) -> SceneSnapshot
pub fn to_snapshot(&self) -> SceneSnapshot
Capture the scene’s full state as a serde-friendly value.
Each chunk is encoded via
roxlap_formats::vxl::serialize; the rest is plain field
data.
Grid iteration order in the produced snapshot is sorted by
GridId so two snapshots of the same scene produce
byte-identical output (the live HashMap iteration order
would be non-deterministic).
Sourcepub fn from_snapshot(snap: &SceneSnapshot) -> Result<Self, FromSnapshotError>
pub fn from_snapshot(snap: &SceneSnapshot) -> Result<Self, FromSnapshotError>
Restore a Scene from a snapshot. Each chunk’s bytes are
re-parsed via roxlap_formats::vxl::parse and re-armed
for edits via roxlap_formats::vxl::Vxl::reserve_edit_capacity.
§Errors
Returns FromSnapshotError::ChunkParse tagged with the
owning grid + chunk index if any chunk’s bytes fail to
parse. The partial scene is dropped — restoration is
all-or-nothing.
Source§impl Scene
impl Scene
Sourcepub fn grid_count(&self) -> usize
pub fn grid_count(&self) -> usize
Number of grids currently registered.
Sourcepub fn add_grid(&mut self, transform: GridTransform) -> GridId
pub fn add_grid(&mut self, transform: GridTransform) -> GridId
Register a new grid. Returns its fresh, unique GridId.
Sourcepub fn remove_grid(&mut self, id: GridId) -> Option<Grid>
pub fn remove_grid(&mut self, id: GridId) -> Option<Grid>
Remove a grid by id. Returns the removed Grid (so the
caller can reclaim its chunks) or None if the id wasn’t
registered. Removed ids are not reissued.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scene
impl RefUnwindSafe for Scene
impl Send for Scene
impl Sync for Scene
impl Unpin for Scene
impl UnsafeUnpin for Scene
impl UnwindSafe for Scene
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more