HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLTF_DracoMeshCodec.h
Go to the documentation of this file.
1 #ifndef __GLTF_DracoMeshCodec_h__
2 #define __GLTF_DracoMeshCodec_h__
3 
4 #include "GLTFZ_API.h"
5 
6 #include "GLTF_Codec.h"
7 
8 #include <GA/GA_OffsetList.h>
9 
10 class GLTF_ErrorManager;
11 class GLTF_Reader;
12 class GU_Detail;
13 
14 namespace draco
15 {
16 class Mesh;
17 class PointCloud;
18 }
19 
21 {
22 public:
23  explicit GLTF_DracoMeshCodec(const GLTF_ImportOptions& options)
24  : GLTF_Codec(options)
25  {
26 
27  }
28  explicit GLTF_DracoMeshCodec(const GLTF_ExportOptions& options)
29  : GLTF_Codec(options)
30  {
31 
32  }
33  explicit GLTF_DracoMeshCodec(const GLTF_ImportOptions& import_options,
34  const GLTF_ExportOptions& export_options)
35  : GLTF_Codec(import_options, export_options)
36  {
37 
38  }
39  virtual ~GLTF_DracoMeshCodec() override;
40 
41  static bool isExtensionSupported(const char* ext_name)
42  {
43  static const UT_StringHolder theSupportedExtension("KHR_draco_mesh_compression");
44  return (theSupportedExtension == ext_name);
45  }
46 
48  GU_Detail& gdp,
49  const GLTF_Index mesh_idx,
50  const GLTF_Index prim_idx,
51  const GLTF_MeshInfo& mesh_info,
52  GLTF_Reader& reader,
53  GLTF_ErrorManager& errors) override;
54 
56  GU_Detail&,
57  const GLTF_Index,
58  GLTF_Reader&,
60  GA_AttributeOwner) override
61  {
62  return false;
63  }
64 
65  virtual bool exportMeshPrimitive(
66  const GU_Detail& gdp,
67  const GLTF_Index mesh_idx,
68  const GLTF_Index prim_idx,
69  GLTF_Writer& writer,
70  GLTF_ErrorManager& errors) override;
71 
72 private:
73 
74  bool addPointAttribute(
75  GU_Detail& gdp,
76  const draco::Mesh& mesh,
77  const GLTF_Index attrib_idx,
78  const char* attrib_name,
79  GLTF_Reader& reader,
80  GLTF_ErrorManager& errors);
81 
82  bool exportDracoMeshTriPrimitive(
83  const GU_Detail& gdp,
84  const GLTF_Index mesh_id,
85  const GLTF_Index prim_id,
86  GLTF_Writer& writer,
87  GLTF_ErrorManager& errors);
88 
89  void exportPointAttributes(
90  const GU_Detail& gdp,
91  draco::PointCloud* point_cloud,
92  const GLTF_Index mesh_id,
93  const GLTF_Index prim_id,
94  GLTF_Writer& writer,
95  GLTF_ErrorManager& errors,
96  GA_OffsetList* pt_list=nullptr);
97 
98 };
99 
100 #endif // __GLTF_DracoMeshCodec_h__
Definition: Mesh.h:240
virtual bool importMeshPrimitive(GU_Detail &gdp, const GLTF_Index mesh_idx, const GLTF_Index prim_idx, const GLTF_MeshInfo &mesh_info, GLTF_Reader &reader, GLTF_ErrorManager &errors)=0
virtual bool exportMeshPrimitive(const GU_Detail &gdp, const GLTF_Index mesh_idx, const GLTF_Index prim_idx, GLTF_Writer &writer, GLTF_ErrorManager &errors)
Definition: GLTF_Codec.h:54
bool importMaterial(GU_Detail &, const GLTF_Index, GLTF_Reader &, GLTF_ErrorManager &, GA_AttributeOwner) override
static bool isExtensionSupported(const char *ext_name)
GLTF_DracoMeshCodec(const GLTF_ImportOptions &import_options, const GLTF_ExportOptions &export_options)
std::size_t GLTF_Index
Definition: GLTF_Types.h:13
GLTF_DracoMeshCodec(const GLTF_ImportOptions &options)
GA_AttributeOwner
Definition: GA_Types.h:35
#define GLTFZ_API
Definition: GLTFZ_API.h:37
GLTF_DracoMeshCodec(const GLTF_ExportOptions &options)