gltf_document.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. /*************************************************************************/
  2. /* gltf_document.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef GLTF_DOCUMENT_H
  31. #define GLTF_DOCUMENT_H
  32. #include "gltf_animation.h"
  33. #include "scene/2d/node_2d.h"
  34. #include "scene/3d/bone_attachment.h"
  35. #include "scene/3d/light.h"
  36. #include "scene/3d/mesh_instance.h"
  37. #include "scene/3d/skeleton.h"
  38. #include "scene/3d/spatial.h"
  39. #include "scene/animation/animation_player.h"
  40. #include "scene/resources/material.h"
  41. #include "scene/resources/texture.h"
  42. #include "modules/modules_enabled.gen.h" // For csg, gridmap.
  43. class GLTFState;
  44. class GLTFSkin;
  45. class GLTFNode;
  46. class GLTFSpecGloss;
  47. class GLTFSkeleton;
  48. class CSGShape;
  49. class GridMap;
  50. class MultiMeshInstance;
  51. using GLTFAccessorIndex = int;
  52. using GLTFAnimationIndex = int;
  53. using GLTFBufferIndex = int;
  54. using GLTFBufferViewIndex = int;
  55. using GLTFCameraIndex = int;
  56. using GLTFImageIndex = int;
  57. using GLTFMaterialIndex = int;
  58. using GLTFMeshIndex = int;
  59. using GLTFLightIndex = int;
  60. using GLTFNodeIndex = int;
  61. using GLTFSkeletonIndex = int;
  62. using GLTFSkinIndex = int;
  63. using GLTFTextureIndex = int;
  64. class GLTFDocument : public Resource {
  65. GDCLASS(GLTFDocument, Resource);
  66. friend class GLTFState;
  67. friend class GLTFSkin;
  68. friend class GLTFSkeleton;
  69. private:
  70. const float BAKE_FPS = 30.0f;
  71. public:
  72. const int32_t JOINT_GROUP_SIZE = 4;
  73. enum GLTFType {
  74. TYPE_SCALAR,
  75. TYPE_VEC2,
  76. TYPE_VEC3,
  77. TYPE_VEC4,
  78. TYPE_MAT2,
  79. TYPE_MAT3,
  80. TYPE_MAT4,
  81. };
  82. enum {
  83. ARRAY_BUFFER = 34962,
  84. ELEMENT_ARRAY_BUFFER = 34963,
  85. TYPE_BYTE = 5120,
  86. TYPE_UNSIGNED_BYTE = 5121,
  87. TYPE_SHORT = 5122,
  88. TYPE_UNSIGNED_SHORT = 5123,
  89. TYPE_UNSIGNED_INT = 5125,
  90. TYPE_FLOAT = 5126,
  91. COMPONENT_TYPE_BYTE = 5120,
  92. COMPONENT_TYPE_UNSIGNED_BYTE = 5121,
  93. COMPONENT_TYPE_SHORT = 5122,
  94. COMPONENT_TYPE_UNSIGNED_SHORT = 5123,
  95. COMPONENT_TYPE_INT = 5125,
  96. COMPONENT_TYPE_FLOAT = 5126,
  97. };
  98. private:
  99. template <class T>
  100. static Array to_array(const Vector<T> &p_inp) {
  101. Array ret;
  102. for (int i = 0; i < p_inp.size(); i++) {
  103. ret.push_back(p_inp[i]);
  104. }
  105. return ret;
  106. }
  107. template <class T>
  108. static Array to_array(const Set<T> &p_inp) {
  109. Array ret;
  110. typename Set<T>::Element *elem = p_inp.front();
  111. while (elem) {
  112. ret.push_back(elem->get());
  113. elem = elem->next();
  114. }
  115. return ret;
  116. }
  117. template <class T>
  118. static void set_from_array(Vector<T> &r_out, const Array &p_inp) {
  119. r_out.clear();
  120. for (int i = 0; i < p_inp.size(); i++) {
  121. r_out.push_back(p_inp[i]);
  122. }
  123. }
  124. template <class T>
  125. static void set_from_array(Set<T> &r_out, const Array &p_inp) {
  126. r_out.clear();
  127. for (int i = 0; i < p_inp.size(); i++) {
  128. r_out.insert(p_inp[i]);
  129. }
  130. }
  131. template <class K, class V>
  132. static Dictionary to_dict(const Map<K, V> &p_inp) {
  133. Dictionary ret;
  134. for (typename Map<K, V>::Element *E = p_inp.front(); E; E = E->next()) {
  135. ret[E->key()] = E->value();
  136. }
  137. return ret;
  138. }
  139. template <class K, class V>
  140. static void set_from_dict(Map<K, V> &r_out, const Dictionary &p_inp) {
  141. r_out.clear();
  142. Array keys = p_inp.keys();
  143. for (int i = 0; i < keys.size(); i++) {
  144. r_out[keys[i]] = p_inp[keys[i]];
  145. }
  146. }
  147. double _filter_number(double p_float);
  148. String _get_component_type_name(const uint32_t p_component);
  149. int _get_component_type_size(const int component_type);
  150. Error _parse_scenes(Ref<GLTFState> state);
  151. Error _parse_nodes(Ref<GLTFState> state);
  152. String _get_type_name(const GLTFType p_component);
  153. String _get_accessor_type_name(const GLTFDocument::GLTFType p_type);
  154. String _gen_unique_name(Ref<GLTFState> state, const String &p_name);
  155. String _sanitize_animation_name(const String &name);
  156. String _gen_unique_animation_name(Ref<GLTFState> state, const String &p_name);
  157. String _sanitize_bone_name(Ref<GLTFState> state, const String &name);
  158. String _gen_unique_bone_name(Ref<GLTFState> state,
  159. const GLTFSkeletonIndex skel_i,
  160. const String &p_name);
  161. GLTFTextureIndex _set_texture(Ref<GLTFState> state, Ref<Texture> p_texture);
  162. Ref<Texture> _get_texture(Ref<GLTFState> state,
  163. const GLTFTextureIndex p_texture);
  164. Error _parse_json(const String &p_path, Ref<GLTFState> state);
  165. Error _parse_glb(const String &p_path, Ref<GLTFState> state);
  166. void _compute_node_heights(Ref<GLTFState> state);
  167. Error _parse_buffers(Ref<GLTFState> state, const String &p_base_path);
  168. Error _parse_buffer_views(Ref<GLTFState> state);
  169. GLTFType _get_type_from_str(const String &p_string);
  170. Error _parse_accessors(Ref<GLTFState> state);
  171. Error _decode_buffer_view(Ref<GLTFState> state, double *dst,
  172. const GLTFBufferViewIndex p_buffer_view,
  173. const int skip_every, const int skip_bytes,
  174. const int element_size, const int count,
  175. const GLTFType type, const int component_count,
  176. const int component_type, const int component_size,
  177. const bool normalized, const int byte_offset,
  178. const bool for_vertex);
  179. Vector<double> _decode_accessor(Ref<GLTFState> state,
  180. const GLTFAccessorIndex p_accessor,
  181. const bool p_for_vertex);
  182. Vector<float> _decode_accessor_as_floats(Ref<GLTFState> state,
  183. const GLTFAccessorIndex p_accessor,
  184. const bool p_for_vertex);
  185. Vector<int> _decode_accessor_as_ints(Ref<GLTFState> state,
  186. const GLTFAccessorIndex p_accessor,
  187. const bool p_for_vertex);
  188. Vector<Vector2> _decode_accessor_as_vec2(Ref<GLTFState> state,
  189. const GLTFAccessorIndex p_accessor,
  190. const bool p_for_vertex);
  191. Vector<Vector3> _decode_accessor_as_vec3(Ref<GLTFState> state,
  192. const GLTFAccessorIndex p_accessor,
  193. const bool p_for_vertex);
  194. Vector<Color> _decode_accessor_as_color(Ref<GLTFState> state,
  195. const GLTFAccessorIndex p_accessor,
  196. const bool p_for_vertex);
  197. Vector<Quat> _decode_accessor_as_quat(Ref<GLTFState> state,
  198. const GLTFAccessorIndex p_accessor,
  199. const bool p_for_vertex);
  200. Vector<Transform2D> _decode_accessor_as_xform2d(Ref<GLTFState> state,
  201. const GLTFAccessorIndex p_accessor,
  202. const bool p_for_vertex);
  203. Vector<Basis> _decode_accessor_as_basis(Ref<GLTFState> state,
  204. const GLTFAccessorIndex p_accessor,
  205. const bool p_for_vertex);
  206. Vector<Transform> _decode_accessor_as_xform(Ref<GLTFState> state,
  207. const GLTFAccessorIndex p_accessor,
  208. const bool p_for_vertex);
  209. Error _parse_meshes(Ref<GLTFState> state);
  210. Error _serialize_textures(Ref<GLTFState> state);
  211. Error _serialize_images(Ref<GLTFState> state, const String &p_path);
  212. Error _serialize_lights(Ref<GLTFState> state);
  213. Error _parse_images(Ref<GLTFState> state, const String &p_base_path);
  214. Error _parse_textures(Ref<GLTFState> state);
  215. Error _parse_materials(Ref<GLTFState> state);
  216. void _set_texture_transform_uv1(const Dictionary &d, Ref<SpatialMaterial> material);
  217. void spec_gloss_to_rough_metal(Ref<GLTFSpecGloss> r_spec_gloss,
  218. Ref<SpatialMaterial> p_material);
  219. static void spec_gloss_to_metal_base_color(const Color &p_specular_factor,
  220. const Color &p_diffuse,
  221. Color &r_base_color,
  222. float &r_metallic);
  223. GLTFNodeIndex _find_highest_node(Ref<GLTFState> state,
  224. const Vector<GLTFNodeIndex> &subset);
  225. bool _capture_nodes_in_skin(Ref<GLTFState> state, Ref<GLTFSkin> skin,
  226. const GLTFNodeIndex node_index);
  227. void _capture_nodes_for_multirooted_skin(Ref<GLTFState> state, Ref<GLTFSkin> skin);
  228. Error _expand_skin(Ref<GLTFState> state, Ref<GLTFSkin> skin);
  229. Error _verify_skin(Ref<GLTFState> state, Ref<GLTFSkin> skin);
  230. Error _parse_skins(Ref<GLTFState> state);
  231. Error _determine_skeletons(Ref<GLTFState> state);
  232. Error _reparent_non_joint_skeleton_subtrees(
  233. Ref<GLTFState> state, Ref<GLTFSkeleton> skeleton,
  234. const Vector<GLTFNodeIndex> &non_joints);
  235. Error _reparent_to_fake_joint(Ref<GLTFState> state, Ref<GLTFSkeleton> skeleton,
  236. const GLTFNodeIndex node_index);
  237. Error _determine_skeleton_roots(Ref<GLTFState> state,
  238. const GLTFSkeletonIndex skel_i);
  239. Error _create_skeletons(Ref<GLTFState> state);
  240. Error _map_skin_joints_indices_to_skeleton_bone_indices(Ref<GLTFState> state);
  241. Error _serialize_skins(Ref<GLTFState> state);
  242. Error _create_skins(Ref<GLTFState> state);
  243. bool _skins_are_same(const Ref<Skin> skin_a, const Ref<Skin> skin_b);
  244. void _remove_duplicate_skins(Ref<GLTFState> state);
  245. Error _serialize_cameras(Ref<GLTFState> state);
  246. Error _parse_cameras(Ref<GLTFState> state);
  247. Error _parse_lights(Ref<GLTFState> state);
  248. Error _parse_animations(Ref<GLTFState> state);
  249. Error _serialize_animations(Ref<GLTFState> state);
  250. BoneAttachment *_generate_bone_attachment(Ref<GLTFState> state,
  251. Skeleton *skeleton,
  252. const GLTFNodeIndex node_index,
  253. const GLTFNodeIndex bone_index);
  254. Spatial *_generate_mesh_instance(Ref<GLTFState> state, Node *scene_parent, const GLTFNodeIndex node_index);
  255. Camera *_generate_camera(Ref<GLTFState> state, Node *scene_parent,
  256. const GLTFNodeIndex node_index);
  257. Spatial *_generate_light(Ref<GLTFState> state, Node *scene_parent, const GLTFNodeIndex node_index);
  258. Spatial *_generate_spatial(Ref<GLTFState> state, Node *scene_parent,
  259. const GLTFNodeIndex node_index);
  260. void _assign_scene_names(Ref<GLTFState> state);
  261. template <class T>
  262. T _interpolate_track(const Vector<float> &p_times, const Vector<T> &p_values,
  263. const float p_time,
  264. const GLTFAnimation::Interpolation p_interp);
  265. GLTFAccessorIndex _encode_accessor_as_quats(Ref<GLTFState> state,
  266. const Vector<Quat> p_attribs,
  267. const bool p_for_vertex);
  268. GLTFAccessorIndex _encode_accessor_as_weights(Ref<GLTFState> state,
  269. const Vector<Color> p_attribs,
  270. const bool p_for_vertex);
  271. GLTFAccessorIndex _encode_accessor_as_joints(Ref<GLTFState> state,
  272. const Vector<Color> p_attribs,
  273. const bool p_for_vertex);
  274. GLTFAccessorIndex _encode_accessor_as_floats(Ref<GLTFState> state,
  275. const Vector<real_t> p_attribs,
  276. const bool p_for_vertex);
  277. GLTFAccessorIndex _encode_accessor_as_vec2(Ref<GLTFState> state,
  278. const Vector<Vector2> p_attribs,
  279. const bool p_for_vertex);
  280. void _calc_accessor_vec2_min_max(int i, const int element_count, Vector<double> &type_max, Vector2 attribs, Vector<double> &type_min) {
  281. if (i == 0) {
  282. for (int32_t type_i = 0; type_i < element_count; type_i++) {
  283. type_max.write[type_i] = attribs[(i * element_count) + type_i];
  284. type_min.write[type_i] = attribs[(i * element_count) + type_i];
  285. }
  286. }
  287. for (int32_t type_i = 0; type_i < element_count; type_i++) {
  288. type_max.write[type_i] = MAX(attribs[(i * element_count) + type_i], type_max[type_i]);
  289. type_min.write[type_i] = MIN(attribs[(i * element_count) + type_i], type_min[type_i]);
  290. type_max.write[type_i] = _filter_number(type_max.write[type_i]);
  291. type_min.write[type_i] = _filter_number(type_min.write[type_i]);
  292. }
  293. }
  294. GLTFAccessorIndex _encode_accessor_as_vec3(Ref<GLTFState> state,
  295. const Vector<Vector3> p_attribs,
  296. const bool p_for_vertex);
  297. GLTFAccessorIndex _encode_accessor_as_color(Ref<GLTFState> state,
  298. const Vector<Color> p_attribs,
  299. const bool p_for_vertex);
  300. void _calc_accessor_min_max(int p_i, const int p_element_count, Vector<double> &p_type_max, Vector<double> p_attribs, Vector<double> &p_type_min);
  301. GLTFAccessorIndex _encode_accessor_as_ints(Ref<GLTFState> state,
  302. const Vector<int32_t> p_attribs,
  303. const bool p_for_vertex);
  304. GLTFAccessorIndex _encode_accessor_as_xform(Ref<GLTFState> state,
  305. const Vector<Transform> p_attribs,
  306. const bool p_for_vertex);
  307. Error _encode_buffer_view(Ref<GLTFState> state, const double *src,
  308. const int count, const GLTFType type,
  309. const int component_type, const bool normalized,
  310. const int byte_offset, const bool for_vertex,
  311. GLTFBufferViewIndex &r_accessor);
  312. Error _encode_accessors(Ref<GLTFState> state);
  313. Error _encode_buffer_views(Ref<GLTFState> state);
  314. Error _serialize_materials(Ref<GLTFState> state);
  315. Error _serialize_meshes(Ref<GLTFState> state);
  316. Error _serialize_nodes(Ref<GLTFState> state);
  317. Error _serialize_scenes(Ref<GLTFState> state);
  318. String interpolation_to_string(const GLTFAnimation::Interpolation p_interp);
  319. GLTFAnimation::Track _convert_animation_track(Ref<GLTFState> state,
  320. GLTFAnimation::Track p_track,
  321. Ref<Animation> p_animation, Transform p_bone_rest,
  322. int32_t p_track_i,
  323. GLTFNodeIndex p_node_i);
  324. Error _encode_buffer_bins(Ref<GLTFState> state, const String &p_path);
  325. Error _encode_buffer_glb(Ref<GLTFState> state, const String &p_path);
  326. Dictionary _serialize_texture_transform_uv1(Ref<SpatialMaterial> p_material);
  327. Dictionary _serialize_texture_transform_uv2(Ref<SpatialMaterial> p_material);
  328. Error _serialize_version(Ref<GLTFState> state);
  329. Error _serialize_file(Ref<GLTFState> state, const String p_path);
  330. Error _serialize_extensions(Ref<GLTFState> state) const;
  331. public:
  332. // http://www.itu.int/rec/R-REC-BT.601
  333. // http://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.601-7-201103-I!!PDF-E.pdf
  334. static constexpr float R_BRIGHTNESS_COEFF = 0.299f;
  335. static constexpr float G_BRIGHTNESS_COEFF = 0.587f;
  336. static constexpr float B_BRIGHTNESS_COEFF = 0.114f;
  337. private:
  338. // https://github.com/microsoft/glTF-SDK/blob/master/GLTFSDK/Source/PBRUtils.cpp#L9
  339. // https://bghgary.github.io/glTF/convert-between-workflows-bjs/js/babylon.pbrUtilities.js
  340. static float solve_metallic(float p_dielectric_specular, float diffuse,
  341. float specular,
  342. float p_one_minus_specular_strength);
  343. static float get_perceived_brightness(const Color p_color);
  344. static float get_max_component(const Color &p_color);
  345. public:
  346. String _sanitize_scene_name(Ref<GLTFState> state, const String &p_name);
  347. String _legacy_validate_node_name(const String &p_name);
  348. Error _parse_gltf_extensions(Ref<GLTFState> state);
  349. void _process_mesh_instances(Ref<GLTFState> state, Node *scene_root);
  350. void _generate_scene_node(Ref<GLTFState> state, Node *scene_parent,
  351. Spatial *scene_root,
  352. const GLTFNodeIndex node_index);
  353. void _generate_skeleton_bone_node(Ref<GLTFState> state, Node *scene_parent, Spatial *scene_root, const GLTFNodeIndex node_index);
  354. void _import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
  355. const GLTFAnimationIndex index, const int bake_fps);
  356. void _convert_mesh_instances(Ref<GLTFState> state);
  357. GLTFCameraIndex _convert_camera(Ref<GLTFState> state, Camera *p_camera);
  358. void _convert_light_to_gltf(Light *light, Ref<GLTFState> state, Ref<GLTFNode> gltf_node);
  359. GLTFLightIndex _convert_light(Ref<GLTFState> state, Light *p_light);
  360. void _convert_spatial(Ref<GLTFState> state, Spatial *p_spatial, Ref<GLTFNode> p_node);
  361. void _convert_scene_node(Ref<GLTFState> state, Node *p_current,
  362. const GLTFNodeIndex p_gltf_current,
  363. const GLTFNodeIndex p_gltf_root);
  364. #ifdef MODULE_CSG_ENABLED
  365. void _convert_csg_shape_to_gltf(CSGShape *p_current, GLTFNodeIndex p_gltf_parent, Ref<GLTFNode> gltf_node, Ref<GLTFState> state);
  366. #endif // MODULE_CSG_ENABLED
  367. void _create_gltf_node(Ref<GLTFState> state,
  368. Node *p_scene_parent,
  369. GLTFNodeIndex current_node_i,
  370. GLTFNodeIndex p_parent_node_index,
  371. GLTFNodeIndex p_root_gltf_node,
  372. Ref<GLTFNode> gltf_node);
  373. void _convert_animation_player_to_gltf(
  374. AnimationPlayer *animation_player, Ref<GLTFState> state,
  375. GLTFNodeIndex p_gltf_current,
  376. GLTFNodeIndex p_gltf_root_index,
  377. Ref<GLTFNode> p_gltf_node, Node *p_scene_parent);
  378. void _check_visibility(Node *p_node, bool &retflag);
  379. void _convert_camera_to_gltf(Camera *camera, Ref<GLTFState> state,
  380. Ref<GLTFNode> gltf_node);
  381. #ifdef MODULE_GRIDMAP_ENABLED
  382. void _convert_grid_map_to_gltf(
  383. GridMap *p_grid_map,
  384. GLTFNodeIndex p_parent_node_index,
  385. GLTFNodeIndex p_root_node_index,
  386. Ref<GLTFNode> gltf_node, Ref<GLTFState> state);
  387. #endif // MODULE_GRIDMAP_ENABLED
  388. void _convert_mult_mesh_instance_to_gltf(
  389. MultiMeshInstance *p_scene_parent,
  390. GLTFNodeIndex p_parent_node_index,
  391. GLTFNodeIndex p_root_node_index,
  392. Ref<GLTFNode> gltf_node, Ref<GLTFState> state);
  393. void _convert_skeleton_to_gltf(
  394. Skeleton *p_scene_parent, Ref<GLTFState> state,
  395. GLTFNodeIndex p_parent_node_index,
  396. GLTFNodeIndex p_root_node_index,
  397. Ref<GLTFNode> gltf_node);
  398. void _convert_bone_attachment_to_gltf(BoneAttachment *p_bone_attachment,
  399. Ref<GLTFState> state,
  400. GLTFNodeIndex p_parent_node_index,
  401. GLTFNodeIndex p_root_node_index,
  402. Ref<GLTFNode> gltf_node);
  403. void _convert_mesh_instance_to_gltf(MeshInstance *p_mesh_instance,
  404. Ref<GLTFState> state,
  405. Ref<GLTFNode> gltf_node);
  406. GLTFMeshIndex _convert_mesh_to_gltf(Ref<GLTFState> state,
  407. MeshInstance *p_mesh_instance);
  408. void _convert_animation(Ref<GLTFState> state, AnimationPlayer *ap,
  409. String p_animation_track_name);
  410. Error serialize(Ref<GLTFState> state, Node *p_root, const String &p_path);
  411. Error parse(Ref<GLTFState> state, String p_paths, bool p_read_binary = false);
  412. };
  413. #endif // GLTF_DOCUMENT_H