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
67#ifndef vtkGLTFImporter_h
68#define vtkGLTFImporter_h
69
70#include "vtkIOImportModule.h" // For export macro
71#include "vtkImporter.h"
72#include "vtkSmartPointer.h" // For SmartPointer
73
74#include <map> // For map
75#include <vector> // For vector
76
77class vtkActor;
78class vtkCamera;
80class vtkTexture;
81
82class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
83{
84public:
86
88 void PrintSelf(ostream& os, vtkIndent indent) override;
89
91
97
104
108 std::string GetOutputsDescription() override { return this->OutputsDescription; };
109
113 void UpdateTimeStep(double timestep) override;
114
119
123 std::string GetAnimationName(vtkIdType animationIndex) override;
124
126
129 void EnableAnimation(vtkIdType animationIndex) override;
130 void DisableAnimation(vtkIdType animationIndex) override;
131 bool IsAnimationEnabled(vtkIdType animationIndex) override;
133
138
143
148 void SetCamera(vtkIdType camIndex) override;
149
155 bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
156 double timeRange[2], vtkDoubleArray* timeSteps) override;
157
158protected:
159 vtkGLTFImporter() = default;
161
162 int ImportBegin() override;
163 void ImportActors(vtkRenderer* renderer) override;
164 void ImportCameras(vtkRenderer* renderer) override;
165 void ImportLights(vtkRenderer* renderer) override;
166
168
169 char* FileName = nullptr;
170
171 std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
172 std::map<int, vtkSmartPointer<vtkTexture>> Textures;
173 std::map<int, std::vector<vtkSmartPointer<vtkActor>>> Actors;
176 std::vector<bool> EnabledAnimations;
177 vtkIdType EnabledCamera = -1;
178
179private:
180 vtkGLTFImporter(const vtkGLTFImporter&) = delete;
181 void operator=(const vtkGLTFImporter&) = delete;
182};
183
184#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:55
a virtual camera for 3D rendering
Definition: vtkCamera.h:55
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.
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.
vtkSmartPointer< vtkCamera > GetCamera(unsigned int id)
glTF defines multiple camera objects, but no default behavior for which camera should be used.
std::string GetCameraName(vtkIdType camIndex) override
Get the name of a camera.
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
static vtkGLTFImporter * New()
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:43
abstract specification for renderers
Definition: vtkRenderer.h:73
handles properties associated with a texture map
Definition: vtkTexture.h:75
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332