cesium-native 0.44.2
Loading...
Searching...
No Matches
GltfWriter.h
1#pragma once
2
3#include <CesiumGltfWriter/Library.h>
4#include <CesiumJsonWriter/ExtensionWriterContext.h>
5
6#include <span>
7
8// forward declarations
9namespace CesiumGltf {
10struct Model;
11}
12
14
19struct CESIUMGLTFWRITER_API GltfWriterResult {
23 std::vector<std::byte> gltfBytes;
24
28 std::vector<std::string> errors;
29
33 std::vector<std::string> warnings;
34};
35
39struct CESIUMGLTFWRITER_API GltfWriterOptions {
44 bool prettyPrint = false;
45
50 size_t binaryChunkByteAlignment = 4;
51};
52
56class CESIUMGLTFWRITER_API GltfWriter {
57public:
62
67
72
87 const CesiumGltf::Model& model,
88 const GltfWriterOptions& options = GltfWriterOptions()) const;
89
103 const CesiumGltf::Model& model,
104 const std::span<const std::byte>& bufferData,
105 const GltfWriterOptions& options = GltfWriterOptions()) const;
106
107private:
109};
110
111} // namespace CesiumGltfWriter
GltfWriterResult writeGlb(const CesiumGltf::Model &model, const std::span< const std::byte > &bufferData, const GltfWriterOptions &options=GltfWriterOptions()) const
Serializes the provided model into a glb byte vector.
CesiumJsonWriter::ExtensionWriterContext & getExtensions()
Gets the context used to control how glTF extensions are written.
const CesiumJsonWriter::ExtensionWriterContext & getExtensions() const
Gets the context used to control how glTF extensions are written.
GltfWriter()
Constructs a new instance.
GltfWriterResult writeGltf(const CesiumGltf::Model &model, const GltfWriterOptions &options=GltfWriterOptions()) const
Serializes the provided model into a glTF JSON byte vector.
A context for writing extensions where known extensions and their handlers can be registered.
Classes for writing glTF models.
Definition GltfWriter.h:13
Classes for working with glTF models.
Options for how to write a glTF.
Definition GltfWriter.h:39
The result of writing a glTF with GltfWriter::writeGltf or GltfWriter::writeGlb.
Definition GltfWriter.h:19
std::vector< std::string > errors
Errors, if any, that occurred during the write process.
Definition GltfWriter.h:28
std::vector< std::string > warnings
Warnings, if any, that occurred during the write process.
Definition GltfWriter.h:33
std::vector< std::byte > gltfBytes
The final generated std::vector<std::byte> of the glTF or glb.
Definition GltfWriter.h:23
This class is not meant to be instantiated directly. Use Model instead.
Definition Model.h:14