1 | /**************************************************************************/ |
2 | /* gltf_node.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 | #ifndef GLTF_NODE_H |
32 | #define GLTF_NODE_H |
33 | |
34 | #include "../gltf_defines.h" |
35 | |
36 | #include "core/io/resource.h" |
37 | |
38 | class GLTFNode : public Resource { |
39 | GDCLASS(GLTFNode, Resource); |
40 | friend class GLTFDocument; |
41 | |
42 | private: |
43 | // matrices need to be transformed to this |
44 | GLTFNodeIndex parent = -1; |
45 | int height = -1; |
46 | Transform3D xform; |
47 | GLTFMeshIndex mesh = -1; |
48 | GLTFCameraIndex camera = -1; |
49 | GLTFSkinIndex skin = -1; |
50 | GLTFSkeletonIndex skeleton = -1; |
51 | bool joint = false; |
52 | Vector3 position; |
53 | Quaternion rotation; |
54 | Vector3 scale = Vector3(1, 1, 1); |
55 | Vector<int> children; |
56 | GLTFLightIndex light = -1; |
57 | Dictionary additional_data; |
58 | |
59 | protected: |
60 | static void _bind_methods(); |
61 | |
62 | public: |
63 | GLTFNodeIndex get_parent(); |
64 | void set_parent(GLTFNodeIndex p_parent); |
65 | |
66 | int get_height(); |
67 | void set_height(int p_height); |
68 | |
69 | Transform3D get_xform(); |
70 | void set_xform(Transform3D p_xform); |
71 | |
72 | GLTFMeshIndex get_mesh(); |
73 | void set_mesh(GLTFMeshIndex p_mesh); |
74 | |
75 | GLTFCameraIndex get_camera(); |
76 | void set_camera(GLTFCameraIndex p_camera); |
77 | |
78 | GLTFSkinIndex get_skin(); |
79 | void set_skin(GLTFSkinIndex p_skin); |
80 | |
81 | GLTFSkeletonIndex get_skeleton(); |
82 | void set_skeleton(GLTFSkeletonIndex p_skeleton); |
83 | |
84 | Vector3 get_position(); |
85 | void set_position(Vector3 p_position); |
86 | |
87 | Quaternion get_rotation(); |
88 | void set_rotation(Quaternion p_rotation); |
89 | |
90 | Vector3 get_scale(); |
91 | void set_scale(Vector3 p_scale); |
92 | |
93 | Vector<int> get_children(); |
94 | void set_children(Vector<int> p_children); |
95 | |
96 | GLTFLightIndex get_light(); |
97 | void set_light(GLTFLightIndex p_light); |
98 | |
99 | Variant get_additional_data(const StringName &p_extension_name); |
100 | void set_additional_data(const StringName &p_extension_name, Variant p_additional_data); |
101 | }; |
102 | |
103 | #endif // GLTF_NODE_H |
104 | |