VTK  9.3.20240425
vtkGLTFReader.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
52#ifndef vtkGLTFReader_h
53#define vtkGLTFReader_h
54
55#include "vtkIOGeometryModule.h" // For export macro
57#include "vtkResourceStream.h" // For vtkResourceStream
58#include "vtkSmartPointer.h" // For vtkSmartPointer
59#include "vtkURILoader.h" // For vtkURILoader
60
61#include <string> // For std::string
62#include <vector> // For std::vector
63
64VTK_ABI_NAMESPACE_BEGIN
66class vtkFieldData;
68class vtkImageData;
69class vtkStringArray;
70class vtkTexture;
71class vtkGLTFTexture;
72
73class VTKIOGEOMETRY_EXPORT vtkGLTFReader : public vtkMultiBlockDataSetAlgorithm
74{
75public:
76 static vtkGLTFReader* New();
78 void PrintSelf(ostream& os, vtkIndent indent) override;
79
81
87 VTK_DEPRECATED_IN_9_4_0("Use vtkGLTFTexture instead.")
89 {
91 unsigned short MinFilterValue;
92 unsigned short MaxFilterValue;
93 unsigned short WrapSValue;
94 unsigned short WrapTValue;
95 };
96
98 VTK_DEPRECATED_IN_9_4_0("Use GetTexture() instead.")
99 GLTFTexture GetGLTFTexture(vtkIdType textureIndex);
100 vtkSmartPointer<vtkGLTFTexture> GetTexture(vtkIdType textureIndex);
102
104
107 vtkSetFilePathMacro(FileName);
108 vtkGetFilePathMacro(FileName);
110
112
116 vtkSetSmartPointerMacro(Stream, vtkResourceStream);
117 vtkGetSmartPointerMacro(Stream, vtkResourceStream);
119
121
126 vtkSetMacro(GLBStart, vtkTypeInt64);
127 vtkGetMacro(GLBStart, vtkTypeInt64);
129
131
136 vtkSetSmartPointerMacro(URILoader, vtkURILoader);
137 vtkGetSmartPointerMacro(URILoader, vtkURILoader);
139
141
147 void SetApplyDeformationsToGeometry(bool flag);
148 vtkGetMacro(ApplyDeformationsToGeometry, bool);
149 vtkBooleanMacro(ApplyDeformationsToGeometry, bool);
151
153
159 vtkGetMacro(NumberOfAnimations, vtkIdType);
160 std::string GetAnimationName(vtkIdType animationIndex);
161 float GetAnimationDuration(vtkIdType animationIndex);
163
165
170 void EnableAnimation(vtkIdType animationIndex);
171 void DisableAnimation(vtkIdType animationIndex);
172 bool IsAnimationEnabled(vtkIdType animationIndex);
174
176
180 std::string GetSceneName(vtkIdType sceneIndex);
181 vtkGetMacro(NumberOfScenes, vtkIdType);
183
185
188 vtkGetMacro(CurrentScene, vtkIdType);
189 vtkSetMacro(CurrentScene, vtkIdType);
190 void SetScene(const std::string& scene);
192
194
203 vtkGetMacro(FrameRate, unsigned int);
204 vtkSetMacro(FrameRate, unsigned int);
206
208
215 vtkSetMacro(OutputPointsPrecision, int);
216 vtkGetMacro(OutputPointsPrecision, int);
218
224 vtkStringArray* GetAllSceneNames();
225
229 vtkDataArraySelection* GetAnimationSelection();
230
231protected:
233 ~vtkGLTFReader() override;
234
236
238
240
244 void StoreTextureData();
245
250 virtual void InitializeLoader();
251
252 char* FileName = nullptr;
254 vtkTypeInt64 GLBStart = 0;
255 vtkMTimeType LastStreamTimeStamp = 0;
257
258 vtkIdType CurrentScene = 0;
259 unsigned int FrameRate = 60;
260 vtkIdType NumberOfAnimations = 0;
261 vtkIdType NumberOfScenes = 0;
262
263 bool IsModelLoaded = false;
264 bool IsMetaDataLoaded = false;
265
266 bool ApplyDeformationsToGeometry = true;
267 int OutputPointsPrecision = vtkAlgorithm::SINGLE_PRECISION;
268
270
271 vtkSmartPointer<vtkDataArraySelection> PreviousAnimationSelection;
273
274 int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
276
281 void CreateSceneNamesArray();
282
287 void CreateAnimationSelection();
288
289private:
290 vtkGLTFReader(const vtkGLTFReader&) = delete;
291 void operator=(const vtkGLTFReader&) = delete;
292};
293
294VTK_ABI_NAMESPACE_END
295#endif
Superclass for all sources, filters, and sinks in VTK.
Store on/off settings for data arrays, etc.
represent and manipulate fields of data
Deserialize a GLTF model file.
Read a GLTF file.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType GetNumberOfTextures()
static vtkGLTFReader * New()
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Composite dataset that organizes datasets into blocks.
Abstract class used for custom streams.
Hold a reference to a vtkObjectBase instance.
a vtkAbstractArray subclass for strings
handles properties associated with a texture map
Definition vtkTexture.h:167
Helper class for readers and importer that need to load more than one resource.
Materials are not directly applied to this reader's output.
unsigned short MinFilterValue
unsigned short MaxFilterValue
vtkSmartPointer< vtkImageData > Image
#define VTK_DEPRECATED_IN_9_4_0(reason)
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270