Path: blob/master/modules/gltf/structures/gltf_skin.h
10278 views
/**************************************************************************/1/* gltf_skin.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "../gltf_defines.h"3334#include "core/io/resource.h"35#include "scene/resources/3d/skin.h"3637template <typename T>38class TypedArray;3940class GLTFSkin : public Resource {41GDCLASS(GLTFSkin, Resource);42friend class GLTFDocument;43friend class SkinTool;44friend class FBXDocument;4546private:47// The "skeleton" property defined in the gltf spec. -1 = Scene Root48GLTFNodeIndex skin_root = -1;4950Vector<GLTFNodeIndex> joints_original;51Vector<Transform3D> inverse_binds;5253// Note: joints + non_joints should form a complete subtree, or subtrees54// with a common parent5556// All nodes that are skins that are caught in-between the original joints57// (inclusive of joints_original)58Vector<GLTFNodeIndex> joints;5960// All Nodes that are caught in-between skin joint nodes, and are not61// defined as joints by any skin62Vector<GLTFNodeIndex> non_joints;6364// The roots of the skin. In the case of multiple roots, their parent *must*65// be the same (the roots must be siblings)66Vector<GLTFNodeIndex> roots;6768// The GLTF Skeleton this Skin points to (after we determine skeletons)69GLTFSkeletonIndex skeleton = -1;7071// A mapping from the joint indices (in the order of joints_original) to the72// Godot Skeleton's bone_indices73HashMap<int, int> joint_i_to_bone_i;74HashMap<int, StringName> joint_i_to_name;7576// The Actual Skin that will be created as a mapping between the IBM's of77// this skin to the generated skeleton for the mesh instances.78Ref<Skin> godot_skin;7980protected:81static void _bind_methods();8283public:84GLTFNodeIndex get_skin_root();85void set_skin_root(GLTFNodeIndex p_skin_root);8687Vector<GLTFNodeIndex> get_joints_original();88void set_joints_original(Vector<GLTFNodeIndex> p_joints_original);8990TypedArray<Transform3D> get_inverse_binds();91void set_inverse_binds(TypedArray<Transform3D> p_inverse_binds);9293Vector<GLTFNodeIndex> get_joints();94void set_joints(Vector<GLTFNodeIndex> p_joints);9596Vector<GLTFNodeIndex> get_non_joints();97void set_non_joints(Vector<GLTFNodeIndex> p_non_joints);9899Vector<GLTFNodeIndex> get_roots();100void set_roots(Vector<GLTFNodeIndex> p_roots);101102int get_skeleton();103void set_skeleton(int p_skeleton);104105Dictionary get_joint_i_to_bone_i();106void set_joint_i_to_bone_i(Dictionary p_joint_i_to_bone_i);107108Dictionary get_joint_i_to_name();109void set_joint_i_to_name(Dictionary p_joint_i_to_name);110111Ref<Skin> get_godot_skin();112void set_godot_skin(Ref<Skin> p_godot_skin);113114Dictionary to_dictionary();115Error from_dictionary(const Dictionary &dict);116};117118119