VTK  9.1.0
vtkGLTFImporter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGLTFImporter.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 
97 #ifndef vtkGLTFImporter_h
98 #define vtkGLTFImporter_h
99 
100 #include "vtkIOImportModule.h" // For export macro
101 #include "vtkImporter.h"
102 #include "vtkSmartPointer.h" // For SmartPointer
103 
104 #include <map> // For map
105 #include <vector> // For vector
106 
107 class vtkActor;
108 class vtkCamera;
110 class vtkTexture;
111 
112 class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
113 {
114 public:
115  static vtkGLTFImporter* New();
116 
117  vtkTypeMacro(vtkGLTFImporter, vtkImporter);
118  void PrintSelf(ostream& os, vtkIndent indent) override;
119 
121 
127 
134 
138  std::string GetOutputsDescription() override { return this->OutputsDescription; };
139 
143  void UpdateTimeStep(double timestep) override;
144 
149 
153  std::string GetAnimationName(vtkIdType animationIndex) override;
154 
156 
159  void EnableAnimation(vtkIdType animationIndex) override;
160  void DisableAnimation(vtkIdType animationIndex) override;
161  bool IsAnimationEnabled(vtkIdType animationIndex) override;
163 
168 
172  std::string GetCameraName(vtkIdType camIndex) override;
173 
178  void SetCamera(vtkIdType camIndex) override;
179 
185  bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
186  double timeRange[2], vtkDoubleArray* timeSteps) override;
187 
188 protected:
189  vtkGLTFImporter() = default;
190  ~vtkGLTFImporter() override;
191 
192  int ImportBegin() override;
193  void ImportActors(vtkRenderer* renderer) override;
194  void ImportCameras(vtkRenderer* renderer) override;
195  void ImportLights(vtkRenderer* renderer) override;
196 
198 
199  char* FileName = nullptr;
200 
201  std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
202  std::map<int, vtkSmartPointer<vtkTexture>> Textures;
203  std::map<int, std::vector<vtkSmartPointer<vtkActor>>> Actors;
206  std::vector<bool> EnabledAnimations;
207  vtkIdType EnabledCamera = -1;
208 
209 private:
210  vtkGLTFImporter(const vtkGLTFImporter&) = delete;
211  void operator=(const vtkGLTFImporter&) = delete;
212 };
213 
214 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
a virtual camera for 3D rendering
Definition: vtkCamera.h:155
dynamic, self-adjusting array of double
Deserialize a GLTF model file.
Import a GLTF file.
void DisableAnimation(vtkIdType animationIndex) override
Enable/Disable/Get the status of specific animations.
vtkIdType GetNumberOfCameras() override
Get the number of available cameras.
std::map< int, vtkSmartPointer< vtkCamera > > Cameras
~vtkGLTFImporter() override
std::string OutputsDescription
std::map< int, vtkSmartPointer< vtkTexture > > Textures
void ApplySkinningMorphing()
std::string GetOutputsDescription() override
Get a printable string describing all outputs.
vtkSetFilePathMacro(FileName)
Specify the name of the file to read.
vtkGLTFImporter()=default
void ImportActors(vtkRenderer *renderer) override
bool IsAnimationEnabled(vtkIdType animationIndex) override
Enable/Disable/Get the status of specific animations.
vtkGetFilePathMacro(FileName)
Specify the name of the file to read.
static vtkGLTFImporter * New()
vtkSmartPointer< vtkGLTFDocumentLoader > Loader
void UpdateTimeStep(double timestep) override
update timestep
void EnableAnimation(vtkIdType animationIndex) override
Enable/Disable/Get the status of specific animations.
void SetCamera(vtkIdType camIndex) override
Enable a specific camera.
int ImportBegin() override
std::string GetAnimationName(vtkIdType animationIndex) override
Return the name of the animation.
std::map< int, std::vector< vtkSmartPointer< vtkActor > > > Actors
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::string GetCameraName(vtkIdType camIndex) override
Get the name of a camera.
vtkSmartPointer< vtkCamera > GetCamera(unsigned int id)
glTF defines multiple camera objects, but no default behavior for which camera should be used.
void ImportLights(vtkRenderer *renderer) override
bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int &nbTimeSteps, double timeRange[2], vtkDoubleArray *timeSteps) override
Get temporal informations for the currently enabled animations.
std::vector< bool > EnabledAnimations
vtkIdType GetNumberOfAnimations() override
Get the number of available animations.
void ImportCameras(vtkRenderer *renderer) override
importer abstract class
Definition: vtkImporter.h:60
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract specification for renderers
Definition: vtkRenderer.h:173
handles properties associated with a texture map
Definition: vtkTexture.h:175
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332