VTK  9.3.20240422
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
88#ifndef vtkGLTFImporter_h
89#define vtkGLTFImporter_h
90
91#include "vtkIOImportModule.h" // For export macro
92#include "vtkImporter.h"
93#include "vtkSmartPointer.h" // For SmartPointer
94
95#include <map> // For map
96#include <vector> // For vector
97
98VTK_ABI_NAMESPACE_BEGIN
99class vtkActor;
100class vtkCamera;
102class vtkTexture;
103
104class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
105{
106public:
108
110 void PrintSelf(ostream& os, vtkIndent indent) override;
111
113
119
126
130 std::string GetOutputsDescription() override { return this->OutputsDescription; }
131
135 void UpdateTimeStep(double timeValue) override;
136
141
145 std::string GetAnimationName(vtkIdType animationIndex) override;
146
148
151 void EnableAnimation(vtkIdType animationIndex) override;
152 void DisableAnimation(vtkIdType animationIndex) override;
153 bool IsAnimationEnabled(vtkIdType animationIndex) override;
155
160
164 std::string GetCameraName(vtkIdType camIndex) override;
165
170 void SetCamera(vtkIdType camIndex) override;
171
180 bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
181 double timeRange[2], vtkDoubleArray* timeSteps) override;
182
183protected:
184 vtkGLTFImporter() = default;
186
191 virtual void InitializeLoader();
192
193 int ImportBegin() override;
194 void ImportActors(vtkRenderer* renderer) override;
195 void ImportCameras(vtkRenderer* renderer) override;
196 void ImportLights(vtkRenderer* renderer) override;
197
199
200 char* FileName = nullptr;
201
202 std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
203 std::map<int, vtkSmartPointer<vtkTexture>> Textures;
204 std::map<int, std::vector<vtkSmartPointer<vtkActor>>> Actors;
207 std::vector<bool> EnabledAnimations;
208 vtkIdType EnabledCamera = -1;
209
210private:
211 vtkGLTFImporter(const vtkGLTFImporter&) = delete;
212 void operator=(const vtkGLTFImporter&) = delete;
213};
214
215VTK_ABI_NAMESPACE_END
216#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
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 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:52
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:167
int vtkIdType
Definition vtkType.h:315