VTK  9.4.20241121
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
91#ifndef vtkGLTFImporter_h
92#define vtkGLTFImporter_h
93
94#include "vtkIOImportModule.h" // For export macro
95#include "vtkImporter.h"
96#include "vtkSmartPointer.h" // For SmartPointer
97
98#include <map> // For map
99#include <vector> // For vector
100
101VTK_ABI_NAMESPACE_BEGIN
102class vtkActor;
103class vtkCamera;
105class vtkTexture;
106
107class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
108{
109public:
111
113 void PrintSelf(ostream& os, vtkIndent indent) override;
114
116
122
129
133 std::string GetOutputsDescription() override { return this->OutputsDescription; }
134
138 bool UpdateAtTimeValue(double timeValue) override;
139
144
148 std::string GetAnimationName(vtkIdType animationIndex) override;
149
151
154 void EnableAnimation(vtkIdType animationIndex) override;
155 void DisableAnimation(vtkIdType animationIndex) override;
156 bool IsAnimationEnabled(vtkIdType animationIndex) override;
158
163
167 std::string GetCameraName(vtkIdType camIndex) override;
168
173 void SetCamera(vtkIdType camIndex) override;
174
183 bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
184 double timeRange[2], vtkDoubleArray* timeSteps) override;
185
186protected:
187 vtkGLTFImporter() = default;
189
194 virtual void InitializeLoader();
195
196 int ImportBegin() override;
197 void ImportActors(vtkRenderer* renderer) override;
198 void ImportCameras(vtkRenderer* renderer) override;
199 void ImportLights(vtkRenderer* renderer) override;
200
202
203 char* FileName = nullptr;
204
205 std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
206 std::map<int, vtkSmartPointer<vtkTexture>> Textures;
207 std::map<int, std::vector<vtkSmartPointer<vtkActor>>> Actors;
210 std::vector<bool> EnabledAnimations;
211 vtkIdType EnabledCamera = -1;
212
213private:
214 vtkGLTFImporter(const vtkGLTFImporter&) = delete;
215 void operator=(const vtkGLTFImporter&) = delete;
216};
217
218VTK_ABI_NAMESPACE_END
219#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
a virtual camera for 3D rendering
Definition vtkCamera.h:151
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
bool UpdateAtTimeValue(double timeValue) override
update timestep
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
virtual void InitializeLoader()
Initialize the document loader.
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 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:55
a simple class to control print indentation
Definition vtkIndent.h:108
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
handles properties associated with a texture map
Definition vtkTexture.h:168
int vtkIdType
Definition vtkType.h:315