Lagrange
Loading...
Searching...
No Matches
serialize_simple_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/SimpleScene.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 simple_scene_format_version()
34{
35 return 1;
36}
37
50template <typename Scalar, typename Index, size_t Dimension>
51LA_SERIALIZATION2_API std::vector<uint8_t> serialize_simple_scene(
53 const SerializeOptions& options = {});
54
71template <typename SceneType>
72LA_SERIALIZATION2_API SceneType
73deserialize_simple_scene(span<const uint8_t> buffer, const DeserializeOptions& options = {});
74
88template <typename Scalar, typename Index, size_t Dimension>
89LA_SERIALIZATION2_API void save_simple_scene(
90 const fs::path& filename,
91 const scene::SimpleScene<Scalar, Index, Dimension>& scene,
92 const SerializeOptions& options = {});
93
109template <typename SceneType>
110LA_SERIALIZATION2_API SceneType
111load_simple_scene(const fs::path& filename, const DeserializeOptions& options = {});
112
114
115} // namespace lagrange::serialization
Simple scene container for instanced meshes.
Definition SimpleScene.h:62
LA_SERIALIZATION2_API void save_simple_scene(const fs::path &filename, const scene::SimpleScene< Scalar, Index, Dimension > &scene, const SerializeOptions &options={})
Save a SimpleScene to a file.
Definition serialize_simple_scene.cpp:382
LA_SERIALIZATION2_API SceneType load_simple_scene(const fs::path &filename, const DeserializeOptions &options={})
Load a SimpleScene from a file.
Definition serialize_simple_scene.cpp:395
LA_SERIALIZATION2_API SceneType deserialize_simple_scene(span< const uint8_t > buffer, const DeserializeOptions &options={})
Deserialize a SimpleScene from a byte buffer.
Definition serialize_simple_scene.cpp:302
constexpr uint32_t simple_scene_format_version()
Current simple scene serialization format version.
Definition serialize_simple_scene.h:33
LA_SERIALIZATION2_API std::vector< uint8_t > serialize_simple_scene(const scene::SimpleScene< Scalar, Index, Dimension > &scene, const SerializeOptions &options={})
Serialize a SimpleScene to a byte buffer.
Definition serialize_simple_scene.cpp:285
::nonstd::span< T, Extent > span
A bounds-safe view for sequences of objects.
Definition span.h:27
Options for deserialization (load/deserialize functions).
Definition types.h:39
Options for serialization (save/serialize functions).
Definition types.h:22