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 
70 #ifndef vtkGLTFImporter_h
71 #define vtkGLTFImporter_h
72 
73 #include "vtkIOImportModule.h" // For export macro
74 #include "vtkImporter.h"
75 #include "vtkSmartPointer.h" // For SmartPointer
76 
77 #include <map> // For map
78 #include <vector> // For vector
79 
80 class vtkActor;
81 class vtkCamera;
83 class vtkTexture;
84 
85 class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
86 {
87 public:
88  static vtkGLTFImporter* New();
89 
90  vtkTypeMacro(vtkGLTFImporter, vtkImporter);
91  void PrintSelf(ostream& os, vtkIndent indent) override;
92 
94 
100 
107 
111  std::string GetOutputsDescription() override { return this->OutputsDescription; };
112 
116  void UpdateTimeStep(double timestep) override;
117 
122 
126  std::string GetAnimationName(vtkIdType animationIndex) override;
127 
129 
132  void EnableAnimation(vtkIdType animationIndex) override;
133  void DisableAnimation(vtkIdType animationIndex) override;
134  bool IsAnimationEnabled(vtkIdType animationIndex) override;
136 
141 
145  std::string GetCameraName(vtkIdType camIndex) override;
146 
151  void SetCamera(vtkIdType camIndex) override;
152 
158  bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
159  double timeRange[2], vtkDoubleArray* timeSteps) override;
160 
161 protected:
162  vtkGLTFImporter() = default;
163  ~vtkGLTFImporter() override;
164 
165  int ImportBegin() override;
166  void ImportActors(vtkRenderer* renderer) override;
167  void ImportCameras(vtkRenderer* renderer) override;
168  void ImportLights(vtkRenderer* renderer) override;
169 
171 
172  char* FileName = nullptr;
173 
174  std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
175  std::map<int, vtkSmartPointer<vtkTexture>> Textures;
176  std::map<int, std::vector<vtkSmartPointer<vtkActor>>> Actors;
179  std::vector<bool> EnabledAnimations;
180  vtkIdType EnabledCamera = -1;
181 
182 private:
183  vtkGLTFImporter(const vtkGLTFImporter&) = delete;
184  void operator=(const vtkGLTFImporter&) = delete;
185 };
186 
187 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:61
a virtual camera for 3D rendering
Definition: vtkCamera.h:61
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:49
abstract specification for renderers
Definition: vtkRenderer.h:82
handles properties associated with a texture map
Definition: vtkTexture.h:78
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332