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 myAttributeData[info] = GLTF_AttributeVariant(
112 return std::get<UT_Array<T>>(myAttributeData[info]);
119 GLTF_MeshPrimId key(mesh_id, prim_id);
120 return myDracoInfo[key].encoderBuffer.get();
128 GLTF_MeshPrimId key(mesh_id, prim_id);
129 myDracoInfo[key].indicesCount =
count;
136 void setPositionMinMax(
141 bool containsMaterial(
const char* node_path);
142 GLTF_Index createOrGetMaterial(
const char* node_path);
146 return myImageData.contains(name);
156 const char* img_name);
157 bool copyImageFileAndExport(
160 const char* img_name);
162 bool exportTextureWithImage(
171 return myIO.getCgltfData();
175 return myIO.getCgltfData();
180 return myIO.getCgltfWrapper();
184 void flushDataToCgltf();
185 void flushAnimData();
188 void decomposeRestTransformMatricesForAnimatedNodes();
200 GLTF_AttributeVariant> myAttributeData;
202 using GLTF_MeshPrimId = std::pair<GLTF_Index, GLTF_Index>;
206 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