VTK  9.0.1
vtkGLTFDocumentLoaderInternals.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGLTFDocumentLoader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
23 #ifndef vtkGLTFDocumentLoaderInternals_h
24 #define vtkGLTFDocumentLoaderInternals_h
25 
26 #include "vtkGLTFDocumentLoader.h" // For vtkGLTFDocumentLoader
27 #include "vtk_jsoncpp_fwd.h" // For Json forward declaration
28 
29 #include <string> // For string
30 #include <vector> // For vector
31 
33 {
34 public:
36 
42  bool LoadModelMetaDataFromFile(std::string& FileName, std::vector<std::string>& usedExtensions);
44 
48  bool LoadBuffers(bool firstBufferIsGLB);
49 
50  static const unsigned short GL_POINTS = 0x0000;
51  static const unsigned short GL_LINES = 0x0001;
52  static const unsigned short GL_LINE_LOOP = 0x0002;
53  static const unsigned short GL_LINE_STRIP = 0x0003;
54  static const unsigned short GL_TRIANGLES = 0x0004;
55  static const unsigned short GL_TRIANGLE_STRIP = 0x0005;
56  static const unsigned short GL_TRIANGLE_FAN = 0x0006;
57 
58 private:
62  bool LoadNodeExtensions(
63  const Json::Value& root, vtkGLTFDocumentLoader::Node::Extensions& nodeExtensions);
64 
68  bool LoadExtensions(const Json::Value& root, vtkGLTFDocumentLoader::Extensions& extensions);
69 
75  bool LoadBuffer(
76  const Json::Value& root, std::vector<char>& buffer, const std::string& glTFFileName);
77 
82  bool LoadFileMetaData(const std::string& fileName, Json::Value& gltfRoot);
83 
89  bool LoadSkin(const Json::Value& root, vtkGLTFDocumentLoader::Skin& skin);
90 
94  bool LoadBufferView(const Json::Value& root, vtkGLTFDocumentLoader::BufferView& bufferView);
95 
99  bool LoadSparse(const Json::Value& root, vtkGLTFDocumentLoader::Accessor::Sparse& sparse);
100 
104  bool LoadAccessorBounds(const Json::Value& root, vtkGLTFDocumentLoader::Accessor& accessor);
105 
109  bool LoadCamera(const Json::Value& root, vtkGLTFDocumentLoader::Camera& camera);
110 
114  bool LoadAccessor(const Json::Value& root, vtkGLTFDocumentLoader::Accessor& accessor);
115 
121  bool LoadPrimitive(const Json::Value& root, vtkGLTFDocumentLoader::Primitive& primitive);
122 
126  bool LoadMesh(const Json::Value& root, vtkGLTFDocumentLoader::Mesh& mesh);
127 
131  bool LoadTextureInfo(const Json::Value& root, vtkGLTFDocumentLoader::TextureInfo& textureInfo);
132 
136  bool LoadMaterial(const Json::Value& root, vtkGLTFDocumentLoader::Material& material);
137 
142  bool LoadAnimation(const Json::Value& root, vtkGLTFDocumentLoader::Animation& animation);
143 
148  bool LoadScene(const Json::Value& root, vtkGLTFDocumentLoader::Scene& scene);
149 
154  bool LoadNode(const Json::Value& root, vtkGLTFDocumentLoader::Node& node);
155 
160  bool LoadImage(const Json::Value& root, vtkGLTFDocumentLoader::Image& image);
161 
169  bool LoadTexture(const Json::Value& root, vtkGLTFDocumentLoader::Texture& texture);
170 
174  bool LoadSampler(const Json::Value& root, vtkGLTFDocumentLoader::Sampler& sampler);
175 
179  vtkGLTFDocumentLoader::AccessorType AccessorTypeStringToEnum(std::string typeName);
180 
184  vtkGLTFDocumentLoader::Material::AlphaModeType MaterialAlphaModeStringToEnum(
185  std::string alphaModeString);
186 
191  bool LoadKHRLightsPunctualNodeExtension(const Json::Value& root,
193 
198  bool LoadKHRLightsPunctualExtension(
199  const Json::Value& root, vtkGLTFDocumentLoader::Extensions::KHRLightsPunctual& lights);
200 
204  bool LoadKHRLightsPunctualExtensionLight(
205  const Json::Value& root, vtkGLTFDocumentLoader::Extensions::KHRLightsPunctual::Light& light);
206 };
207 
208 #endif
209 
210 // VTK-HeaderTest-Exclude: vtkGLTFDocumentLoaderInternals.h
Internal class for vtkGLTFDocumentLoader.
bool LoadBuffers(bool firstBufferIsGLB)
Reads the model's buffer metadata, then uses it to load all buffers into the model.
bool LoadModelMetaDataFromFile(std::string &FileName, std::vector< std::string > &usedExtensions)
Reset internal Model struct, and serialize glTF metadata (all json information) into it.
static const unsigned short GL_TRIANGLE_FAN
static const unsigned short GL_TRIANGLE_STRIP
Deserialize a GLTF model file.
AccessorType
Defines an accessor's type.
@ image
Definition: vtkX3D.h:380
@ string
Definition: vtkX3D.h:496
This struct describes an accessor.sparse glTF object.
This struct describes an accessor glTF object.
This struct describes a glTF animation object.
This struct describes a glTF bufferView object.
This struct describes a glTF camera object.
This struct contains extension metadata.
This struct describes a glTF image object.
This struct describes a glTF material object.
This struct describes a glTF mesh object.
This struct describes a glTF node object.
This struct describes a glTF primitive object.
This struct describes a glTF sampler object.
This struct describes a glTF scene object.
This struct describes a glTF asset.
This struct describes a glTF textureInfo object, mostly used in material descriptions They contain tw...
This struct describes a glTF texture object.