Lagrange
Loading...
Searching...
No Matches
serialize_scene.h
1/*
2 * Copyright 2026 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/fs/filesystem.h>
15#include <lagrange/scene/Scene.h>
16#include <lagrange/serialization/api.h>
17#include <lagrange/serialization/types.h>
18#include <lagrange/utils/span.h>
19
20#include <cstdint>
21#include <vector>
22
23namespace lagrange::serialization {
24
27
33constexpr uint32_t scene_format_version()
34{
35 return 1;
36}
37
49template <typename Scalar, typename Index>
50LA_SERIALIZATION2_API std::vector<uint8_t> serialize_scene(
51 const scene::Scene<Scalar, Index>& scene,
52 const SerializeOptions& options = {});
53
70template <typename SceneType>
71LA_SERIALIZATION2_API SceneType
72deserialize_scene(span<const uint8_t> buffer, const DeserializeOptions& options = {});
73
86template <typename Scalar, typename Index>
87LA_SERIALIZATION2_API void save_scene(
88 const fs::path& filename,
89 const scene::Scene<Scalar, Index>& scene,
90 const SerializeOptions& options = {});
91
107template <typename SceneType>
108LA_SERIALIZATION2_API SceneType
109load_scene(const fs::path& filename, const DeserializeOptions& options = {});
110
112
113} // namespace lagrange::serialization
constexpr uint32_t scene_format_version()
Current scene serialization format version.
Definition serialize_scene.h:33
LA_SERIALIZATION2_API SceneType load_scene(const fs::path &filename, const DeserializeOptions &options={})
Load a Scene from a file.
Definition serialize_scene.cpp:851
LA_SERIALIZATION2_API void save_scene(const fs::path &filename, const scene::Scene< Scalar, Index > &scene, const SerializeOptions &options={})
Save a Scene to a file.
Definition serialize_scene.cpp:838
LA_SERIALIZATION2_API SceneType deserialize_scene(span< const uint8_t > buffer, const DeserializeOptions &options={})
Deserialize a Scene from a byte buffer.
Definition serialize_scene.cpp:766
LA_SERIALIZATION2_API std::vector< uint8_t > serialize_scene(const scene::Scene< Scalar, Index > &scene, const SerializeOptions &options={})
Serialize a Scene to a byte buffer.
Definition serialize_scene.cpp:749
::nonstd::span< T, Extent > span
A bounds-safe view for sequences of objects.
Definition span.h:27
Definition Scene.h:353
Options for deserialization (load/deserialize functions).
Definition types.h:39
Options for serialization (save/serialize functions).
Definition types.h:22