Debian Codegraph @

modules/gltf/structures/gltf_skin.h

raw symbols SCIP
1 /**************************************************************************/
2 /* gltf_skin.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
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
31 #pragma once
32
33 #include "../gltf_defines.h"
34
35 #include "core/io/resource.h"
36 #include "scene/resources/3d/skin.h"
37
38 template <typename T>
39 class TypedArray;
40
41 class GLTFSkin : public Resource {
42 GDCLASS(GLTFSkin, Resource);
43 friend class GLTFDocument;
44 friend class SkinTool;
45 friend class FBXDocument;
46
47 private:
48 // The "skeleton" property defined in the gltf spec. -1 = Scene Root
49 GLTFNodeIndex skin_root = -1;
50
51 Vector<GLTFNodeIndex> joints_original;
52 Vector<Transform3D> inverse_binds;
53
54 // Note: joints + non_joints should form a complete subtree, or subtrees
55 // with a common parent
56
57 // All nodes that are skins that are caught in-between the original joints
58 // (inclusive of joints_original)
59 Vector<GLTFNodeIndex> joints;
60
61 // All Nodes that are caught in-between skin joint nodes, and are not
62 // defined as joints by any skin
63 Vector<GLTFNodeIndex> non_joints;
64
65 // The roots of the skin. In the case of multiple roots, their parent *must*
66 // be the same (the roots must be siblings)
67 Vector<GLTFNodeIndex> roots;
68
69 // The GLTF Skeleton this Skin points to (after we determine skeletons)
70 GLTFSkeletonIndex skeleton = -1;
71
72 // A mapping from the joint indices (in the order of joints_original) to the
73 // Godot Skeleton's bone_indices
74 HashMap<int, int> joint_i_to_bone_i;
75 HashMap<int, StringName> joint_i_to_name;
76
77 // The Actual Skin that will be created as a mapping between the IBM's of
78 // this skin to the generated skeleton for the mesh instances.
79 Ref<Skin> godot_skin;
80
81 protected:
82 static void _bind_methods();
83
84 public:
85 GLTFNodeIndex get_skin_root();
86 void set_skin_root(GLTFNodeIndex p_skin_root);
87
88 Vector<GLTFNodeIndex> get_joints_original();
89 void set_joints_original(const Vector<GLTFNodeIndex> &p_joints_original);
90
91 TypedArray<Transform3D> get_inverse_binds();
92 void set_inverse_binds(const TypedArray<Transform3D> &p_inverse_binds);
93
94 Vector<GLTFNodeIndex> get_joints();
95 void set_joints(const Vector<GLTFNodeIndex> &p_joints);
96
97 Vector<GLTFNodeIndex> get_non_joints();
98 void set_non_joints(const Vector<GLTFNodeIndex> &p_non_joints);
99
100 Vector<GLTFNodeIndex> get_roots();
101 void set_roots(const Vector<GLTFNodeIndex> &p_roots);
102
103 int get_skeleton();
104 void set_skeleton(int p_skeleton);
105
106 Dictionary get_joint_i_to_bone_i();
107 void set_joint_i_to_bone_i(const Dictionary &p_joint_i_to_bone_i);
108
109 Dictionary get_joint_i_to_name();
110 void set_joint_i_to_name(const Dictionary &p_joint_i_to_name);
111
112 Ref<Skin> get_godot_skin();
113 void set_godot_skin(const Ref<Skin> &p_godot_skin);
114
115 Dictionary to_dictionary();
116 Error from_dictionary(const Dictionary &dict);
117 };