VTK  9.5.2
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
51
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 struct VTK_DEPRECATED_IN_9_4_0("Use vtkGLTFTexture instead.") GLTFTexture
88 {
90 unsigned short MinFilterValue;
91 unsigned short MaxFilterValue;
92 unsigned short WrapSValue;
93 unsigned short WrapTValue;
94 };
95
97 VTK_DEPRECATED_IN_9_4_0("Use GetTexture() instead.")
101
103
109
111
115 vtkSetSmartPointerMacro(Stream, vtkResourceStream);
116 vtkGetSmartPointerMacro(Stream, vtkResourceStream);
118
120
125 vtkSetMacro(GLBStart, vtkTypeInt64);
126 vtkGetMacro(GLBStart, vtkTypeInt64);
128
130
135 vtkSetSmartPointerMacro(URILoader, vtkURILoader);
136 vtkGetSmartPointerMacro(URILoader, vtkURILoader);
138
140
147 vtkGetMacro(ApplyDeformationsToGeometry, bool);
148 vtkBooleanMacro(ApplyDeformationsToGeometry, bool);
150
152
159 std::string GetAnimationName(vtkIdType animationIndex);
160 float GetAnimationDuration(vtkIdType animationIndex);
162
164
169 void EnableAnimation(vtkIdType animationIndex);
170 void DisableAnimation(vtkIdType animationIndex);
171 bool IsAnimationEnabled(vtkIdType animationIndex);
173
175
179 std::string GetSceneName(vtkIdType sceneIndex);
182
184
187 vtkGetMacro(CurrentScene, vtkIdType);
188 vtkSetMacro(CurrentScene, vtkIdType);
189 void SetScene(const std::string& scene);
191
193
202 vtkGetMacro(FrameRate, unsigned int);
203 vtkSetMacro(FrameRate, unsigned int);
205
207
214 vtkSetMacro(OutputPointsPrecision, int);
215 vtkGetMacro(OutputPointsPrecision, int);
217
224
229
230protected:
232 ~vtkGLTFReader() override;
233
235
237
239
244
249 virtual void InitializeLoader();
250
251 char* FileName = nullptr;
253 vtkTypeInt64 GLBStart = 0;
256
258 unsigned int FrameRate = 60;
261
262 bool IsModelLoaded = false;
263 bool IsMetaDataLoaded = false;
264
267
269
272
275
281
287
288private:
289 vtkGLTFReader(const vtkGLTFReader&) = delete;
290 void operator=(const vtkGLTFReader&) = delete;
291};
292
293VTK_ABI_NAMESPACE_END
294#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.
vtkSmartPointer< vtkGLTFDocumentLoader > Loader
void DisableAnimation(vtkIdType animationIndex)
Enable/Disable an animation.
vtkIdType CurrentScene
vtkSetFilePathMacro(FileName)
Set/Get the name of the file from which to read points.
vtkSmartPointer< vtkGLTFTexture > GetTexture(vtkIdType textureIndex)
unsigned int FrameRate
std::string GetAnimationName(vtkIdType animationIndex)
glTF models can contain multiple animations, with various names and duration.
vtkSmartPointer< vtkResourceStream > Stream
void StoreTextureData()
Create and store GLTFTexture struct for each image present in the model.
void SetScene(const std::string &scene)
Get/Set the scene to be used by the reader.
void CreateSceneNamesArray()
Create the SceneNames array, generate unique identifiers for each scene based on their glTF name,...
GLTFTexture GetGLTFTexture(vtkIdType textureIndex)
vtkSmartPointer< vtkDataArraySelection > AnimationSelection
float GetAnimationDuration(vtkIdType animationIndex)
glTF models can contain multiple animations, with various names and duration.
vtkIdType NumberOfScenes
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetApplyDeformationsToGeometry(bool flag)
The model's skinning transforms are computed and added to the different vtkPolyData objects' field da...
vtkDataArraySelection * GetAnimationSelection()
Get the vtkDataArraySelection object to enable/disable animations.
vtkSmartPointer< vtkStringArray > SceneNames
std::string GetSceneName(vtkIdType sceneIndex)
glTF models can contain multiple scene descriptions.
void CreateAnimationSelection()
Fill the AnimationSelection vtkDataArraySelection with animation names.
vtkStringArray * GetAllSceneNames()
Get a list all scenes names as a vtkStringArray, with duplicate names numbered and empty names replac...
vtkIdType NumberOfAnimations
vtkTypeInt64 GLBStart
vtkSmartPointer< vtkMultiBlockDataSet > OutputDataSet
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSmartPointer< vtkURILoader > URILoader
void EnableAnimation(vtkIdType animationIndex)
Enable/Disable an animation.
vtkIdType GetNumberOfTextures()
bool IsAnimationEnabled(vtkIdType animationIndex)
Enable/Disable an animation.
std::vector< vtkSmartPointer< vtkGLTFTexture > > Textures
bool ApplyDeformationsToGeometry
virtual void InitializeLoader()
Initialize the document loader.
vtkMTimeType LastStreamTimeStamp
vtkGetFilePathMacro(FileName)
Set/Get the name of the file from which to read points.
static vtkGLTFReader * New()
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkSmartPointer< vtkDataArraySelection > PreviousAnimationSelection
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
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:59
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:332
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287