diff options
Diffstat (limited to 'modules/gltf')
-rw-r--r-- | modules/gltf/README.md | 11 | ||||
-rw-r--r-- | modules/gltf/SCsub | 2 | ||||
-rw-r--r-- | modules/gltf/extensions/gltf_light.cpp (renamed from modules/gltf/gltf_light.cpp) | 0 | ||||
-rw-r--r-- | modules/gltf/extensions/gltf_light.h (renamed from modules/gltf/gltf_light.h) | 0 | ||||
-rw-r--r-- | modules/gltf/extensions/gltf_spec_gloss.cpp (renamed from modules/gltf/gltf_spec_gloss.cpp) | 0 | ||||
-rw-r--r-- | modules/gltf/extensions/gltf_spec_gloss.h (renamed from modules/gltf/gltf_spec_gloss.h) | 1 | ||||
-rw-r--r-- | modules/gltf/gltf_document.cpp | 4 | ||||
-rw-r--r-- | modules/gltf/gltf_document.h | 2 | ||||
-rw-r--r-- | modules/gltf/gltf_document_extension.h | 2 | ||||
-rw-r--r-- | modules/gltf/gltf_document_extension_convert_importer_mesh.h | 7 | ||||
-rw-r--r-- | modules/gltf/gltf_state.h | 21 | ||||
-rw-r--r-- | modules/gltf/register_types.cpp | 22 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_accessor.cpp (renamed from modules/gltf/gltf_accessor.cpp) | 0 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_accessor.h (renamed from modules/gltf/gltf_accessor.h) | 3 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_animation.cpp (renamed from modules/gltf/gltf_animation.cpp) | 0 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_animation.h (renamed from modules/gltf/gltf_animation.h) | 1 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_buffer_view.cpp (renamed from modules/gltf/gltf_buffer_view.cpp) | 2 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_buffer_view.h (renamed from modules/gltf/gltf_buffer_view.h) | 3 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_camera.cpp (renamed from modules/gltf/gltf_camera.cpp) | 0 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_camera.h (renamed from modules/gltf/gltf_camera.h) | 1 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_mesh.cpp (renamed from modules/gltf/gltf_mesh.cpp) | 0 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_mesh.h (renamed from modules/gltf/gltf_mesh.h) | 0 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_node.cpp (renamed from modules/gltf/gltf_node.cpp) | 0 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_node.h (renamed from modules/gltf/gltf_node.h) | 3 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_skeleton.cpp (renamed from modules/gltf/gltf_skeleton.cpp) | 2 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_skeleton.h (renamed from modules/gltf/gltf_skeleton.h) | 3 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_skin.cpp (renamed from modules/gltf/gltf_skin.cpp) | 2 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_skin.h (renamed from modules/gltf/gltf_skin.h) | 3 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_texture.cpp (renamed from modules/gltf/gltf_texture.cpp) | 0 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_texture.h (renamed from modules/gltf/gltf_texture.h) | 2 |
30 files changed, 60 insertions, 37 deletions
diff --git a/modules/gltf/README.md b/modules/gltf/README.md new file mode 100644 index 0000000000..5d8966b201 --- /dev/null +++ b/modules/gltf/README.md @@ -0,0 +1,11 @@ +# Godot GLTF import and export module + +In a nutshell, the GLTF module works like this: + +* The [`structures/`](structures/) folder contains GLTF structures, the + small pieces that make up a GLTF file, represented as C++ classes. +* The [`extensions/`](extensions/) folder contains GLTF extensions, which + are optional features that build on top of the base GLTF spec. +* [`GLTFState`](gltf_state.h) holds collections of structures and extensions. +* [`GLTFDocument`](gltf_document.h) operates on GLTFState and its elements. +* The [`editor/`](editor/) folder uses GLTFDocument to import and export 3D models. diff --git a/modules/gltf/SCsub b/modules/gltf/SCsub index 3379404a00..6634d5df7b 100644 --- a/modules/gltf/SCsub +++ b/modules/gltf/SCsub @@ -7,5 +7,7 @@ env_gltf = env_modules.Clone() # Godot's own source files env_gltf.add_source_files(env.modules_sources, "*.cpp") +env_gltf.add_source_files(env.modules_sources, "extensions/*.cpp") +env_gltf.add_source_files(env.modules_sources, "structures/*.cpp") if env["tools"]: env_gltf.add_source_files(env.modules_sources, "editor/*.cpp") diff --git a/modules/gltf/gltf_light.cpp b/modules/gltf/extensions/gltf_light.cpp index af21a4e804..af21a4e804 100644 --- a/modules/gltf/gltf_light.cpp +++ b/modules/gltf/extensions/gltf_light.cpp diff --git a/modules/gltf/gltf_light.h b/modules/gltf/extensions/gltf_light.h index 58fa299dfd..58fa299dfd 100644 --- a/modules/gltf/gltf_light.h +++ b/modules/gltf/extensions/gltf_light.h diff --git a/modules/gltf/gltf_spec_gloss.cpp b/modules/gltf/extensions/gltf_spec_gloss.cpp index 83af91bfcc..83af91bfcc 100644 --- a/modules/gltf/gltf_spec_gloss.cpp +++ b/modules/gltf/extensions/gltf_spec_gloss.cpp diff --git a/modules/gltf/gltf_spec_gloss.h b/modules/gltf/extensions/gltf_spec_gloss.h index f8a431bdce..a45fa4296c 100644 --- a/modules/gltf/gltf_spec_gloss.h +++ b/modules/gltf/extensions/gltf_spec_gloss.h @@ -64,4 +64,5 @@ public: Ref<Image> get_spec_gloss_img(); void set_spec_gloss_img(Ref<Image> p_spec_gloss_img); }; + #endif // GLTF_SPEC_GLOSS_H diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index aa2ec4a399..4ca8482ba3 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -30,9 +30,9 @@ #include "gltf_document.h" +#include "extensions/gltf_spec_gloss.h" #include "gltf_document_extension.h" #include "gltf_document_extension_convert_importer_mesh.h" -#include "gltf_spec_gloss.h" #include "gltf_state.h" #include "core/crypto/crypto_core.h" @@ -5218,7 +5218,7 @@ GLTFCameraIndex GLTFDocument::_convert_camera(Ref<GLTFState> state, Camera3D *p_ Ref<GLTFCamera> c; c.instantiate(); - if (p_camera->get_projection() == Camera3D::Projection::PROJECTION_PERSPECTIVE) { + if (p_camera->get_projection() == Camera3D::ProjectionType::PROJECTION_PERSPECTIVE) { c->set_perspective(true); } c->set_fov_size(p_camera->get_fov()); diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h index 0c585bf49b..36a2f94a4e 100644 --- a/modules/gltf/gltf_document.h +++ b/modules/gltf/gltf_document.h @@ -31,8 +31,8 @@ #ifndef GLTF_DOCUMENT_H #define GLTF_DOCUMENT_H -#include "gltf_animation.h" #include "gltf_defines.h" +#include "structures/gltf_animation.h" #include "scene/3d/bone_attachment_3d.h" #include "scene/3d/importer_mesh_instance_3d.h" diff --git a/modules/gltf/gltf_document_extension.h b/modules/gltf/gltf_document_extension.h index 8fd4d4e54e..0ef9109584 100644 --- a/modules/gltf/gltf_document_extension.h +++ b/modules/gltf/gltf_document_extension.h @@ -31,8 +31,8 @@ #ifndef GLTF_DOCUMENT_EXTENSION_H #define GLTF_DOCUMENT_EXTENSION_H -#include "gltf_node.h" #include "gltf_state.h" +#include "structures/gltf_node.h" class GLTFDocumentExtension : public Resource { GDCLASS(GLTFDocumentExtension, Resource); diff --git a/modules/gltf/gltf_document_extension_convert_importer_mesh.h b/modules/gltf/gltf_document_extension_convert_importer_mesh.h index b7798c9517..00e664e73f 100644 --- a/modules/gltf/gltf_document_extension_convert_importer_mesh.h +++ b/modules/gltf/gltf_document_extension_convert_importer_mesh.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GLTF_EXTENSION_EDITOR_H -#define GLTF_EXTENSION_EDITOR_H +#ifndef GLTF_DOCUMENT_EXTENSION_CONVERT_IMPORTER_MESH_H +#define GLTF_DOCUMENT_EXTENSION_CONVERT_IMPORTER_MESH_H #include "gltf_document_extension.h" @@ -46,4 +46,5 @@ protected: public: Error import_post(Ref<GLTFState> p_state, Node *p_root) override; }; -#endif // GLTF_EXTENSION_EDITOR_H + +#endif // GLTF_DOCUMENT_EXTENSION_CONVERT_IMPORTER_MESH_H diff --git a/modules/gltf/gltf_state.h b/modules/gltf/gltf_state.h index dd6a65e496..d2a4948f06 100644 --- a/modules/gltf/gltf_state.h +++ b/modules/gltf/gltf_state.h @@ -31,17 +31,17 @@ #ifndef GLTF_STATE_H #define GLTF_STATE_H -#include "gltf_accessor.h" -#include "gltf_animation.h" -#include "gltf_buffer_view.h" -#include "gltf_camera.h" -#include "gltf_light.h" -#include "gltf_mesh.h" -#include "gltf_node.h" -#include "gltf_skeleton.h" -#include "gltf_skin.h" +#include "extensions/gltf_light.h" #include "gltf_template_convert.h" -#include "gltf_texture.h" +#include "structures/gltf_accessor.h" +#include "structures/gltf_animation.h" +#include "structures/gltf_buffer_view.h" +#include "structures/gltf_camera.h" +#include "structures/gltf_mesh.h" +#include "structures/gltf_node.h" +#include "structures/gltf_skeleton.h" +#include "structures/gltf_skin.h" +#include "structures/gltf_texture.h" #include "core/templates/rb_map.h" #include "scene/animation/animation_player.h" @@ -192,4 +192,5 @@ public: // this->material_cache = p_material_cache; //} }; + #endif // GLTF_STATE_H diff --git a/modules/gltf/register_types.cpp b/modules/gltf/register_types.cpp index b8bac79584..1e1204aa57 100644 --- a/modules/gltf/register_types.cpp +++ b/modules/gltf/register_types.cpp @@ -32,21 +32,21 @@ #ifndef _3D_DISABLED -#include "gltf_accessor.h" -#include "gltf_animation.h" -#include "gltf_buffer_view.h" -#include "gltf_camera.h" +#include "extensions/gltf_light.h" +#include "extensions/gltf_spec_gloss.h" #include "gltf_document.h" #include "gltf_document_extension.h" #include "gltf_document_extension_convert_importer_mesh.h" -#include "gltf_light.h" -#include "gltf_mesh.h" -#include "gltf_node.h" -#include "gltf_skeleton.h" -#include "gltf_skin.h" -#include "gltf_spec_gloss.h" #include "gltf_state.h" -#include "gltf_texture.h" +#include "structures/gltf_accessor.h" +#include "structures/gltf_animation.h" +#include "structures/gltf_buffer_view.h" +#include "structures/gltf_camera.h" +#include "structures/gltf_mesh.h" +#include "structures/gltf_node.h" +#include "structures/gltf_skeleton.h" +#include "structures/gltf_skin.h" +#include "structures/gltf_texture.h" #ifdef TOOLS_ENABLED #include "core/config/project_settings.h" diff --git a/modules/gltf/gltf_accessor.cpp b/modules/gltf/structures/gltf_accessor.cpp index 1b8911fe72..1b8911fe72 100644 --- a/modules/gltf/gltf_accessor.cpp +++ b/modules/gltf/structures/gltf_accessor.cpp diff --git a/modules/gltf/gltf_accessor.h b/modules/gltf/structures/gltf_accessor.h index d89cc5d1ae..bfb71d57fe 100644 --- a/modules/gltf/gltf_accessor.h +++ b/modules/gltf/structures/gltf_accessor.h @@ -33,7 +33,7 @@ #include "core/io/resource.h" -#include "gltf_defines.h" +#include "../gltf_defines.h" struct GLTFAccessor : public Resource { GDCLASS(GLTFAccessor, Resource); @@ -101,4 +101,5 @@ public: int get_sparse_values_byte_offset(); void set_sparse_values_byte_offset(int p_sparse_values_byte_offset); }; + #endif // GLTF_ACCESSOR_H diff --git a/modules/gltf/gltf_animation.cpp b/modules/gltf/structures/gltf_animation.cpp index e598c870ab..e598c870ab 100644 --- a/modules/gltf/gltf_animation.cpp +++ b/modules/gltf/structures/gltf_animation.cpp diff --git a/modules/gltf/gltf_animation.h b/modules/gltf/structures/gltf_animation.h index 8688ddb937..3777f579f6 100644 --- a/modules/gltf/gltf_animation.h +++ b/modules/gltf/structures/gltf_animation.h @@ -71,4 +71,5 @@ private: bool loop = false; HashMap<int, Track> tracks; }; + #endif // GLTF_ANIMATION_H diff --git a/modules/gltf/gltf_buffer_view.cpp b/modules/gltf/structures/gltf_buffer_view.cpp index fc467367c6..ba19ed8628 100644 --- a/modules/gltf/gltf_buffer_view.cpp +++ b/modules/gltf/structures/gltf_buffer_view.cpp @@ -30,7 +30,7 @@ #include "gltf_buffer_view.h" -#include "gltf_document_extension.h" +#include "../gltf_document_extension.h" void GLTFBufferView::_bind_methods() { ClassDB::bind_method(D_METHOD("get_buffer"), &GLTFBufferView::get_buffer); diff --git a/modules/gltf/gltf_buffer_view.h b/modules/gltf/structures/gltf_buffer_view.h index e28456fd8e..b1f500de25 100644 --- a/modules/gltf/gltf_buffer_view.h +++ b/modules/gltf/structures/gltf_buffer_view.h @@ -31,8 +31,8 @@ #ifndef GLTF_BUFFER_VIEW_H #define GLTF_BUFFER_VIEW_H +#include "../gltf_defines.h" #include "core/io/resource.h" -#include "gltf_defines.h" class GLTFBufferView : public Resource { GDCLASS(GLTFBufferView, Resource); @@ -65,4 +65,5 @@ public: void set_indices(bool p_indices); // matrices need to be transformed to this }; + #endif // GLTF_BUFFER_VIEW_H diff --git a/modules/gltf/gltf_camera.cpp b/modules/gltf/structures/gltf_camera.cpp index f3ea6a1c4c..f3ea6a1c4c 100644 --- a/modules/gltf/gltf_camera.cpp +++ b/modules/gltf/structures/gltf_camera.cpp diff --git a/modules/gltf/gltf_camera.h b/modules/gltf/structures/gltf_camera.h index c696d4cc6b..b7df741825 100644 --- a/modules/gltf/gltf_camera.h +++ b/modules/gltf/structures/gltf_camera.h @@ -55,4 +55,5 @@ public: float get_depth_near() const { return depth_near; } void set_depth_near(float p_val) { depth_near = p_val; } }; + #endif // GLTF_CAMERA_H diff --git a/modules/gltf/gltf_mesh.cpp b/modules/gltf/structures/gltf_mesh.cpp index 3add8304b1..3add8304b1 100644 --- a/modules/gltf/gltf_mesh.cpp +++ b/modules/gltf/structures/gltf_mesh.cpp diff --git a/modules/gltf/gltf_mesh.h b/modules/gltf/structures/gltf_mesh.h index dc26120b48..dc26120b48 100644 --- a/modules/gltf/gltf_mesh.h +++ b/modules/gltf/structures/gltf_mesh.h diff --git a/modules/gltf/gltf_node.cpp b/modules/gltf/structures/gltf_node.cpp index 86280603fa..86280603fa 100644 --- a/modules/gltf/gltf_node.cpp +++ b/modules/gltf/structures/gltf_node.cpp diff --git a/modules/gltf/gltf_node.h b/modules/gltf/structures/gltf_node.h index 7b03b55fbc..1a57ea32e2 100644 --- a/modules/gltf/gltf_node.h +++ b/modules/gltf/structures/gltf_node.h @@ -31,8 +31,8 @@ #ifndef GLTF_NODE_H #define GLTF_NODE_H +#include "../gltf_defines.h" #include "core/io/resource.h" -#include "gltf_defines.h" class GLTFNode : public Resource { GDCLASS(GLTFNode, Resource); @@ -97,4 +97,5 @@ public: GLTFLightIndex get_light(); void set_light(GLTFLightIndex p_light); }; + #endif // GLTF_NODE_H diff --git a/modules/gltf/gltf_skeleton.cpp b/modules/gltf/structures/gltf_skeleton.cpp index 994e9bf6e7..90a6b0f50f 100644 --- a/modules/gltf/gltf_skeleton.cpp +++ b/modules/gltf/structures/gltf_skeleton.cpp @@ -30,7 +30,7 @@ #include "gltf_skeleton.h" -#include "gltf_template_convert.h" +#include "../gltf_template_convert.h" #include "scene/3d/bone_attachment_3d.h" void GLTFSkeleton::_bind_methods() { diff --git a/modules/gltf/gltf_skeleton.h b/modules/gltf/structures/gltf_skeleton.h index eaeff0c0cb..db88623213 100644 --- a/modules/gltf/gltf_skeleton.h +++ b/modules/gltf/structures/gltf_skeleton.h @@ -31,8 +31,8 @@ #ifndef GLTF_SKELETON_H #define GLTF_SKELETON_H +#include "../gltf_defines.h" #include "core/io/resource.h" -#include "gltf_defines.h" class GLTFSkeleton : public Resource { GDCLASS(GLTFSkeleton, Resource); @@ -98,4 +98,5 @@ public: int32_t get_bone_attachment_count(); }; + #endif // GLTF_SKELETON_H diff --git a/modules/gltf/gltf_skin.cpp b/modules/gltf/structures/gltf_skin.cpp index 8b0ca7546c..2e46ee3be2 100644 --- a/modules/gltf/gltf_skin.cpp +++ b/modules/gltf/structures/gltf_skin.cpp @@ -30,7 +30,7 @@ #include "gltf_skin.h" -#include "gltf_template_convert.h" +#include "../gltf_template_convert.h" #include "scene/resources/skin.h" void GLTFSkin::_bind_methods() { diff --git a/modules/gltf/gltf_skin.h b/modules/gltf/structures/gltf_skin.h index a3f0b2c8af..59b6a300ac 100644 --- a/modules/gltf/gltf_skin.h +++ b/modules/gltf/structures/gltf_skin.h @@ -31,8 +31,8 @@ #ifndef GLTF_SKIN_H #define GLTF_SKIN_H +#include "../gltf_defines.h" #include "core/io/resource.h" -#include "gltf_defines.h" class GLTFSkin : public Resource { GDCLASS(GLTFSkin, Resource); @@ -106,4 +106,5 @@ public: Ref<Skin> get_godot_skin(); void set_godot_skin(Ref<Skin> p_godot_skin); }; + #endif // GLTF_SKIN_H diff --git a/modules/gltf/gltf_texture.cpp b/modules/gltf/structures/gltf_texture.cpp index 2a21cb3df8..2a21cb3df8 100644 --- a/modules/gltf/gltf_texture.cpp +++ b/modules/gltf/structures/gltf_texture.cpp diff --git a/modules/gltf/gltf_texture.h b/modules/gltf/structures/gltf_texture.h index 2c1c5c2275..b1d12dddfa 100644 --- a/modules/gltf/gltf_texture.h +++ b/modules/gltf/structures/gltf_texture.h @@ -31,8 +31,8 @@ #ifndef GLTF_TEXTURE_H #define GLTF_TEXTURE_H +#include "../gltf_defines.h" #include "core/io/resource.h" -#include "gltf_defines.h" class GLTFTexture : public Resource { GDCLASS(GLTFTexture, Resource); |