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
49#ifndef vtkGLTFImporter_h
50#define vtkGLTFImporter_h
51
52#include "vtkIOImportModule.h" // For export macro
53#include "vtkImporter.h"
54#include "vtkSmartPointer.h" // For SmartPointer
55
56#include <map> // For map
57#include <vector> // For vector
58
59VTK_ABI_NAMESPACE_BEGIN
60class vtkActor;
61class vtkCamera;
63class vtkTexture;
64
65class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
66{
67public:
69
71 void PrintSelf(ostream& os, vtkIndent indent) override;
72
74
80
87
91 std::string GetOutputsDescription() override { return this->OutputsDescription; };
92
96 void UpdateTimeStep(double timeValue) override;
97
102
106 std::string GetAnimationName(vtkIdType animationIndex) override;
107
109
112 void EnableAnimation(vtkIdType animationIndex) override;
113 void DisableAnimation(vtkIdType animationIndex) override;
114 bool IsAnimationEnabled(vtkIdType animationIndex) override;
116
121
125 std::string GetCameraName(vtkIdType camIndex) override;
126
131 void SetCamera(vtkIdType camIndex) override;
132
141 bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
142 double timeRange[2], vtkDoubleArray* timeSteps) override;
143
144protected:
145 vtkGLTFImporter() = default;
147
148 int ImportBegin() override;
149 void ImportActors(vtkRenderer* renderer) override;
150 void ImportCameras(vtkRenderer* renderer) override;
151 void ImportLights(vtkRenderer* renderer) override;
152
154
155 char* FileName = nullptr;
156
157 std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
158 std::map<int, vtkSmartPointer<vtkTexture>> Textures;
159 std::map<int, std::vector<vtkSmartPointer<vtkActor>>> Actors;
162 std::vector<bool> EnabledAnimations;
163 vtkIdType EnabledCamera = -1;
164
165private:
166 vtkGLTFImporter(const vtkGLTFImporter&) = delete;
167 void operator=(const vtkGLTFImporter&) = delete;
168};
169
170VTK_ABI_NAMESPACE_END
171#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:41
a virtual camera for 3D rendering
Definition vtkCamera.h:41
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 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 UpdateTimeStep(double timeValue) override
update timestep
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
static vtkGLTFImporter * New()
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:29
abstract specification for renderers
Definition vtkRenderer.h:59
Hold a reference to a vtkObjectBase instance.
handles properties associated with a texture map
Definition vtkTexture.h:58
int vtkIdType
Definition vtkType.h:315