Преглед изворни кода

[3.x] GLTF: Organize structures and extensions into subfolders

Aaron Franke пре 2 година
родитељ
комит
d8aa3b32c9
31 измењених фајлова са 45 додато и 23 уклоњено
  1. 10 0
      modules/gltf/README.md
  2. 2 0
      modules/gltf/SCsub
  3. 9 0
      modules/gltf/extensions/SCsub
  4. 0 0
      modules/gltf/extensions/gltf_light.cpp
  5. 1 0
      modules/gltf/extensions/gltf_light.h
  6. 0 0
      modules/gltf/extensions/gltf_spec_gloss.cpp
  7. 1 0
      modules/gltf/extensions/gltf_spec_gloss.h
  8. 1 1
      modules/gltf/gltf_document.cpp
  9. 1 2
      modules/gltf/gltf_document.h
  10. 11 11
      modules/gltf/gltf_state.h
  11. 1 1
      modules/gltf/register_types.cpp
  12. 0 0
      modules/gltf/structures/gltf_accessor.cpp
  13. 1 1
      modules/gltf/structures/gltf_accessor.h
  14. 0 0
      modules/gltf/structures/gltf_animation.cpp
  15. 0 0
      modules/gltf/structures/gltf_animation.h
  16. 0 0
      modules/gltf/structures/gltf_buffer_view.cpp
  17. 1 1
      modules/gltf/structures/gltf_buffer_view.h
  18. 0 0
      modules/gltf/structures/gltf_camera.cpp
  19. 0 0
      modules/gltf/structures/gltf_camera.h
  20. 0 0
      modules/gltf/structures/gltf_mesh.cpp
  21. 0 0
      modules/gltf/structures/gltf_mesh.h
  22. 0 0
      modules/gltf/structures/gltf_node.cpp
  23. 1 1
      modules/gltf/structures/gltf_node.h
  24. 1 1
      modules/gltf/structures/gltf_skeleton.cpp
  25. 1 1
      modules/gltf/structures/gltf_skeleton.h
  26. 1 1
      modules/gltf/structures/gltf_skin.cpp
  27. 1 1
      modules/gltf/structures/gltf_skin.h
  28. 0 0
      modules/gltf/structures/gltf_texture.cpp
  29. 1 1
      modules/gltf/structures/gltf_texture.h
  30. 0 0
      modules/gltf/structures/gltf_texture_sampler.cpp
  31. 0 0
      modules/gltf/structures/gltf_texture_sampler.h

+ 10 - 0
modules/gltf/README.md

@@ -0,0 +1,10 @@
+# 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.

+ 2 - 0
modules/gltf/SCsub

@@ -7,3 +7,5 @@ env_gltf = env_modules.Clone()
 
 # Godot source files
 env_gltf.add_source_files(env.modules_sources, "*.cpp")
+env_gltf.add_source_files(env.modules_sources, "structures/*.cpp")
+SConscript("extensions/SCsub")

+ 9 - 0
modules/gltf/extensions/SCsub

@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+Import("env")
+Import("env_modules")
+
+env_gltf = env_modules.Clone()
+
+# Godot source files
+env_gltf.add_source_files(env.modules_sources, "*.cpp")

+ 0 - 0
modules/gltf/gltf_light.cpp → modules/gltf/extensions/gltf_light.cpp


+ 1 - 0
modules/gltf/gltf_light.h → modules/gltf/extensions/gltf_light.h

@@ -31,6 +31,7 @@
 #ifndef GLTF_LIGHT_H
 #define GLTF_LIGHT_H
 
+#include "../gltf_defines.h"
 #include "core/resource.h"
 
 class GLTFLight : public Resource {

+ 0 - 0
modules/gltf/gltf_spec_gloss.cpp → modules/gltf/extensions/gltf_spec_gloss.cpp


+ 1 - 0
modules/gltf/gltf_spec_gloss.h → modules/gltf/extensions/gltf_spec_gloss.h

@@ -31,6 +31,7 @@
 #ifndef GLTF_SPEC_GLOSS_H
 #define GLTF_SPEC_GLOSS_H
 
+#include "../gltf_defines.h"
 #include "core/image.h"
 #include "core/resource.h"
 

+ 1 - 1
modules/gltf/gltf_document.cpp

@@ -30,7 +30,7 @@
 
 #include "gltf_document.h"
 
-#include "gltf_spec_gloss.h"
+#include "extensions/gltf_spec_gloss.h"
 #include "gltf_state.h"
 
 #include "core/bind/core_bind.h" // FIXME: Shouldn't use _Directory but DirAccess.

+ 1 - 2
modules/gltf/gltf_document.h

@@ -32,6 +32,7 @@
 #define GLTF_DOCUMENT_H
 
 #include "gltf_defines.h"
+#include "structures/gltf_animation.h"
 
 #include "scene/3d/bone_attachment.h"
 #include "scene/3d/camera.h"
@@ -43,8 +44,6 @@
 #include "scene/resources/material.h"
 #include "scene/resources/texture.h"
 
-#include "gltf_animation.h"
-
 #include "modules/modules_enabled.gen.h" // For csg, gridmap.
 
 #ifdef MODULE_CSG_ENABLED

+ 11 - 11
modules/gltf/gltf_state.h

@@ -31,18 +31,18 @@
 #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 "gltf_texture_sampler.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 "structures/gltf_texture_sampler.h"
 
 class GLTFState : public Resource {
 	GDCLASS(GLTFState, Resource);

+ 1 - 1
modules/gltf/register_types.cpp

@@ -32,7 +32,7 @@
 
 #include "register_types.h"
 
-#include "gltf_spec_gloss.h"
+#include "extensions/gltf_spec_gloss.h"
 #include "gltf_state.h"
 
 #ifdef TOOLS_ENABLED

+ 0 - 0
modules/gltf/gltf_accessor.cpp → modules/gltf/structures/gltf_accessor.cpp


+ 1 - 1
modules/gltf/gltf_accessor.h → modules/gltf/structures/gltf_accessor.h

@@ -31,8 +31,8 @@
 #ifndef GLTF_ACCESSOR_H
 #define GLTF_ACCESSOR_H
 
+#include "../gltf_defines.h"
 #include "core/resource.h"
-#include "gltf_defines.h"
 
 struct GLTFAccessor : public Resource {
 	GDCLASS(GLTFAccessor, Resource);

+ 0 - 0
modules/gltf/gltf_animation.cpp → modules/gltf/structures/gltf_animation.cpp


+ 0 - 0
modules/gltf/gltf_animation.h → modules/gltf/structures/gltf_animation.h


+ 0 - 0
modules/gltf/gltf_buffer_view.cpp → modules/gltf/structures/gltf_buffer_view.cpp


+ 1 - 1
modules/gltf/gltf_buffer_view.h → 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/resource.h"
-#include "gltf_defines.h"
 
 class GLTFBufferView : public Resource {
 	GDCLASS(GLTFBufferView, Resource);

+ 0 - 0
modules/gltf/gltf_camera.cpp → modules/gltf/structures/gltf_camera.cpp


+ 0 - 0
modules/gltf/gltf_camera.h → modules/gltf/structures/gltf_camera.h


+ 0 - 0
modules/gltf/gltf_mesh.cpp → modules/gltf/structures/gltf_mesh.cpp


+ 0 - 0
modules/gltf/gltf_mesh.h → modules/gltf/structures/gltf_mesh.h


+ 0 - 0
modules/gltf/gltf_node.cpp → modules/gltf/structures/gltf_node.cpp


+ 1 - 1
modules/gltf/gltf_node.h → modules/gltf/structures/gltf_node.h

@@ -31,8 +31,8 @@
 #ifndef GLTF_NODE_H
 #define GLTF_NODE_H
 
+#include "../gltf_defines.h"
 #include "core/resource.h"
-#include "gltf_defines.h"
 
 class GLTFNode : public Resource {
 	GDCLASS(GLTFNode, Resource);

+ 1 - 1
modules/gltf/gltf_skeleton.cpp → 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.h"
 
 void GLTFSkeleton::_bind_methods() {

+ 1 - 1
modules/gltf/gltf_skeleton.h → modules/gltf/structures/gltf_skeleton.h

@@ -31,8 +31,8 @@
 #ifndef GLTF_SKELETON_H
 #define GLTF_SKELETON_H
 
+#include "../gltf_defines.h"
 #include "core/resource.h"
-#include "gltf_defines.h"
 
 class GLTFSkeleton : public Resource {
 	GDCLASS(GLTFSkeleton, Resource);

+ 1 - 1
modules/gltf/gltf_skin.cpp → 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() {

+ 1 - 1
modules/gltf/gltf_skin.h → modules/gltf/structures/gltf_skin.h

@@ -31,8 +31,8 @@
 #ifndef GLTF_SKIN_H
 #define GLTF_SKIN_H
 
+#include "../gltf_defines.h"
 #include "core/resource.h"
-#include "gltf_defines.h"
 
 class GLTFSkin : public Resource {
 	GDCLASS(GLTFSkin, Resource);

+ 0 - 0
modules/gltf/gltf_texture.cpp → modules/gltf/structures/gltf_texture.cpp


+ 1 - 1
modules/gltf/gltf_texture.h → modules/gltf/structures/gltf_texture.h

@@ -31,8 +31,8 @@
 #ifndef GLTF_TEXTURE_H
 #define GLTF_TEXTURE_H
 
+#include "../gltf_defines.h"
 #include "core/resource.h"
-#include "gltf_defines.h"
 
 class GLTFTexture : public Resource {
 	GDCLASS(GLTFTexture, Resource);

+ 0 - 0
modules/gltf/gltf_texture_sampler.cpp → modules/gltf/structures/gltf_texture_sampler.cpp


+ 0 - 0
modules/gltf/gltf_texture_sampler.h → modules/gltf/structures/gltf_texture_sampler.h