VTK  9.3.0
vtkGLTFImporter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
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 VTK_ABI_NAMESPACE_BEGIN
69 class vtkActor;
70 class vtkCamera;
72 class vtkTexture;
73 
74 class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
75 {
76 public:
77  static vtkGLTFImporter* New();
78 
79  vtkTypeMacro(vtkGLTFImporter, vtkImporter);
80  void PrintSelf(ostream& os, vtkIndent indent) override;
81 
83 
89 
96 
100  std::string GetOutputsDescription() override { return this->OutputsDescription; };
101 
105  void UpdateTimeStep(double timeValue) override;
106 
111 
115  std::string GetAnimationName(vtkIdType animationIndex) override;
116 
118 
121  void EnableAnimation(vtkIdType animationIndex) override;
122  void DisableAnimation(vtkIdType animationIndex) override;
123  bool IsAnimationEnabled(vtkIdType animationIndex) override;
125 
130 
134  std::string GetCameraName(vtkIdType camIndex) override;
135 
140  void SetCamera(vtkIdType camIndex) override;
141 
150  bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
151  double timeRange[2], vtkDoubleArray* timeSteps) override;
152 
153 protected:
154  vtkGLTFImporter() = default;
155  ~vtkGLTFImporter() override;
156 
157  int ImportBegin() override;
158  void ImportActors(vtkRenderer* renderer) override;
159  void ImportCameras(vtkRenderer* renderer) override;
160  void ImportLights(vtkRenderer* renderer) override;
161 
163 
164  char* FileName = nullptr;
165 
166  std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
167  std::map<int, vtkSmartPointer<vtkTexture>> Textures;
168  std::map<int, std::vector<vtkSmartPointer<vtkActor>>> Actors;
171  std::vector<bool> EnabledAnimations;
172  vtkIdType EnabledCamera = -1;
173 
174 private:
175  vtkGLTFImporter(const vtkGLTFImporter&) = delete;
176  void operator=(const vtkGLTFImporter&) = delete;
177 };
178 
179 VTK_ABI_NAMESPACE_END
180 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
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 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.
void UpdateTimeStep(double timeValue) override
update timestep
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 information for the provided animationIndex and frameRate.
std::vector< bool > EnabledAnimations
vtkIdType GetNumberOfAnimations() override
Get the number of available animations.
void ImportCameras(vtkRenderer *renderer) override
importer abstract class
Definition: vtkImporter.h:49
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract specification for renderers
Definition: vtkRenderer.h:71
handles properties associated with a texture map
Definition: vtkTexture.h:67
@ string
Definition: vtkX3D.h:490
int vtkIdType
Definition: vtkType.h:315