HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLTF_Reader.h
Go to the documentation of this file.
1 #ifndef __GLTF_Reader_h__
2 #define __GLTF_Reader_h__
3 
4 #include "GLTFZ_API.h"
5 #include "GLTF_Types.h"
6 
7 #include <UT/UT_StringHolder.h>
8 #include <UT/UT_UniquePtr.h>
9 
10 struct CgltfImpl;
11 class GLTF_ErrorManager;
12 
14 {
15 public:
16 
17  // We define the constructors/destructors in the source file to avoid having
18  // to pollute this header file with GLTF_CgltfImpl.h, which we want to keep
19  // hidden from users of the GLTFZ API.
20  GLTF_Reader();
21  GLTF_Reader(const char *filePath);
22  ~GLTF_Reader();
23 
24  bool loadFile(GLTF_ErrorManager& errors);
25 
26  bool closeFile();
27 
28  bool isOpen() const { return myIsLoaded; }
29 
30  bool loadBuffer(const GLTF_Index buf_idx,
31  GLTF_ErrorManager& errors);
32 
33  bool loadAccessorData(const GLTF_Index accessor_idx,
34  unsigned char** out_data,
35  GLTF_ErrorManager& errors);
36 
37  bool loadAnimationData(
38  const GLTF_Index anim_idx,
39  GLTF_ErrorManager& errors);
40 
41  void setFilePath(const char* path)
42  { myFilePath = path; }
43  const UT_StringHolder& filePath() const { return myFilePath; }
44 
45  CgltfImpl &getCgltfImpl() const;
46 
47 private:
48  // Set this to nullptr in the constructor so that we don't have to pull
49  // in the CgltfImpl header here.
50  UT_UniquePtr<CgltfImpl> myCgltfImpl;
51 
52  UT_StringHolder myFilePath;
53  bool myIsLoaded = false;
54 };
55 
56 #endif // __GLTF_Reader_h__
bool isOpen() const
Definition: GLTF_Reader.h:28
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
void setFilePath(const char *path)
Definition: GLTF_Reader.h:41
const UT_StringHolder & filePath() const
Definition: GLTF_Reader.h:43
std::size_t GLTF_Index
Definition: GLTF_Types.h:6
#define GLTFZ_API
Definition: GLTFZ_API.h:37