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 
58 #ifndef vtkGLTFImporter_h
59 #define vtkGLTFImporter_h
60 
61 #include "vtkIOImportModule.h" // For export macro
62 #include "vtkImporter.h"
63 #include "vtkSmartPointer.h" // For SmartPointer
64 
65 #include <map> // For map
66 #include <vector> // For vector
67 
68 class vtkActor;
69 class vtkCamera;
71 class vtkTexture;
72 
73 class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
74 {
75 public:
76  static vtkGLTFImporter* New();
77 
78  vtkTypeMacro(vtkGLTFImporter, vtkImporter);
79  void PrintSelf(ostream& os, vtkIndent indent) override;
80 
82 
88 
95 
99  std::string GetOutputsDescription() override { return this->OutputsDescription; };
100 
104  void UpdateTimeStep(double timestep) override;
105 
110 
114  std::string GetAnimationName(vtkIdType animationIndex) override;
115 
117 
120  void EnableAnimation(vtkIdType animationIndex) override;
121  void DisableAnimation(vtkIdType animationIndex) override;
122  bool IsAnimationEnabled(vtkIdType animationIndex) override;
124 
129 
133  std::string GetCameraName(vtkIdType camIndex) override;
134 
139  void SetCamera(vtkIdType camIndex) override;
140 
146  bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
147  double timeRange[2], vtkDoubleArray* timeSteps) override;
148 
149 protected:
150  vtkGLTFImporter() = default;
151  ~vtkGLTFImporter() override;
152 
153  int ImportBegin() override;
154  void ImportActors(vtkRenderer* renderer) override;
155  void ImportCameras(vtkRenderer* renderer) override;
156  void ImportLights(vtkRenderer* renderer) override;
157 
159 
160  char* FileName = nullptr;
161 
162  std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
163  std::map<int, vtkSmartPointer<vtkTexture>> Textures;
164  std::map<int, std::vector<vtkSmartPointer<vtkActor>>> Actors;
167  std::vector<bool> EnabledAnimations;
168  vtkIdType EnabledCamera = -1;
169 
170 private:
171  vtkGLTFImporter(const vtkGLTFImporter&) = delete;
172  void operator=(const vtkGLTFImporter&) = delete;
173 };
174 
175 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
a virtual camera for 3D rendering
Definition: vtkCamera.h:46
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:34
abstract specification for renderers
Definition: vtkRenderer.h:73
handles properties associated with a texture map
Definition: vtkTexture.h:66
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332