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
61
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
73class vtkFieldData;
75class vtkImageData;
76class vtkStringArray;
77
78class VTKIOGEOMETRY_EXPORT vtkGLTFReader : public vtkMultiBlockDataSetAlgorithm
79{
80public:
81 static vtkGLTFReader* New();
83 void PrintSelf(ostream& os, vtkIndent indent) override;
84
86
92 {
94 unsigned short MinFilterValue;
95 unsigned short MaxFilterValue;
96 unsigned short WrapSValue;
97 unsigned short WrapTValue;
98 };
99
103
105
111
113
120 vtkGetMacro(ApplyDeformationsToGeometry, bool);
121 vtkBooleanMacro(ApplyDeformationsToGeometry, bool);
123
125
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);
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
184
189
190protected:
192 ~vtkGLTFReader() override;
193
195
197
198 std::vector<GLTFTexture> Textures;
199
204
205 char* FileName = nullptr;
206
208 unsigned int FrameRate = 60;
211
212 bool IsModelLoaded = false;
213 bool IsMetaDataLoaded = false;
214
216
218
221
224
230
236
237private:
238 vtkGLTFReader(const vtkGLTFReader&) = delete;
239 void operator=(const vtkGLTFReader&) = delete;
240};
241
242#endif
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
~vtkGLTFReader() override
vtkSetFilePathMacro(FileName)
Set/Get the name of the file from which to read points.
unsigned int FrameRate
std::string GetAnimationName(vtkIdType animationIndex)
glTF models can contain multiple animations, with various names and duration.
std::vector< GLTFTexture > Textures
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
vtkSmartPointer< vtkMultiBlockDataSet > OutputDataSet
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void EnableAnimation(vtkIdType animationIndex)
Enable/Disable an animation.
vtkIdType GetNumberOfTextures()
bool IsAnimationEnabled(vtkIdType animationIndex)
Enable/Disable an animation.
bool ApplyDeformationsToGeometry
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:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Hold a reference to a vtkObjectBase instance.
a vtkAbstractArray subclass for strings
Materials are not directly applied to this reader's output.
unsigned short MinFilterValue
unsigned short MaxFilterValue
vtkSmartPointer< vtkImageData > Image
int vtkIdType
Definition vtkType.h:332