VTK  9.7.1
vtkGLTFDocumentLoaderInternals.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
11 #ifndef vtkGLTFDocumentLoaderInternals_h
12 #define vtkGLTFDocumentLoaderInternals_h
13 
14 #include "vtkGLTFDocumentLoader.h" // For vtkGLTFDocumentLoader
15 #include <vtk_nlohmannjson.h>
16 #include VTK_NLOHMANN_JSON(json.hpp)
17 
18 #include <string> // For string
19 #include <vector> // For vector
20 
21 VTK_ABI_NAMESPACE_BEGIN
22 
24 {
25 public:
27 
36  bool LoadModelMetaData(
37  bool quiet, bool& binary, std::vector<std::string>& extensionsUsedByLoader);
38 
42  bool LoadBuffers(bool firstBufferIsGLB);
43 
45 
46  static const unsigned short GL_POINTS = 0x0000;
47  static const unsigned short GL_LINES = 0x0001;
48  static const unsigned short GL_LINE_LOOP = 0x0002;
49  static const unsigned short GL_LINE_STRIP = 0x0003;
50  static const unsigned short GL_TRIANGLES = 0x0004;
51  static const unsigned short GL_TRIANGLE_STRIP = 0x0005;
52  static const unsigned short GL_TRIANGLE_FAN = 0x0006;
53 
54 private:
58  bool LoadNodeExtensions(
59  const nlohmann::json& root, vtkGLTFDocumentLoader::Node::Extensions& nodeExtensions);
60 
64  bool LoadExtensions(const nlohmann::json& root, vtkGLTFDocumentLoader::Extensions& extensions);
65 
71  bool LoadBuffer(const nlohmann::json& root, std::vector<char>& buffer);
72 
80  bool LoadFileMetaData(bool quiet, bool& binary, nlohmann::json& gltfRoot);
81 
87  bool LoadSkin(const nlohmann::json& root, vtkGLTFDocumentLoader::Skin& skin);
88 
92  bool LoadBufferView(const nlohmann::json& root, vtkGLTFDocumentLoader::BufferView& bufferView);
93 
97  bool LoadSparse(const nlohmann::json& root, vtkGLTFDocumentLoader::Accessor::Sparse& sparse);
98 
102  bool LoadAccessorBounds(const nlohmann::json& root, vtkGLTFDocumentLoader::Accessor& accessor);
103 
107  bool LoadCamera(const nlohmann::json& root, vtkGLTFDocumentLoader::Camera& camera);
108 
112  bool LoadAccessor(const nlohmann::json& root, vtkGLTFDocumentLoader::Accessor& accessor);
113 
119  bool LoadPrimitive(const nlohmann::json& root, vtkGLTFDocumentLoader::Primitive& primitive);
120 
124  bool LoadMesh(const nlohmann::json& root, vtkGLTFDocumentLoader::Mesh& mesh);
125 
129  bool LoadTextureInfo(const nlohmann::json& root, vtkGLTFDocumentLoader::TextureInfo& textureInfo);
130 
134  bool LoadMaterial(const nlohmann::json& root, vtkGLTFDocumentLoader::Material& material);
135 
140  bool LoadAnimation(const nlohmann::json& root, vtkGLTFDocumentLoader::Animation& animation);
141 
146  bool LoadScene(const nlohmann::json& root, vtkGLTFDocumentLoader::Scene& scene);
147 
152  bool LoadNode(const nlohmann::json& root, vtkGLTFDocumentLoader::Node& node);
153 
158  bool LoadImage(const nlohmann::json& root, vtkGLTFDocumentLoader::Image& image);
159 
167  bool LoadTexture(const nlohmann::json& root, vtkGLTFDocumentLoader::Texture& texture);
168 
172  bool LoadSampler(const nlohmann::json& root, vtkGLTFDocumentLoader::Sampler& sampler);
173 
177  vtkGLTFDocumentLoader::AccessorType AccessorTypeStringToEnum(std::string typeName);
178 
182  vtkGLTFDocumentLoader::Material::AlphaModeType MaterialAlphaModeStringToEnum(
183  std::string alphaModeString);
184 
189  bool LoadKHRLightsPunctualNodeExtension(const nlohmann::json& root,
191 
196  bool LoadKHRLightsPunctualExtension(
197  const nlohmann::json& root, vtkGLTFDocumentLoader::Extensions::KHRLightsPunctual& lights);
198 
202  bool LoadKHRLightsPunctualExtensionLight(
203  const nlohmann::json& root, vtkGLTFDocumentLoader::Extensions::KHRLightsPunctual::Light& light);
204 };
205 
206 VTK_ABI_NAMESPACE_END
207 #endif
208 
209 // VTK-HeaderTest-Exclude: vtkGLTFDocumentLoaderInternals.h
AccessorType
Defines an accessor's type.
This struct describes a glTF animation object.
This struct describes a glTF textureInfo object, mostly used in material descriptions They contain tw...
This struct describes a glTF scene object.
Internal class for vtkGLTFDocumentLoader.
This struct describes a glTF texture object.
This struct describes a glTF camera object.
This struct describes a glTF node object.
This struct describes a glTF primitive object.
bool LoadBuffers(bool firstBufferIsGLB)
Reads the model's buffer metadata, then uses it to load all buffers into the model.
This struct describes an accessor.sparse glTF object.
This struct contains extension metadata.
bool LoadModelMetaData(bool quiet, bool &binary, std::vector< std::string > &extensionsUsedByLoader)
Reset internal Model struct, and serialize glTF metadata (all json information) into it...
This struct describes a glTF image object.
This struct describes a glTF material object.
This struct describes a glTF sampler object.
Deserialize a GLTF model file.
This struct describes an accessor glTF object.
This struct describes a glTF bufferView object.
This struct describes a glTF asset.
static const unsigned short GL_TRIANGLE_FAN
This struct describes a glTF mesh object.
static const unsigned short GL_TRIANGLE_STRIP