VTK  9.2.6
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 
100 #ifndef vtkGLTFImporter_h
101 #define vtkGLTFImporter_h
102 
103 #include "vtkIOImportModule.h" // For export macro
104 #include "vtkImporter.h"
105 #include "vtkSmartPointer.h" // For SmartPointer
106 
107 #include <map> // For map
108 #include <vector> // For vector
109 
110 class vtkActor;
111 class vtkCamera;
113 class vtkTexture;
114 
115 class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
116 {
117 public:
118  static vtkGLTFImporter* New();
119 
120  vtkTypeMacro(vtkGLTFImporter, vtkImporter);
121  void PrintSelf(ostream& os, vtkIndent indent) override;
122 
124 
130 
137 
141  std::string GetOutputsDescription() override { return this->OutputsDescription; };
142 
146  void UpdateTimeStep(double timestep) override;
147 
152 
156  std::string GetAnimationName(vtkIdType animationIndex) override;
157 
159 
162  void EnableAnimation(vtkIdType animationIndex) override;
163  void DisableAnimation(vtkIdType animationIndex) override;
164  bool IsAnimationEnabled(vtkIdType animationIndex) override;
166 
171 
175  std::string GetCameraName(vtkIdType camIndex) override;
176 
181  void SetCamera(vtkIdType camIndex) override;
182 
188  bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
189  double timeRange[2], vtkDoubleArray* timeSteps) override;
190 
191 protected:
192  vtkGLTFImporter() = default;
193  ~vtkGLTFImporter() override;
194 
195  int ImportBegin() override;
196  void ImportActors(vtkRenderer* renderer) override;
197  void ImportCameras(vtkRenderer* renderer) override;
198  void ImportLights(vtkRenderer* renderer) override;
199 
201 
202  char* FileName = nullptr;
203 
204  std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
205  std::map<int, vtkSmartPointer<vtkTexture>> Textures;
206  std::map<int, std::vector<vtkSmartPointer<vtkActor>>> Actors;
209  std::vector<bool> EnabledAnimations;
210  vtkIdType EnabledCamera = -1;
211 
212 private:
213  vtkGLTFImporter(const vtkGLTFImporter&) = delete;
214  void operator=(const vtkGLTFImporter&) = delete;
215 };
216 
217 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
a virtual camera for 3D rendering
Definition: vtkCamera.h:161
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:119
abstract specification for renderers
Definition: vtkRenderer.h:182
handles properties associated with a texture map
Definition: vtkTexture.h:178
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332