VTK  9.4.20251007
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
51
52#ifndef vtkGLTFImporter_h
53#define vtkGLTFImporter_h
54
55#include "vtkIOImportModule.h" // For export macro
56#include "vtkImporter.h"
57#include "vtkSmartPointer.h" // For SmartPointer
58
59#include <map> // For map
60#include <vector> // For vector
61
62VTK_ABI_NAMESPACE_BEGIN
63class vtkActor;
64class vtkCamera;
66class vtkTexture;
67
68class VTKIOIMPORT_EXPORT vtkGLTFImporter : public vtkImporter
69{
70public:
72
74 void PrintSelf(ostream& os, vtkIndent indent) override;
75
77
83
90
94 std::string GetOutputsDescription() override { return this->OutputsDescription; }
95
99 bool UpdateAtTimeValue(double timeValue) override;
100
105
109 std::string GetAnimationName(vtkIdType animationIndex) override;
110
112
115 void EnableAnimation(vtkIdType animationIndex) override;
116 void DisableAnimation(vtkIdType animationIndex) override;
117 bool IsAnimationEnabled(vtkIdType animationIndex) override;
119
124
128 std::string GetCameraName(vtkIdType camIndex) override;
129
134 void SetCamera(vtkIdType camIndex) override;
135
144 bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
145 double timeRange[2], vtkDoubleArray* timeSteps) override;
146
147protected:
148 vtkGLTFImporter() = default;
150
155 virtual void InitializeLoader();
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;
173
174private:
175 vtkGLTFImporter(const vtkGLTFImporter&) = delete;
176 void operator=(const vtkGLTFImporter&) = delete;
177};
178
179VTK_ABI_NAMESPACE_END
180#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:42
a virtual camera for 3D rendering
Definition vtkCamera.h:42
dynamic, self-adjusting array of double
Deserialize a GLTF model 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
vtkIdType EnabledCamera
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
a simple class to control print indentation
Definition vtkIndent.h:29
abstract specification for renderers
Definition vtkRenderer.h:63
Hold a reference to a vtkObjectBase instance.
handles properties associated with a texture map
Definition vtkTexture.h:59
int vtkIdType
Definition vtkType.h:315