1 #ifndef __GLTF_Writer_h__
2 #define __GLTF_Writer_h__
35 using GLTF_AttributeVariant = std::variant<
43 struct GLTF_DracoMeshCompressionInfo
45 GLTF_DracoMeshCompressionInfo();
46 ~GLTF_DracoMeshCompressionInfo();
50 bool bufferViewExists =
false;
58 bool writeToFile(
const char* filepath);
62 { myResourceDirectory = dir; }
66 { myCopyright = copyright; }
68 bool initializeGltfData(
95 void addRootNodeToScene(
109 GLTF_AttributeVariant& attrib_variant = myAttributeData[info];
110 attrib_variant = GLTF_AttributeVariant(std::in_place_type<
UT_Array<T>>);
111 return std::get<UT_Array<T>>(attrib_variant);
118 GLTF_MeshPrimId key(mesh_id, prim_id);
119 return myDracoInfo[key].encoderBuffer.get();
127 GLTF_MeshPrimId key(mesh_id, prim_id);
128 myDracoInfo[key].indicesCount =
count;
135 void setPositionMinMax(
140 bool containsMaterial(
const char* node_path);
141 GLTF_Index createOrGetMaterial(
const char* node_path);
145 return myImageData.contains(name);
155 const char* img_name);
156 bool copyImageFileAndExport(
159 const char* img_name);
161 bool exportTextureWithImage(
170 return myIO.getCgltfData();
174 return myIO.getCgltfData();
179 return myIO.getCgltfWrapper();
183 void flushDataToCgltf();
184 void flushAnimData();
187 void decomposeRestTransformMatricesForAnimatedNodes();
199 GLTF_AttributeVariant> myAttributeData;
201 using GLTF_MeshPrimId = std::pair<GLTF_Index, GLTF_Index>;
205 GLTF_DracoMeshCompressionInfo> myDracoInfo;
void setResourceDirectory(const UT_StringHolder &dir)
UT_Array< T > & createAttribute(const GLTF_AttributeInfo &info)
GT_API const UT_StringHolder filename
const GLTF_ErrorManager & getErrorManager() const
GLTF_ResourceExportLocation
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void setCopyright(const UT_StringHolder ©right)
draco::EncoderBuffer * getDracoEncoderBuffer(const GLTF_Index mesh_id, const GLTF_Index prim_id)
std::optional< T > UT_Optional
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
GLint GLint GLsizei GLint GLenum GLenum type
GLTF_CgltfWrapper * getCgltfWrapper()
GLint GLint GLsizei GLint GLenum format
bool containsImage(const char *name)
void setDracoPrimIndexCount(const GLTF_Index mesh_id, const GLTF_Index prim_id, const GLTF_Index count)
cgltf_data * getCgltfData()
GLuint const GLchar * name
GA_API const UT_StringHolder parms
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
std::weak_ptr< T > UT_WeakPtr
const cgltf_data * getCgltfData() const