28#ifndef vtkGLTFDocumentLoader_h
29#define vtkGLTFDocumentLoader_h
32#include "vtkIOGeometryModule.h"
44VTK_ABI_NAMESPACE_BEGIN
417 bool forceStep =
false,
bool isRotation =
false)
const;
628 vtkSetMacro(GLBStart, vtkTypeInt64);
629 vtkGetMacro(GLBStart, vtkTypeInt64);
638 vtkSetMacro(LoadAnimation,
bool);
639 vtkGetMacro(LoadAnimation,
bool);
640 vtkBooleanMacro(LoadAnimation,
bool);
649 vtkSetMacro(LoadImages,
bool);
650 vtkGetMacro(LoadImages,
bool);
651 vtkBooleanMacro(LoadImages,
bool);
660 vtkSetMacro(LoadSkinMatrix,
bool);
661 vtkGetMacro(LoadSkinMatrix,
bool);
662 vtkBooleanMacro(LoadSkinMatrix,
bool);
670 struct AccessorLoadingWorker;
672 struct SparseAccessorLoadingWorker;
674 template <
typename Type>
675 struct BufferDataExtractionWorker;
683 bool LoadSkinMatrixData();
689 bool ExtractPrimitiveAttributes(
Primitive& primitive);
697 bool ExtractPrimitiveAccessorData(
Primitive& primitive);
703 bool BuildPolyDataFromPrimitive(
Primitive& primitive);
708 bool BuildPolyDataFromSkin(
Skin& skin);
713 bool LoadAnimationData();
718 bool LoadImageData();
720 std::shared_ptr<Model> InternalModel;
722 static const std::vector<std::string> SupportedExtensions;
723 std::vector<std::string> UsedExtensions;
724 bool IsBinary =
false;
725 vtkTypeInt64 GLBStart = 0;
730 bool LoadAnimation =
true;
731 bool LoadImages =
true;
732 bool LoadSkinMatrix =
true;
object to represent cell connectivity
dynamic, self-adjusting array of float
AccessorType
Defines an accessor's type.
bool LoadModelMetaDataFromFile(const std::string &FileName)
Reset internal Model struct, and serialize glTF metadata (all json information) into it.
void ResetAnimation(int animationId)
Restore the transforms that were modified by an animation to their initial state.
virtual std::vector< std::string > GetSupportedExtensions()
Get the list of extensions that are supported by this loader.
bool LoadModelData(const std::vector< char > &glbBuffer)
Load buffer data into the internal Model.
void BuildGlobalTransforms(unsigned int nodeIndex, vtkSmartPointer< vtkMatrix4x4 > parentTransform)
Concatenate the current node's local transform to its parent's global transform, storing the resultin...
static unsigned int GetNumberOfComponentsForType(vtkGLTFDocumentLoader::AccessorType type)
Returns the number of components for a given accessor type.
static void ComputeJointMatrices(const Model &model, const Skin &skin, Node &node, std::vector< vtkSmartPointer< vtkMatrix4x4 > > &jointMats)
Compute all joint matrices of the skin of a specific node.
bool LoadModelMetaDataFromStream(vtkResourceStream *stream, vtkURILoader *loader=nullptr, bool quiet=false)
Reset internal Model struct, and serialize glTF metadata (all json information) into it.
virtual void PrepareData()
Some extensions require a preparation on the model before building VTK objects.
bool GetIsBinary()
Get if the current model contains binary data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Target
Define an openGL draw target.
static vtkGLTFDocumentLoader * New()
bool ApplyAnimation(float t, int animationId, bool forceStep=false)
Apply the specified animation, at the specified time value t, to the internal Model.
const std::vector< std::string > & GetUsedExtensions()
Get the list of extensions that are used by the current model.
~vtkGLTFDocumentLoader() override=default
vtkGLTFDocumentLoader()=default
bool LoadStreamBuffer(vtkResourceStream *stream, std::vector< char > &glbBuffer)
Load the binary part of a binary glTF (.glb) file.
ComponentType
Define a type for different data components.
bool LoadFileBuffer(const std::string &fileName, std::vector< char > &glbBuffer)
Load the binary part of a binary glTF (.glb) file.
std::shared_ptr< Model > GetInternalModel()
Get the internal Model.
bool BuildModelVTKGeometry()
Converts the internal Model's loaded data into more convenient vtk objects.
void BuildGlobalTransforms()
Build all global transforms.
topologically and geometrically regular array of data
a simple class to control print indentation
represent and manipulate 4x4 transformation matrices
represent and manipulate 3D points
concrete dataset represents vertices, lines, polygons, and triangle strips
Abstract class used for custom streams.
Hold a reference to a vtkObjectBase instance.
Helper class for readers and importer that need to load more than one resource.
dynamic, self-adjusting array of unsigned short
This struct describes a glTF sampler object.
This struct describes an accessor.sparse glTF object.
ComponentType IndicesComponentType
This struct describes an accessor glTF object.
unsigned int NumberOfComponents
std::vector< double > Max
std::vector< double > Min
ComponentType ComponentTypeValue
vtkSmartPointer< vtkFloatArray > OutputData
vtkSmartPointer< vtkFloatArray > InputData
InterpolationMode Interpolation
void GetInterpolatedData(float t, size_t numberOfComponents, std::vector< float > *output, bool forceStep=false, bool isRotation=false) const
Get the interpolated animation output at time t.
This struct describes a glTF animation object.
std::vector< Animation::Channel > Channels
std::vector< Animation::Sampler > Samplers
std::set< float > AllTimestamps
This struct describes a glTF bufferView object.
This struct describes a glTF camera object.
double SpotOuterConeAngle
double SpotInnerConeAngle
std::vector< double > Color
std::vector< Light > Lights
This struct contains extension metadata.
KHRLightsPunctual KHRLightsPunctualMetaData
This struct describes a glTF image object.
vtkSmartPointer< vtkImageData > ImageData
This struct describes a glTF material object.
std::vector< double > EmissiveFactor
TextureInfo NormalTexture
TextureInfo OcclusionTexture
double OcclusionTextureStrength
TextureInfo EmissiveTexture
double NormalTextureScale
This struct describes a glTF mesh object.
std::vector< float > Weights
std::vector< struct Primitive > Primitives
This struct contains all data from a gltf asset.
std::vector< std::vector< char > > Buffers
std::vector< Camera > Cameras
std::vector< Image > Images
std::string BufferMetaData
std::vector< Mesh > Meshes
std::vector< Sampler > Samplers
std::vector< Skin > Skins
std::vector< Scene > Scenes
std::vector< BufferView > BufferViews
Extensions ExtensionMetaData
std::vector< Texture > Textures
vtkSmartPointer< vtkResourceStream > Stream
std::vector< Node > Nodes
std::vector< Animation > Animations
std::vector< Material > Materials
std::vector< Accessor > Accessors
vtkSmartPointer< vtkURILoader > URILoader
This struct describes a glTF Morph Target object.
std::map< std::string, vtkSmartPointer< vtkFloatArray > > AttributeValues
std::map< std::string, int > AttributeIndices
Node::Extensions::KHRLightsPunctual KHRLightsPunctualMetaData
This struct describes a glTF node object.
vtkSmartPointer< vtkMatrix4x4 > GlobalTransform
vtkSmartPointer< vtkMatrix4x4 > Matrix
std::vector< float > Scale
Node::Extensions ExtensionMetaData
std::vector< int > Children
vtkSmartPointer< vtkMatrix4x4 > Transform
std::vector< float > InitialRotation
std::vector< float > Weights
std::vector< float > InitialWeights
std::vector< float > InitialTranslation
std::vector< float > InitialScale
std::vector< float > Rotation
std::vector< float > Translation
std::map< std::string, int > AttributeIndices
Primitive::Extensions::KHRDracoMeshCompression KHRDracoMetaData
This struct describes a glTF primitive object.
vtkSmartPointer< vtkCellArray > Indices
std::map< std::string, int > AttributeIndices
Primitive::Extensions ExtensionMetaData
std::vector< MorphTarget > Targets
vtkSmartPointer< vtkPolyData > Geometry
std::map< std::string, vtkSmartPointer< vtkDataArray > > AttributeValues
This struct describes a glTF sampler object.
This struct describes a glTF scene object.
std::vector< unsigned int > Nodes
This struct describes a glTF asset.
std::vector< vtkSmartPointer< vtkMatrix4x4 > > InverseBindMatrices
std::vector< int > Joints
int InverseBindMatricesAccessorId
vtkSmartPointer< vtkPolyData > Armature
This struct describes a glTF textureInfo object, mostly used in material descriptions They contain tw...
std::vector< double > Scale
std::vector< double > Offset
This struct describes a glTF texture object.