VTK  9.2.6
vtkGLTFReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGLTFReader.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 
62 #ifndef vtkGLTFReader_h
63 #define vtkGLTFReader_h
64 
65 #include "vtkIOGeometryModule.h" // For export macro
67 #include "vtkSmartPointer.h" // For SmartPointer
68 
69 #include <string> // For std::string
70 #include <vector> // For std::vector
71 
73 class vtkFieldData;
75 class vtkImageData;
76 class vtkStringArray;
77 
78 class VTKIOGEOMETRY_EXPORT vtkGLTFReader : public vtkMultiBlockDataSetAlgorithm
79 {
80 public:
81  static vtkGLTFReader* New();
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
86 
91  struct GLTFTexture
92  {
94  unsigned short MinFilterValue;
95  unsigned short MaxFilterValue;
96  unsigned short WrapSValue;
97  unsigned short WrapTValue;
98  };
99 
100  vtkIdType GetNumberOfTextures();
101  GLTFTexture GetGLTFTexture(vtkIdType textureIndex);
103 
105 
108  vtkSetFilePathMacro(FileName);
109  vtkGetFilePathMacro(FileName);
111 
113 
119  void SetApplyDeformationsToGeometry(bool flag);
120  vtkGetMacro(ApplyDeformationsToGeometry, bool);
121  vtkBooleanMacro(ApplyDeformationsToGeometry, bool);
123 
125 
131  vtkGetMacro(NumberOfAnimations, vtkIdType);
132  std::string GetAnimationName(vtkIdType animationIndex);
133  float GetAnimationDuration(vtkIdType animationIndex);
135 
137 
142  void EnableAnimation(vtkIdType animationIndex);
143  void DisableAnimation(vtkIdType animationIndex);
144  bool IsAnimationEnabled(vtkIdType animationIndex);
146 
148 
152  std::string GetSceneName(vtkIdType sceneIndex);
153  vtkGetMacro(NumberOfScenes, vtkIdType);
155 
157 
160  vtkGetMacro(CurrentScene, vtkIdType);
161  vtkSetMacro(CurrentScene, vtkIdType);
162  void SetScene(const std::string& scene);
164 
166 
174  vtkGetMacro(FrameRate, unsigned int);
175  vtkSetMacro(FrameRate, unsigned int);
177 
183  vtkStringArray* GetAllSceneNames();
184 
188  vtkDataArraySelection* GetAnimationSelection();
189 
190 protected:
191  vtkGLTFReader();
192  ~vtkGLTFReader() override;
193 
195 
197 
198  std::vector<GLTFTexture> Textures;
199 
203  void StoreTextureData();
204 
205  char* FileName = nullptr;
206 
207  vtkIdType CurrentScene = 0;
208  unsigned int FrameRate = 60;
209  vtkIdType NumberOfAnimations = 0;
210  vtkIdType NumberOfScenes = 0;
211 
212  bool IsModelLoaded = false;
213  bool IsMetaDataLoaded = false;
214 
215  bool ApplyDeformationsToGeometry = true;
216 
218 
221 
224 
229  void CreateSceneNamesArray();
230 
235  void CreateAnimationSelection();
236 
237 private:
238  vtkGLTFReader(const vtkGLTFReader&) = delete;
239  void operator=(const vtkGLTFReader&) = delete;
240 };
241 
242 #endif
Read a GLTF file.
Definition: vtkGLTFReader.h:78
Store vtkAlgorithm input/output information.
vtkSmartPointer< vtkGLTFDocumentLoader > Loader
a vtkAbstractArray subclass for strings
Materials are not directly applied to this reader's output.
Definition: vtkGLTFReader.h:91
int vtkIdType
Definition: vtkType.h:332
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
static vtkMultiBlockDataSetAlgorithm * New()
vtkSmartPointer< vtkMultiBlockDataSet > OutputDataSet
vtkSmartPointer< vtkStringArray > SceneNames
vtkSmartPointer< vtkDataArraySelection > AnimationSelection
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
Store on/off settings for data arrays, etc.
vtkSmartPointer< vtkImageData > Image
Definition: vtkGLTFReader.h:93
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned short MinFilterValue
Definition: vtkGLTFReader.h:94
vtkSmartPointer< vtkDataArraySelection > PreviousAnimationSelection
std::vector< GLTFTexture > Textures
Deserialize a GLTF model file.
Store zero or more vtkInformation instances.
unsigned short MaxFilterValue
Definition: vtkGLTFReader.h:95
represent and manipulate fields of data
Definition: vtkFieldData.h:62
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.