cesium-native 0.43.0
Loading...
Searching...
No Matches
GltfWriter.h
1#pragma once
2
3#include "CesiumGltfWriter/Library.h"
4
5#include <CesiumJsonWriter/ExtensionWriterContext.h>
6
7#include <span>
8
9// forward declarations
10namespace CesiumGltf {
11struct Model;
12}
13
15
20struct CESIUMGLTFWRITER_API GltfWriterResult {
24 std::vector<std::byte> gltfBytes;
25
29 std::vector<std::string> errors;
30
34 std::vector<std::string> warnings;
35};
36
40struct CESIUMGLTFWRITER_API GltfWriterOptions {
45 bool prettyPrint = false;
46
51 size_t binaryChunkByteAlignment = 4;
52};
53
57class CESIUMGLTFWRITER_API GltfWriter {
58public:
63
68
73
88 const CesiumGltf::Model& model,
89 const GltfWriterOptions& options = GltfWriterOptions()) const;
90
104 const CesiumGltf::Model& model,
105 const std::span<const std::byte>& bufferData,
106 const GltfWriterOptions& options = GltfWriterOptions()) const;
107
108private:
110};
111
112} // 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:14
Classes for working with glTF models.
Options for how to write a glTF.
Definition GltfWriter.h:40
The result of writing a glTF with GltfWriter::writeGltf or GltfWriter::writeGlb.
Definition GltfWriter.h:20
std::vector< std::string > errors
Errors, if any, that occurred during the write process.
Definition GltfWriter.h:29
std::vector< std::string > warnings
Warnings, if any, that occurred during the write process.
Definition GltfWriter.h:34
std::vector< std::byte > gltfBytes
The final generated std::vector<std::byte> of the glTF or glb.
Definition GltfWriter.h:24
This class is not meant to be instantiated directly. Use Model instead.
Definition Model.h:14