summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/camera/camera_macos.h2
-rw-r--r--modules/camera/camera_win.h6
-rw-r--r--modules/enet/enet_multiplayer_peer.h6
-rw-r--r--modules/freetype/uwpdef.h5
-rw-r--r--modules/gdscript/gdscript.cpp11
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp6
-rw-r--r--modules/gdscript/gdscript_byte_codegen.cpp14
-rw-r--r--modules/gdscript/gdscript_byte_codegen.h6
-rw-r--r--modules/gdscript/gdscript_codegen.h6
-rw-r--r--modules/gdscript/gdscript_disassembler.cpp6
-rw-r--r--modules/gdscript/gdscript_function.h6
-rw-r--r--modules/gdscript/gdscript_lambda_callable.h6
-rw-r--r--modules/gdscript/gdscript_parser.cpp3
-rw-r--r--modules/gdscript/gdscript_rpc_callable.h6
-rw-r--r--modules/gdscript/gdscript_tokenizer.h2
-rw-r--r--modules/gdscript/gdscript_vm.cpp18
-rw-r--r--modules/gdscript/gdscript_warning.h6
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.h4
-rw-r--r--modules/gdscript/language_server/gdscript_language_protocol.h2
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.h4
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.h4
-rw-r--r--modules/gdscript/language_server/godot_lsp.h (renamed from modules/gdscript/language_server/lsp.hpp)4
-rw-r--r--modules/gdscript/register_types.cpp2
-rw-r--r--modules/gdscript/tests/gdscript_test_runner.h6
-rw-r--r--modules/gltf/README.md11
-rw-r--r--modules/gltf/SCsub2
-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)1
-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_defines.h87
-rw-r--r--modules/gltf/gltf_document.cpp167
-rw-r--r--modules/gltf/gltf_document.h96
-rw-r--r--modules/gltf/gltf_document_extension.h3
-rw-r--r--modules/gltf/gltf_document_extension_convert_importer_mesh.h9
-rw-r--r--modules/gltf/gltf_state.cpp68
-rw-r--r--modules/gltf/gltf_state.h25
-rw-r--r--modules/gltf/gltf_template_convert.h94
-rw-r--r--modules/gltf/register_types.cpp22
-rw-r--r--modules/gltf/structures/gltf_accessor.cpp (renamed from modules/gltf/gltf_accessor.cpp)6
-rw-r--r--modules/gltf/structures/gltf_accessor.h (renamed from modules/gltf/gltf_accessor.h)5
-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)11
-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)11
-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
-rw-r--r--modules/hdr/image_loader_hdr.h2
-rw-r--r--modules/jpg/image_loader_jpegd.h6
-rw-r--r--modules/jsonrpc/jsonrpc.h6
-rw-r--r--modules/lightmapper_rd/lightmapper_rd.h2
-rw-r--r--modules/lightmapper_rd/register_types.h2
-rw-r--r--modules/mbedtls/dtls_server_mbedtls.h6
-rw-r--r--modules/mbedtls/ssl_context_mbedtls.h6
-rw-r--r--modules/mbedtls/stream_peer_mbedtls.h6
-rw-r--r--modules/meshoptimizer/register_types.h2
-rw-r--r--modules/minimp3/audio_stream_mp3.cpp71
-rw-r--r--modules/minimp3/audio_stream_mp3.h25
-rw-r--r--modules/minimp3/doc_classes/AudioStreamMP3.xml6
-rw-r--r--modules/minimp3/resource_importer_mp3.cpp46
-rw-r--r--modules/minimp3/resource_importer_mp3.h6
-rw-r--r--modules/mobile_vr/mobile_vr_interface.cpp4
-rw-r--r--modules/mobile_vr/mobile_vr_interface.h2
-rw-r--r--modules/mono/csharp_script.cpp3
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs8
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs6
-rw-r--r--modules/mono/editor/bindings_generator.cpp16
-rw-r--r--modules/mono/editor/bindings_generator.h3
-rw-r--r--modules/mono/editor/editor_internal_calls.cpp6
-rw-r--r--modules/mono/editor/editor_internal_calls.h6
-rw-r--r--modules/mono/glue/glue_header.h5
-rw-r--r--modules/mono/mono_gc_handle.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_cache.cpp6
-rw-r--r--modules/mono/mono_gd/gd_mono_cache.h3
-rw-r--r--modules/mono/mono_gd/gd_mono_field.cpp30
-rw-r--r--modules/mono/mono_gd/gd_mono_field.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp23
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h71
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h6
-rw-r--r--modules/mono/utils/macos_utils.h6
-rw-r--r--modules/mono/utils/macros.h6
-rw-r--r--modules/mono/utils/path_utils.h6
-rw-r--r--modules/mono/utils/string_utils.h6
-rw-r--r--modules/navigation/nav_map.cpp13
-rw-r--r--modules/navigation/nav_map.h5
-rw-r--r--modules/ogg/ogg_packet_sequence.cpp2
-rw-r--r--modules/ogg/ogg_packet_sequence.h2
-rw-r--r--modules/openxr/action_map/openxr_action.h2
-rw-r--r--modules/openxr/action_map/openxr_action_map.h6
-rw-r--r--modules/openxr/action_map/openxr_action_set.h2
-rw-r--r--modules/openxr/action_map/openxr_defs.h2
-rw-r--r--modules/openxr/action_map/openxr_interaction_profile.cpp2
-rw-r--r--modules/openxr/action_map/openxr_interaction_profile.h2
-rw-r--r--modules/openxr/doc_classes/OpenXRIPBinding.xml2
-rw-r--r--modules/openxr/doc_classes/OpenXRInterface.xml4
-rw-r--r--modules/openxr/editor/openxr_action_editor.h2
-rw-r--r--modules/openxr/editor/openxr_action_map_editor.h2
-rw-r--r--modules/openxr/editor/openxr_action_set_editor.h2
-rw-r--r--modules/openxr/editor/openxr_editor_plugin.h2
-rw-r--r--modules/openxr/editor/openxr_interaction_profile_editor.h2
-rw-r--r--modules/openxr/editor/openxr_select_action_dialog.h2
-rw-r--r--modules/openxr/editor/openxr_select_interaction_profile_dialog.h2
-rw-r--r--modules/openxr/extensions/openxr_android_extension.h2
-rw-r--r--modules/openxr/extensions/openxr_extension_wrapper.h6
-rw-r--r--modules/openxr/extensions/openxr_htc_vive_tracker_extension.h2
-rw-r--r--modules/openxr/extensions/openxr_vulkan_extension.cpp2
-rw-r--r--modules/openxr/extensions/openxr_vulkan_extension.h4
-rw-r--r--modules/openxr/openxr_api.cpp2
-rw-r--r--modules/openxr/openxr_api.h10
-rw-r--r--modules/openxr/openxr_interface.cpp4
-rw-r--r--modules/openxr/openxr_interface.h4
-rw-r--r--modules/openxr/openxr_util.h2
-rw-r--r--modules/raycast/lightmap_raycaster.h2
-rw-r--r--modules/raycast/raycast_occlusion_cull.cpp45
-rw-r--r--modules/raycast/raycast_occlusion_cull.h19
-rw-r--r--modules/raycast/static_raycaster.h2
-rw-r--r--modules/svg/image_loader_svg.cpp4
-rw-r--r--modules/text_server_adv/script_iterator.h2
-rw-r--r--modules/text_server_adv/text_server_adv.cpp7
-rw-r--r--modules/text_server_adv/text_server_adv.h7
-rw-r--r--modules/text_server_fb/text_server_fb.cpp6
-rw-r--r--modules/text_server_fb/text_server_fb.h11
-rw-r--r--modules/theora/video_stream_theora.h4
-rw-r--r--modules/tinyexr/image_loader_tinyexr.h2
-rw-r--r--modules/upnp/upnp.h6
-rw-r--r--modules/upnp/upnp_device.h6
-rw-r--r--modules/visual_script/editor/visual_script_editor.cpp9
-rw-r--r--modules/visual_script/editor/visual_script_editor.h6
-rw-r--r--modules/visual_script/editor/visual_script_property_selector.h6
-rw-r--r--modules/visual_script/visual_script_expression.h6
-rw-r--r--modules/visual_script/visual_script_nodes.cpp3
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp134
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h32
-rw-r--r--modules/vorbis/doc_classes/AudioStreamOGGVorbis.xml6
-rw-r--r--modules/vorbis/resource_importer_ogg_vorbis.cpp70
-rw-r--r--modules/vorbis/resource_importer_ogg_vorbis.h7
-rw-r--r--modules/webp/image_loader_webp.h2
-rw-r--r--modules/webrtc/webrtc_data_channel.h1
-rw-r--r--modules/webrtc/webrtc_multiplayer_peer.h6
-rw-r--r--modules/webrtc/webrtc_peer_connection.h1
-rw-r--r--modules/websocket/emws_client.h6
-rw-r--r--modules/websocket/emws_peer.h6
-rw-r--r--modules/websocket/emws_server.h6
-rw-r--r--modules/websocket/websocket_peer.h7
-rw-r--r--modules/websocket/websocket_server.h6
-rw-r--r--modules/websocket/wsl_client.h6
-rw-r--r--modules/websocket/wsl_peer.h6
-rw-r--r--modules/websocket/wsl_server.h6
-rw-r--r--modules/webxr/godot_webxr.h2
-rw-r--r--modules/webxr/webxr_interface_js.cpp4
-rw-r--r--modules/webxr/webxr_interface_js.h2
162 files changed, 1208 insertions, 563 deletions
diff --git a/modules/camera/camera_macos.h b/modules/camera/camera_macos.h
index badf78f0e8..903eda51bf 100644
--- a/modules/camera/camera_macos.h
+++ b/modules/camera/camera_macos.h
@@ -43,4 +43,4 @@ public:
void update_feeds();
};
-#endif /* CAMERA_MACOS_H */
+#endif // CAMERA_MACOS_H
diff --git a/modules/camera/camera_win.h b/modules/camera/camera_win.h
index 9563326acb..ebfc117190 100644
--- a/modules/camera/camera_win.h
+++ b/modules/camera/camera_win.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef CAMERAWIN_H
-#define CAMERAWIN_H
+#ifndef CAMERA_WIN_H
+#define CAMERA_WIN_H
#include "servers/camera/camera_feed.h"
#include "servers/camera_server.h"
@@ -43,4 +43,4 @@ public:
~CameraWindows() {}
};
-#endif /* CAMERAWIN_H */
+#endif // CAMERA_WIN_H
diff --git a/modules/enet/enet_multiplayer_peer.h b/modules/enet/enet_multiplayer_peer.h
index 18eca18e51..131aa04df1 100644
--- a/modules/enet/enet_multiplayer_peer.h
+++ b/modules/enet/enet_multiplayer_peer.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef NETWORKED_MULTIPLAYER_ENET_H
-#define NETWORKED_MULTIPLAYER_ENET_H
+#ifndef ENET_MULTIPLAYER_PEER_H
+#define ENET_MULTIPLAYER_PEER_H
#include "core/crypto/crypto.h"
#include "core/multiplayer/multiplayer_peer.h"
@@ -135,4 +135,4 @@ public:
~ENetMultiplayerPeer();
};
-#endif // NETWORKED_MULTIPLAYER_ENET_H
+#endif // ENET_MULTIPLAYER_PEER_H
diff --git a/modules/freetype/uwpdef.h b/modules/freetype/uwpdef.h
index 05aaae61b5..f85f293171 100644
--- a/modules/freetype/uwpdef.h
+++ b/modules/freetype/uwpdef.h
@@ -28,6 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef UWPDEF_H
+#define UWPDEF_H
+
// "generic" is a reserved keyword in C++/CX code
// this avoids the errors in the variable name from Freetype code
#define generic freetype_generic
+
+#endif // UWPDEF_H
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index e74314389d..a34bf6ef82 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -278,6 +278,11 @@ void GDScript::_get_script_method_list(List<MethodInfo> *r_list, bool p_include_
GDScriptFunction *func = E.value;
MethodInfo mi;
mi.name = E.key;
+
+ if (func->is_static()) {
+ mi.flags |= METHOD_FLAG_STATIC;
+ }
+
for (int i = 0; i < func->get_argument_count(); i++) {
PropertyInfo arginfo = func->get_argument_type(i);
#ifdef TOOLS_ENABLED
@@ -870,7 +875,7 @@ Error GDScript::reload(bool p_keep_state) {
}
// TODO: Show all error messages.
_err_print_error("GDScript::reload", path.is_empty() ? "built-in" : (const char *)path.utf8().get_data(), parser.get_errors().front()->get().line, ("Parse Error: " + parser.get_errors().front()->get().message).utf8().get_data(), false, ERR_HANDLER_SCRIPT);
- ERR_FAIL_V(ERR_PARSE_ERROR);
+ return ERR_PARSE_ERROR;
}
GDScriptAnalyzer analyzer(&parser);
@@ -886,7 +891,7 @@ Error GDScript::reload(bool p_keep_state) {
_err_print_error("GDScript::reload", path.is_empty() ? "built-in" : (const char *)path.utf8().get_data(), e->get().line, ("Parse Error: " + e->get().message).utf8().get_data(), false, ERR_HANDLER_SCRIPT);
e = e->next();
}
- ERR_FAIL_V(ERR_PARSE_ERROR);
+ return ERR_PARSE_ERROR;
}
bool can_run = ScriptServer::is_scripting_enabled() || parser.is_tool();
@@ -904,7 +909,7 @@ Error GDScript::reload(bool p_keep_state) {
GDScriptLanguage::get_singleton()->debug_break_parse(_get_debug_path(), compiler.get_error_line(), "Parser Error: " + compiler.get_error());
}
_err_print_error("GDScript::reload", path.is_empty() ? "built-in" : (const char *)path.utf8().get_data(), compiler.get_error_line(), ("Compile Error: " + compiler.get_error()).utf8().get_data(), false, ERR_HANDLER_SCRIPT);
- ERR_FAIL_V(ERR_COMPILATION_FAILED);
+ return ERR_COMPILATION_FAILED;
} else {
return err;
}
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 8b4c245bf6..7ed440929c 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -3329,8 +3329,11 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
case Variant::VECTOR2I:
case Variant::VECTOR3:
case Variant::VECTOR3I:
+ case Variant::VECTOR4:
+ case Variant::VECTOR4I:
case Variant::TRANSFORM2D:
case Variant::TRANSFORM3D:
+ case Variant::PROJECTION:
error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::FLOAT &&
index_type.builtin_type != Variant::STRING;
break;
@@ -3393,6 +3396,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
case Variant::PACKED_INT64_ARRAY:
case Variant::VECTOR2I:
case Variant::VECTOR3I:
+ case Variant::VECTOR4I:
result_type.builtin_type = Variant::INT;
break;
// Return float.
@@ -3400,6 +3404,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
case Variant::PACKED_FLOAT64_ARRAY:
case Variant::VECTOR2:
case Variant::VECTOR3:
+ case Variant::VECTOR4:
case Variant::QUATERNION:
result_type.builtin_type = Variant::FLOAT;
break;
@@ -3430,6 +3435,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
break;
// Depends on the index.
case Variant::TRANSFORM3D:
+ case Variant::PROJECTION:
case Variant::PLANE:
case Variant::COLOR:
case Variant::DICTIONARY:
diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp
index 6a1effd680..8e4ca44e81 100644
--- a/modules/gdscript/gdscript_byte_codegen.cpp
+++ b/modules/gdscript/gdscript_byte_codegen.cpp
@@ -84,11 +84,14 @@ uint32_t GDScriptByteCodeGenerator::add_temporary(const GDScriptDataType &p_type
case Variant::VECTOR3:
case Variant::VECTOR3I:
case Variant::TRANSFORM2D:
+ case Variant::VECTOR4:
+ case Variant::VECTOR4I:
case Variant::PLANE:
case Variant::QUATERNION:
case Variant::AABB:
case Variant::BASIS:
case Variant::TRANSFORM3D:
+ case Variant::PROJECTION:
case Variant::COLOR:
case Variant::STRING_NAME:
case Variant::NODE_PATH:
@@ -453,6 +456,12 @@ void GDScriptByteCodeGenerator::write_type_adjust(const Address &p_target, Varia
case Variant::TRANSFORM2D:
append(GDScriptFunction::OPCODE_TYPE_ADJUST_TRANSFORM2D, 1);
break;
+ case Variant::VECTOR4:
+ append(GDScriptFunction::OPCODE_TYPE_ADJUST_VECTOR3, 1);
+ break;
+ case Variant::VECTOR4I:
+ append(GDScriptFunction::OPCODE_TYPE_ADJUST_VECTOR3I, 1);
+ break;
case Variant::PLANE:
append(GDScriptFunction::OPCODE_TYPE_ADJUST_PLANE, 1);
break;
@@ -468,6 +477,9 @@ void GDScriptByteCodeGenerator::write_type_adjust(const Address &p_target, Varia
case Variant::TRANSFORM3D:
append(GDScriptFunction::OPCODE_TYPE_ADJUST_TRANSFORM3D, 1);
break;
+ case Variant::PROJECTION:
+ append(GDScriptFunction::OPCODE_TYPE_ADJUST_PROJECTION, 1);
+ break;
case Variant::COLOR:
append(GDScriptFunction::OPCODE_TYPE_ADJUST_COLOR, 1);
break;
@@ -1596,7 +1608,7 @@ void GDScriptByteCodeGenerator::write_return(const Address &p_return_value) {
// Typed array.
const GDScriptDataType &element_type = function->return_type.get_container_element_type();
- Variant script = function->return_type.script_type;
+ Variant script = element_type.script_type;
int script_idx = get_constant_pos(script) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS);
append(GDScriptFunction::OPCODE_RETURN_TYPED_ARRAY, 2);
diff --git a/modules/gdscript/gdscript_byte_codegen.h b/modules/gdscript/gdscript_byte_codegen.h
index f4b402fc96..ffc3178c83 100644
--- a/modules/gdscript/gdscript_byte_codegen.h
+++ b/modules/gdscript/gdscript_byte_codegen.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GDSCRIPT_BYTE_CODEGEN
-#define GDSCRIPT_BYTE_CODEGEN
+#ifndef GDSCRIPT_BYTE_CODEGEN_H
+#define GDSCRIPT_BYTE_CODEGEN_H
#include "gdscript_codegen.h"
@@ -502,4 +502,4 @@ public:
virtual ~GDScriptByteCodeGenerator();
};
-#endif // GDSCRIPT_BYTE_CODEGEN
+#endif // GDSCRIPT_BYTE_CODEGEN_H
diff --git a/modules/gdscript/gdscript_codegen.h b/modules/gdscript/gdscript_codegen.h
index 81fa265aca..7b5f133ec5 100644
--- a/modules/gdscript/gdscript_codegen.h
+++ b/modules/gdscript/gdscript_codegen.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GDSCRIPT_CODEGEN
-#define GDSCRIPT_CODEGEN
+#ifndef GDSCRIPT_CODEGEN_H
+#define GDSCRIPT_CODEGEN_H
#include "core/multiplayer/multiplayer.h"
#include "core/string/string_name.h"
@@ -163,4 +163,4 @@ public:
virtual ~GDScriptCodeGenerator() {}
};
-#endif // GDSCRIPT_CODEGEN
+#endif // GDSCRIPT_CODEGEN_H
diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp
index 726f0efe2b..b38c7c6699 100644
--- a/modules/gdscript/gdscript_disassembler.cpp
+++ b/modules/gdscript/gdscript_disassembler.cpp
@@ -639,10 +639,13 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
DISASSEMBLE_PTRCALL(VECTOR3);
DISASSEMBLE_PTRCALL(VECTOR3I);
DISASSEMBLE_PTRCALL(TRANSFORM2D);
+ DISASSEMBLE_PTRCALL(VECTOR4);
+ DISASSEMBLE_PTRCALL(VECTOR4I);
DISASSEMBLE_PTRCALL(PLANE);
DISASSEMBLE_PTRCALL(AABB);
DISASSEMBLE_PTRCALL(BASIS);
DISASSEMBLE_PTRCALL(TRANSFORM3D);
+ DISASSEMBLE_PTRCALL(PROJECTION);
DISASSEMBLE_PTRCALL(COLOR);
DISASSEMBLE_PTRCALL(STRING_NAME);
DISASSEMBLE_PTRCALL(NODE_PATH);
@@ -1013,11 +1016,14 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
DISASSEMBLE_TYPE_ADJUST(VECTOR3);
DISASSEMBLE_TYPE_ADJUST(VECTOR3I);
DISASSEMBLE_TYPE_ADJUST(TRANSFORM2D);
+ DISASSEMBLE_TYPE_ADJUST(VECTOR4);
+ DISASSEMBLE_TYPE_ADJUST(VECTOR4I);
DISASSEMBLE_TYPE_ADJUST(PLANE);
DISASSEMBLE_TYPE_ADJUST(QUATERNION);
DISASSEMBLE_TYPE_ADJUST(AABB);
DISASSEMBLE_TYPE_ADJUST(BASIS);
DISASSEMBLE_TYPE_ADJUST(TRANSFORM3D);
+ DISASSEMBLE_TYPE_ADJUST(PROJECTION);
DISASSEMBLE_TYPE_ADJUST(COLOR);
DISASSEMBLE_TYPE_ADJUST(STRING_NAME);
DISASSEMBLE_TYPE_ADJUST(NODE_PATH);
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index 3f1265679b..53c75648a0 100644
--- a/modules/gdscript/gdscript_function.h
+++ b/modules/gdscript/gdscript_function.h
@@ -273,11 +273,14 @@ public:
OPCODE_CALL_PTRCALL_VECTOR3,
OPCODE_CALL_PTRCALL_VECTOR3I,
OPCODE_CALL_PTRCALL_TRANSFORM2D,
+ OPCODE_CALL_PTRCALL_VECTOR4,
+ OPCODE_CALL_PTRCALL_VECTOR4I,
OPCODE_CALL_PTRCALL_PLANE,
OPCODE_CALL_PTRCALL_QUATERNION,
OPCODE_CALL_PTRCALL_AABB,
OPCODE_CALL_PTRCALL_BASIS,
OPCODE_CALL_PTRCALL_TRANSFORM3D,
+ OPCODE_CALL_PTRCALL_PROJECTION,
OPCODE_CALL_PTRCALL_COLOR,
OPCODE_CALL_PTRCALL_STRING_NAME,
OPCODE_CALL_PTRCALL_NODE_PATH,
@@ -363,11 +366,14 @@ public:
OPCODE_TYPE_ADJUST_VECTOR3,
OPCODE_TYPE_ADJUST_VECTOR3I,
OPCODE_TYPE_ADJUST_TRANSFORM2D,
+ OPCODE_TYPE_ADJUST_VECTOR4,
+ OPCODE_TYPE_ADJUST_VECTOR4I,
OPCODE_TYPE_ADJUST_PLANE,
OPCODE_TYPE_ADJUST_QUATERNION,
OPCODE_TYPE_ADJUST_AABB,
OPCODE_TYPE_ADJUST_BASIS,
OPCODE_TYPE_ADJUST_TRANSFORM3D,
+ OPCODE_TYPE_ADJUST_PROJECTION,
OPCODE_TYPE_ADJUST_COLOR,
OPCODE_TYPE_ADJUST_STRING_NAME,
OPCODE_TYPE_ADJUST_NODE_PATH,
diff --git a/modules/gdscript/gdscript_lambda_callable.h b/modules/gdscript/gdscript_lambda_callable.h
index 248176e32c..1954089983 100644
--- a/modules/gdscript/gdscript_lambda_callable.h
+++ b/modules/gdscript/gdscript_lambda_callable.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GDSCRIPT_LAMBDA_CALLABLE
-#define GDSCRIPT_LAMBDA_CALLABLE
+#ifndef GDSCRIPT_LAMBDA_CALLABLE_H
+#define GDSCRIPT_LAMBDA_CALLABLE_H
#include "core/object/ref_counted.h"
#include "core/templates/vector.h"
@@ -87,4 +87,4 @@ public:
virtual ~GDScriptLambdaSelfCallable() = default;
};
-#endif // GDSCRIPT_LAMBDA_CALLABLE
+#endif // GDSCRIPT_LAMBDA_CALLABLE_H
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 01a672c330..e8fa2981ba 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -60,11 +60,14 @@ Variant::Type GDScriptParser::get_builtin_type(const StringName &p_type) {
builtin_types["Transform2D"] = Variant::TRANSFORM2D;
builtin_types["Vector3"] = Variant::VECTOR3;
builtin_types["Vector3i"] = Variant::VECTOR3I;
+ builtin_types["Vector4"] = Variant::VECTOR4;
+ builtin_types["Vector4i"] = Variant::VECTOR4I;
builtin_types["AABB"] = Variant::AABB;
builtin_types["Plane"] = Variant::PLANE;
builtin_types["Quaternion"] = Variant::QUATERNION;
builtin_types["Basis"] = Variant::BASIS;
builtin_types["Transform3D"] = Variant::TRANSFORM3D;
+ builtin_types["Projection"] = Variant::PROJECTION;
builtin_types["Color"] = Variant::COLOR;
builtin_types["RID"] = Variant::RID;
builtin_types["Object"] = Variant::OBJECT;
diff --git a/modules/gdscript/gdscript_rpc_callable.h b/modules/gdscript/gdscript_rpc_callable.h
index 2c8734a74b..c8a91d6259 100644
--- a/modules/gdscript/gdscript_rpc_callable.h
+++ b/modules/gdscript/gdscript_rpc_callable.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GDSCRIPT_RPC_CALLABLE
-#define GDSCRIPT_RPC_CALLABLE
+#ifndef GDSCRIPT_RPC_CALLABLE_H
+#define GDSCRIPT_RPC_CALLABLE_H
#include "core/variant/callable.h"
#include "core/variant/variant.h"
@@ -58,4 +58,4 @@ public:
virtual ~GDScriptRPCCallable() = default;
};
-#endif // GDSCRIPT_RPC_CALLABLE
+#endif // GDSCRIPT_RPC_CALLABLE_H
diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h
index 7fb715f2c8..68b2c6eb1c 100644
--- a/modules/gdscript/gdscript_tokenizer.h
+++ b/modules/gdscript/gdscript_tokenizer.h
@@ -273,4 +273,4 @@ public:
GDScriptTokenizer();
};
-#endif
+#endif // GDSCRIPT_TOKENIZER_H
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp
index e0beed367a..10365f8481 100644
--- a/modules/gdscript/gdscript_vm.cpp
+++ b/modules/gdscript/gdscript_vm.cpp
@@ -199,11 +199,14 @@ void (*type_init_function_table[])(Variant *) = {
&VariantInitializer<Vector3>::init, // VECTOR3.
&VariantInitializer<Vector3i>::init, // VECTOR3I.
&VariantInitializer<Transform2D>::init, // TRANSFORM2D.
+ &VariantInitializer<Vector4>::init, // VECTOR4.
+ &VariantInitializer<Vector4i>::init, // VECTOR4I.
&VariantInitializer<Plane>::init, // PLANE.
&VariantInitializer<Quaternion>::init, // QUATERNION.
&VariantInitializer<AABB>::init, // AABB.
&VariantInitializer<Basis>::init, // BASIS.
&VariantInitializer<Transform3D>::init, // TRANSFORM3D.
+ &VariantInitializer<Projection>::init, // PROJECTION.
&VariantInitializer<Color>::init, // COLOR.
&VariantInitializer<StringName>::init, // STRING_NAME.
&VariantInitializer<NodePath>::init, // NODE_PATH.
@@ -282,11 +285,14 @@ void (*type_init_function_table[])(Variant *) = {
&&OPCODE_CALL_PTRCALL_VECTOR3, \
&&OPCODE_CALL_PTRCALL_VECTOR3I, \
&&OPCODE_CALL_PTRCALL_TRANSFORM2D, \
+ &&OPCODE_CALL_PTRCALL_VECTOR4, \
+ &&OPCODE_CALL_PTRCALL_VECTOR4I, \
&&OPCODE_CALL_PTRCALL_PLANE, \
&&OPCODE_CALL_PTRCALL_QUATERNION, \
&&OPCODE_CALL_PTRCALL_AABB, \
&&OPCODE_CALL_PTRCALL_BASIS, \
&&OPCODE_CALL_PTRCALL_TRANSFORM3D, \
+ &&OPCODE_CALL_PTRCALL_PROJECTION, \
&&OPCODE_CALL_PTRCALL_COLOR, \
&&OPCODE_CALL_PTRCALL_STRING_NAME, \
&&OPCODE_CALL_PTRCALL_NODE_PATH, \
@@ -372,11 +378,14 @@ void (*type_init_function_table[])(Variant *) = {
&&OPCODE_TYPE_ADJUST_VECTOR3, \
&&OPCODE_TYPE_ADJUST_VECTOR3I, \
&&OPCODE_TYPE_ADJUST_TRANSFORM2D, \
+ &&OPCODE_TYPE_ADJUST_VECTOR4, \
+ &&OPCODE_TYPE_ADJUST_VECTOR4I, \
&&OPCODE_TYPE_ADJUST_PLANE, \
&&OPCODE_TYPE_ADJUST_QUATERNION, \
&&OPCODE_TYPE_ADJUST_AABB, \
&&OPCODE_TYPE_ADJUST_BASIS, \
&&OPCODE_TYPE_ADJUST_TRANSFORM3D, \
+ &&OPCODE_TYPE_ADJUST_PROJECTION, \
&&OPCODE_TYPE_ADJUST_COLOR, \
&&OPCODE_TYPE_ADJUST_STRING_NAME, \
&&OPCODE_TYPE_ADJUST_NODE_PATH, \
@@ -435,6 +444,8 @@ void (*type_init_function_table[])(Variant *) = {
#define OP_GET_VECTOR3 get_vector3
#define OP_GET_VECTOR3I get_vector3i
#define OP_GET_RECT2 get_rect2
+#define OP_GET_VECTOR4 get_vector4
+#define OP_GET_VECTOR4I get_vector4i
#define OP_GET_RECT2I get_rect2i
#define OP_GET_QUATERNION get_quaternion
#define OP_GET_COLOR get_color
@@ -456,6 +467,7 @@ void (*type_init_function_table[])(Variant *) = {
#define OP_GET_PACKED_COLOR_ARRAY get_color_array
#define OP_GET_TRANSFORM3D get_transform
#define OP_GET_TRANSFORM2D get_transform2d
+#define OP_GET_PROJECTION get_projection
#define OP_GET_PLANE get_plane
#define OP_GET_AABB get_aabb
#define OP_GET_BASIS get_basis
@@ -1827,11 +1839,14 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
OPCODE_CALL_PTR(VECTOR3);
OPCODE_CALL_PTR(VECTOR3I);
OPCODE_CALL_PTR(TRANSFORM2D);
+ OPCODE_CALL_PTR(VECTOR4);
+ OPCODE_CALL_PTR(VECTOR4I);
OPCODE_CALL_PTR(PLANE);
OPCODE_CALL_PTR(QUATERNION);
OPCODE_CALL_PTR(AABB);
OPCODE_CALL_PTR(BASIS);
OPCODE_CALL_PTR(TRANSFORM3D);
+ OPCODE_CALL_PTR(PROJECTION);
OPCODE_CALL_PTR(COLOR);
OPCODE_CALL_PTR(STRING_NAME);
OPCODE_CALL_PTR(NODE_PATH);
@@ -3308,11 +3323,14 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
OPCODE_TYPE_ADJUST(VECTOR3, Vector3);
OPCODE_TYPE_ADJUST(VECTOR3I, Vector3i);
OPCODE_TYPE_ADJUST(TRANSFORM2D, Transform2D);
+ OPCODE_TYPE_ADJUST(VECTOR4, Vector4);
+ OPCODE_TYPE_ADJUST(VECTOR4I, Vector4i);
OPCODE_TYPE_ADJUST(PLANE, Plane);
OPCODE_TYPE_ADJUST(QUATERNION, Quaternion);
OPCODE_TYPE_ADJUST(AABB, AABB);
OPCODE_TYPE_ADJUST(BASIS, Basis);
OPCODE_TYPE_ADJUST(TRANSFORM3D, Transform3D);
+ OPCODE_TYPE_ADJUST(PROJECTION, Projection);
OPCODE_TYPE_ADJUST(COLOR, Color);
OPCODE_TYPE_ADJUST(STRING_NAME, StringName);
OPCODE_TYPE_ADJUST(NODE_PATH, NodePath);
diff --git a/modules/gdscript/gdscript_warning.h b/modules/gdscript/gdscript_warning.h
index f47f31aedf..a639e7b44e 100644
--- a/modules/gdscript/gdscript_warning.h
+++ b/modules/gdscript/gdscript_warning.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GDSCRIPT_WARNINGS
-#define GDSCRIPT_WARNINGS
+#ifndef GDSCRIPT_WARNING_H
+#define GDSCRIPT_WARNING_H
#ifdef DEBUG_ENABLED
@@ -97,4 +97,4 @@ public:
#endif // DEBUG_ENABLED
-#endif // GDSCRIPT_WARNINGS
+#endif // GDSCRIPT_WARNING_H
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.h b/modules/gdscript/language_server/gdscript_extend_parser.h
index 99b0bf45d0..08bba4a2d4 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.h
+++ b/modules/gdscript/language_server/gdscript_extend_parser.h
@@ -33,7 +33,7 @@
#include "../gdscript_parser.h"
#include "core/variant/variant.h"
-#include "lsp.hpp"
+#include "godot_lsp.h"
#ifndef LINE_NUMBER_TO_INDEX
#define LINE_NUMBER_TO_INDEX(p_line) ((p_line)-1)
@@ -99,4 +99,4 @@ public:
Error parse(const String &p_code, const String &p_path);
};
-#endif
+#endif // GDSCRIPT_EXTEND_PARSER_H
diff --git a/modules/gdscript/language_server/gdscript_language_protocol.h b/modules/gdscript/language_server/gdscript_language_protocol.h
index 0fed8597f9..3c9cfe512f 100644
--- a/modules/gdscript/language_server/gdscript_language_protocol.h
+++ b/modules/gdscript/language_server/gdscript_language_protocol.h
@@ -36,7 +36,7 @@
#include "core/io/tcp_server.h"
#include "gdscript_text_document.h"
#include "gdscript_workspace.h"
-#include "lsp.hpp"
+#include "godot_lsp.h"
#include "modules/modules_enabled.gen.h" // For jsonrpc.
#ifdef MODULE_JSONRPC_ENABLED
diff --git a/modules/gdscript/language_server/gdscript_text_document.h b/modules/gdscript/language_server/gdscript_text_document.h
index 9732765f34..87bc08a34e 100644
--- a/modules/gdscript/language_server/gdscript_text_document.h
+++ b/modules/gdscript/language_server/gdscript_text_document.h
@@ -33,7 +33,7 @@
#include "core/io/file_access.h"
#include "core/object/ref_counted.h"
-#include "lsp.hpp"
+#include "godot_lsp.h"
class GDScriptTextDocument : public RefCounted {
GDCLASS(GDScriptTextDocument, RefCounted)
@@ -77,4 +77,4 @@ public:
GDScriptTextDocument();
};
-#endif
+#endif // GDSCRIPT_TEXT_DOCUMENT_H
diff --git a/modules/gdscript/language_server/gdscript_workspace.h b/modules/gdscript/language_server/gdscript_workspace.h
index 7bff5db81f..88f3aaf957 100644
--- a/modules/gdscript/language_server/gdscript_workspace.h
+++ b/modules/gdscript/language_server/gdscript_workspace.h
@@ -35,7 +35,7 @@
#include "core/variant/variant.h"
#include "editor/editor_file_system.h"
#include "gdscript_extend_parser.h"
-#include "lsp.hpp"
+#include "godot_lsp.h"
class GDScriptWorkspace : public RefCounted {
GDCLASS(GDScriptWorkspace, RefCounted);
@@ -100,4 +100,4 @@ public:
~GDScriptWorkspace();
};
-#endif
+#endif // GDSCRIPT_WORKSPACE_H
diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/godot_lsp.h
index 1c9349097f..fbd40796c4 100644
--- a/modules/gdscript/language_server/lsp.hpp
+++ b/modules/gdscript/language_server/godot_lsp.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* lsp.hpp */
+/* godot_lsp.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -1975,4 +1975,4 @@ static String marked_documentation(const String &p_bbcode) {
}
} // namespace lsp
-#endif
+#endif // GODOT_LSP_H
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index b230c6ba36..059ca703ab 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -52,10 +52,10 @@ GDScriptCache *gdscript_cache = nullptr;
#ifdef TOOLS_ENABLED
-#include "editor/editor_export.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/editor_translation_parser.h"
+#include "editor/export/editor_export.h"
#include "editor/gdscript_highlighter.h"
#include "editor/gdscript_translation_parser_plugin.h"
diff --git a/modules/gdscript/tests/gdscript_test_runner.h b/modules/gdscript/tests/gdscript_test_runner.h
index ee21afd9c9..033d2fcad1 100644
--- a/modules/gdscript/tests/gdscript_test_runner.h
+++ b/modules/gdscript/tests/gdscript_test_runner.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GDSCRIPT_TEST_H
-#define GDSCRIPT_TEST_H
+#ifndef GDSCRIPT_TEST_RUNNER_H
+#define GDSCRIPT_TEST_RUNNER_H
#include "../gdscript.h"
#include "core/error/error_macros.h"
@@ -123,4 +123,4 @@ public:
} // namespace GDScriptTests
-#endif // GDSCRIPT_TEST_H
+#endif // GDSCRIPT_TEST_RUNNER_H
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 25e0835a33..58fa299dfd 100644
--- a/modules/gltf/gltf_light.h
+++ b/modules/gltf/extensions/gltf_light.h
@@ -33,6 +33,7 @@
#include "core/config/engine.h"
#include "core/io/resource.h"
+#include "scene/3d/light_3d.h"
class GLTFLight : public Resource {
GDCLASS(GLTFLight, Resource)
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_defines.h b/modules/gltf/gltf_defines.h
new file mode 100644
index 0000000000..c20c87f798
--- /dev/null
+++ b/modules/gltf/gltf_defines.h
@@ -0,0 +1,87 @@
+/*************************************************************************/
+/* gltf_defines.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef GLTF_DEFINES_H
+#define GLTF_DEFINES_H
+
+// This file should only be included by other headers.
+
+// Godot classes used by GLTF headers.
+class BoneAttachment3D;
+class CSGShape3D;
+class DirectionalLight3D;
+class GridMap;
+class Light3D;
+class MultiMeshInstance3D;
+class Skeleton3D;
+class Skin;
+
+// GLTF classes.
+struct GLTFAccessor;
+class GLTFAnimation;
+class GLTFBufferView;
+class GLTFCamera;
+class GLTFDocument;
+class GLTFDocumentExtension;
+class GLTFLight;
+class GLTFMesh;
+class GLTFNode;
+class GLTFSkeleton;
+class GLTFSkin;
+class GLTFSpecGloss;
+class GLTFState;
+class GLTFTexture;
+
+// GLTF index aliases.
+using GLTFAccessorIndex = int;
+using GLTFAnimationIndex = int;
+using GLTFBufferIndex = int;
+using GLTFBufferViewIndex = int;
+using GLTFCameraIndex = int;
+using GLTFImageIndex = int;
+using GLTFMaterialIndex = int;
+using GLTFMeshIndex = int;
+using GLTFLightIndex = int;
+using GLTFNodeIndex = int;
+using GLTFSkeletonIndex = int;
+using GLTFSkinIndex = int;
+using GLTFTextureIndex = int;
+
+enum GLTFType {
+ TYPE_SCALAR,
+ TYPE_VEC2,
+ TYPE_VEC3,
+ TYPE_VEC4,
+ TYPE_MAT2,
+ TYPE_MAT3,
+ TYPE_MAT4,
+};
+
+#endif // GLTF_DEFINES_H
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index babdc9f33b..4ca8482ba3 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -30,19 +30,10 @@
#include "gltf_document.h"
-#include "gltf_accessor.h"
-#include "gltf_animation.h"
-#include "gltf_camera.h"
+#include "extensions/gltf_spec_gloss.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 "core/crypto/crypto_core.h"
#include "core/error/error_macros.h"
@@ -230,15 +221,21 @@ Error GLTFDocument::_serialize(Ref<GLTFState> state, const String &p_path) {
}
Error GLTFDocument::_serialize_extensions(Ref<GLTFState> state) const {
- const String texture_transform = "KHR_texture_transform";
- const String punctual_lights = "KHR_lights_punctual";
Array extensions_used;
- extensions_used.push_back(punctual_lights);
- extensions_used.push_back(texture_transform);
- state->json["extensionsUsed"] = extensions_used;
Array extensions_required;
- extensions_required.push_back(texture_transform);
- state->json["extensionsRequired"] = extensions_required;
+ if (!state->lights.is_empty()) {
+ extensions_used.push_back("KHR_lights_punctual");
+ }
+ if (state->use_khr_texture_transform) {
+ extensions_used.push_back("KHR_texture_transform");
+ extensions_required.push_back("KHR_texture_transform");
+ }
+ if (!extensions_used.is_empty()) {
+ state->json["extensionsUsed"] = extensions_used;
+ }
+ if (!extensions_required.is_empty()) {
+ state->json["extensionsRequired"] = extensions_required;
+ }
return OK;
}
@@ -934,58 +931,58 @@ Error GLTFDocument::_encode_accessors(Ref<GLTFState> state) {
return OK;
}
-String GLTFDocument::_get_accessor_type_name(const GLTFDocument::GLTFType p_type) {
- if (p_type == GLTFDocument::TYPE_SCALAR) {
+String GLTFDocument::_get_accessor_type_name(const GLTFType p_type) {
+ if (p_type == GLTFType::TYPE_SCALAR) {
return "SCALAR";
}
- if (p_type == GLTFDocument::TYPE_VEC2) {
+ if (p_type == GLTFType::TYPE_VEC2) {
return "VEC2";
}
- if (p_type == GLTFDocument::TYPE_VEC3) {
+ if (p_type == GLTFType::TYPE_VEC3) {
return "VEC3";
}
- if (p_type == GLTFDocument::TYPE_VEC4) {
+ if (p_type == GLTFType::TYPE_VEC4) {
return "VEC4";
}
- if (p_type == GLTFDocument::TYPE_MAT2) {
+ if (p_type == GLTFType::TYPE_MAT2) {
return "MAT2";
}
- if (p_type == GLTFDocument::TYPE_MAT3) {
+ if (p_type == GLTFType::TYPE_MAT3) {
return "MAT3";
}
- if (p_type == GLTFDocument::TYPE_MAT4) {
+ if (p_type == GLTFType::TYPE_MAT4) {
return "MAT4";
}
ERR_FAIL_V("SCALAR");
}
-GLTFDocument::GLTFType GLTFDocument::_get_type_from_str(const String &p_string) {
+GLTFType GLTFDocument::_get_type_from_str(const String &p_string) {
if (p_string == "SCALAR") {
- return GLTFDocument::TYPE_SCALAR;
+ return GLTFType::TYPE_SCALAR;
}
if (p_string == "VEC2") {
- return GLTFDocument::TYPE_VEC2;
+ return GLTFType::TYPE_VEC2;
}
if (p_string == "VEC3") {
- return GLTFDocument::TYPE_VEC3;
+ return GLTFType::TYPE_VEC3;
}
if (p_string == "VEC4") {
- return GLTFDocument::TYPE_VEC4;
+ return GLTFType::TYPE_VEC4;
}
if (p_string == "MAT2") {
- return GLTFDocument::TYPE_MAT2;
+ return GLTFType::TYPE_MAT2;
}
if (p_string == "MAT3") {
- return GLTFDocument::TYPE_MAT3;
+ return GLTFType::TYPE_MAT3;
}
if (p_string == "MAT4") {
- return GLTFDocument::TYPE_MAT4;
+ return GLTFType::TYPE_MAT4;
}
- ERR_FAIL_V(GLTFDocument::TYPE_SCALAR);
+ ERR_FAIL_V(GLTFType::TYPE_SCALAR);
}
Error GLTFDocument::_parse_accessors(Ref<GLTFState> state) {
@@ -1536,7 +1533,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_ints(Ref<GLTFState> state, c
accessor.instantiate();
GLTFBufferIndex buffer_view_i;
int64_t size = state->buffers[0].size();
- const GLTFDocument::GLTFType type = GLTFDocument::TYPE_SCALAR;
+ const GLTFType type = GLTFType::TYPE_SCALAR;
const int component_type = GLTFDocument::COMPONENT_TYPE_INT;
accessor->max = type_max;
@@ -1620,7 +1617,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec2(Ref<GLTFState> state, c
accessor.instantiate();
GLTFBufferIndex buffer_view_i;
int64_t size = state->buffers[0].size();
- const GLTFDocument::GLTFType type = GLTFDocument::TYPE_VEC2;
+ const GLTFType type = GLTFType::TYPE_VEC2;
const int component_type = GLTFDocument::COMPONENT_TYPE_FLOAT;
accessor->max = type_max;
@@ -1669,7 +1666,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_color(Ref<GLTFState> state,
accessor.instantiate();
GLTFBufferIndex buffer_view_i;
int64_t size = state->buffers[0].size();
- const GLTFDocument::GLTFType type = GLTFDocument::TYPE_VEC4;
+ const GLTFType type = GLTFType::TYPE_VEC4;
const int component_type = GLTFDocument::COMPONENT_TYPE_FLOAT;
accessor->max = type_max;
@@ -1734,7 +1731,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_weights(Ref<GLTFState> state
accessor.instantiate();
GLTFBufferIndex buffer_view_i;
int64_t size = state->buffers[0].size();
- const GLTFDocument::GLTFType type = GLTFDocument::TYPE_VEC4;
+ const GLTFType type = GLTFType::TYPE_VEC4;
const int component_type = GLTFDocument::COMPONENT_TYPE_FLOAT;
accessor->max = type_max;
@@ -1781,7 +1778,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_joints(Ref<GLTFState> state,
accessor.instantiate();
GLTFBufferIndex buffer_view_i;
int64_t size = state->buffers[0].size();
- const GLTFDocument::GLTFType type = GLTFDocument::TYPE_VEC4;
+ const GLTFType type = GLTFType::TYPE_VEC4;
const int component_type = GLTFDocument::COMPONENT_TYPE_UNSIGNED_SHORT;
accessor->max = type_max;
@@ -1830,7 +1827,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_quaternions(Ref<GLTFState> s
accessor.instantiate();
GLTFBufferIndex buffer_view_i;
int64_t size = state->buffers[0].size();
- const GLTFDocument::GLTFType type = GLTFDocument::TYPE_VEC4;
+ const GLTFType type = GLTFType::TYPE_VEC4;
const int component_type = GLTFDocument::COMPONENT_TYPE_FLOAT;
accessor->max = type_max;
@@ -1895,7 +1892,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_floats(Ref<GLTFState> state,
accessor.instantiate();
GLTFBufferIndex buffer_view_i;
int64_t size = state->buffers[0].size();
- const GLTFDocument::GLTFType type = GLTFDocument::TYPE_SCALAR;
+ const GLTFType type = GLTFType::TYPE_SCALAR;
const int component_type = GLTFDocument::COMPONENT_TYPE_FLOAT;
accessor->max = type_max;
@@ -1941,7 +1938,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec3(Ref<GLTFState> state, c
accessor.instantiate();
GLTFBufferIndex buffer_view_i;
int64_t size = state->buffers[0].size();
- const GLTFDocument::GLTFType type = GLTFDocument::TYPE_VEC3;
+ const GLTFType type = GLTFType::TYPE_VEC3;
const int component_type = GLTFDocument::COMPONENT_TYPE_FLOAT;
accessor->max = type_max;
@@ -2009,7 +2006,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_xform(Ref<GLTFState> state,
accessor.instantiate();
GLTFBufferIndex buffer_view_i;
int64_t size = state->buffers[0].size();
- const GLTFDocument::GLTFType type = GLTFDocument::TYPE_MAT4;
+ const GLTFType type = GLTFType::TYPE_MAT4;
const int component_type = GLTFDocument::COMPONENT_TYPE_FLOAT;
accessor->max = type_max;
@@ -3305,7 +3302,11 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> state) {
}
if (gltf_texture_index != -1) {
bct["index"] = gltf_texture_index;
- bct["extensions"] = _serialize_texture_transform_uv1(material);
+ Dictionary extensions = _serialize_texture_transform_uv1(material);
+ if (!extensions.is_empty()) {
+ bct["extensions"] = extensions;
+ state->use_khr_texture_transform = true;
+ }
mr["baseColorTexture"] = bct;
}
}
@@ -3436,7 +3437,11 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> state) {
}
if (has_roughness || has_metalness) {
mrt["index"] = orm_texture_index;
- mrt["extensions"] = _serialize_texture_transform_uv1(material);
+ Dictionary extensions = _serialize_texture_transform_uv1(material);
+ if (!extensions.is_empty()) {
+ mrt["extensions"] = extensions;
+ state->use_khr_texture_transform = true;
+ }
mr["metallicRoughnessTexture"] = mrt;
}
}
@@ -4525,6 +4530,9 @@ void GLTFDocument::_remove_duplicate_skins(Ref<GLTFState> state) {
}
Error GLTFDocument::_serialize_lights(Ref<GLTFState> state) {
+ if (state->lights.is_empty()) {
+ return OK;
+ }
Array lights;
for (GLTFLightIndex i = 0; i < state->lights.size(); i++) {
Dictionary d;
@@ -4551,10 +4559,6 @@ Error GLTFDocument::_serialize_lights(Ref<GLTFState> state) {
lights.push_back(d);
}
- if (!state->lights.size()) {
- return OK;
- }
-
Dictionary extensions;
if (state->json.has("extensions")) {
extensions = state->json["extensions"];
@@ -5214,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());
@@ -6651,45 +6655,48 @@ Error GLTFDocument::_parse(Ref<GLTFState> state, String p_path, Ref<FileAccess>
return OK;
}
-Dictionary GLTFDocument::_serialize_texture_transform_uv2(Ref<BaseMaterial3D> p_material) {
- Dictionary extension;
- Ref<BaseMaterial3D> mat = p_material;
- if (mat.is_valid()) {
- Dictionary texture_transform;
+Dictionary _serialize_texture_transform_uv(Vector2 p_offset, Vector2 p_scale) {
+ Dictionary texture_transform;
+ bool is_offset = p_offset != Vector2(0.0, 0.0);
+ if (is_offset) {
Array offset;
offset.resize(2);
- offset[0] = mat->get_uv2_offset().x;
- offset[1] = mat->get_uv2_offset().y;
+ offset[0] = p_offset.x;
+ offset[1] = p_offset.y;
texture_transform["offset"] = offset;
+ }
+ bool is_scaled = p_scale != Vector2(1.0, 1.0);
+ if (is_scaled) {
Array scale;
scale.resize(2);
- scale[0] = mat->get_uv2_scale().x;
- scale[1] = mat->get_uv2_scale().y;
+ scale[0] = p_scale.x;
+ scale[1] = p_scale.y;
texture_transform["scale"] = scale;
- // Godot doesn't support texture rotation
+ }
+ Dictionary extension;
+ // Note: Godot doesn't support texture rotation.
+ if (is_offset || is_scaled) {
extension["KHR_texture_transform"] = texture_transform;
}
return extension;
}
Dictionary GLTFDocument::_serialize_texture_transform_uv1(Ref<BaseMaterial3D> p_material) {
- Dictionary extension;
if (p_material.is_valid()) {
- Dictionary texture_transform;
- Array offset;
- offset.resize(2);
- offset[0] = p_material->get_uv1_offset().x;
- offset[1] = p_material->get_uv1_offset().y;
- texture_transform["offset"] = offset;
- Array scale;
- scale.resize(2);
- scale[0] = p_material->get_uv1_scale().x;
- scale[1] = p_material->get_uv1_scale().y;
- texture_transform["scale"] = scale;
- // Godot doesn't support texture rotation
- extension["KHR_texture_transform"] = texture_transform;
+ Vector3 offset = p_material->get_uv1_offset();
+ Vector3 scale = p_material->get_uv1_scale();
+ return _serialize_texture_transform_uv(Vector2(offset.x, offset.y), Vector2(scale.x, scale.y));
}
- return extension;
+ return Dictionary();
+}
+
+Dictionary GLTFDocument::_serialize_texture_transform_uv2(Ref<BaseMaterial3D> p_material) {
+ if (p_material.is_valid()) {
+ Vector3 offset = p_material->get_uv2_offset();
+ Vector3 scale = p_material->get_uv2_scale();
+ return _serialize_texture_transform_uv(Vector2(offset.x, offset.y), Vector2(scale.x, scale.y));
+ }
+ return Dictionary();
}
Error GLTFDocument::_serialize_version(Ref<GLTFState> state) {
@@ -6929,15 +6936,6 @@ Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> state, uint32
state->use_named_skin_binds = p_flags & GLTF_IMPORT_USE_NAMED_SKIN_BINDS;
state->discard_meshes_and_materials = p_flags & GLTF_IMPORT_DISCARD_MESHES_AND_MATERIALS;
- _convert_scene_node(state, p_node, -1, -1);
- if (!state->buffers.size()) {
- state->buffers.push_back(Vector<uint8_t>());
- }
- for (int32_t ext_i = 0; ext_i < document_extensions.size(); ext_i++) {
- Ref<GLTFDocumentExtension> ext = document_extensions[ext_i];
- ERR_CONTINUE(ext.is_null());
- }
-
for (int32_t ext_i = 0; ext_i < document_extensions.size(); ext_i++) {
Ref<GLTFDocumentExtension> ext = document_extensions[ext_i];
ERR_CONTINUE(ext.is_null());
@@ -6948,7 +6946,6 @@ Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> state, uint32
if (!state->buffers.size()) {
state->buffers.push_back(Vector<uint8_t>());
}
-
return OK;
}
diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h
index 2f61210ff9..36a2f94a4e 100644
--- a/modules/gltf/gltf_document.h
+++ b/modules/gltf/gltf_document.h
@@ -31,48 +31,19 @@
#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"
-#include "scene/3d/light_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/animation/animation_player.h"
#include "scene/resources/material.h"
#include "modules/modules_enabled.gen.h" // For csg, gridmap.
-#include <cstdint>
-
-class GLTFState;
-class GLTFSkin;
-class GLTFNode;
-class GLTFSpecGloss;
-class GLTFSkeleton;
-class CSGShape3D;
-class GridMap;
-class MultiMeshInstance3D;
-class GLTFDocumentExtension;
-
-using GLTFAccessorIndex = int;
-using GLTFAnimationIndex = int;
-using GLTFBufferIndex = int;
-using GLTFBufferViewIndex = int;
-using GLTFCameraIndex = int;
-using GLTFImageIndex = int;
-using GLTFMaterialIndex = int;
-using GLTFMeshIndex = int;
-using GLTFLightIndex = int;
-using GLTFNodeIndex = int;
-using GLTFSkeletonIndex = int;
-using GLTFSkinIndex = int;
-using GLTFTextureIndex = int;
-
class GLTFDocument : public Resource {
GDCLASS(GLTFDocument, Resource);
- friend class GLTFState;
- friend class GLTFSkin;
- friend class GLTFSkeleton;
TypedArray<GLTFDocumentExtension> document_extensions;
private:
@@ -81,15 +52,6 @@ private:
public:
GLTFDocument();
const int32_t JOINT_GROUP_SIZE = 4;
- enum GLTFType {
- TYPE_SCALAR,
- TYPE_VEC2,
- TYPE_VEC3,
- TYPE_VEC4,
- TYPE_MAT2,
- TYPE_MAT3,
- TYPE_MAT4,
- };
enum {
ARRAY_BUFFER = 34962,
@@ -118,58 +80,6 @@ public:
TypedArray<GLTFDocumentExtension> get_extensions() const;
private:
- template <class T>
- static Array to_array(const Vector<T> &p_inp) {
- Array ret;
- for (int i = 0; i < p_inp.size(); i++) {
- ret.push_back(p_inp[i]);
- }
- return ret;
- }
-
- template <class T>
- static Array to_array(const HashSet<T> &p_inp) {
- Array ret;
- typename HashSet<T>::Iterator elem = p_inp.begin();
- while (elem) {
- ret.push_back(*elem);
- ++elem;
- }
- return ret;
- }
-
- template <class T>
- static void set_from_array(Vector<T> &r_out, const Array &p_inp) {
- r_out.clear();
- for (int i = 0; i < p_inp.size(); i++) {
- r_out.push_back(p_inp[i]);
- }
- }
-
- template <class T>
- static void set_from_array(HashSet<T> &r_out, const Array &p_inp) {
- r_out.clear();
- for (int i = 0; i < p_inp.size(); i++) {
- r_out.insert(p_inp[i]);
- }
- }
- template <class K, class V>
- static Dictionary to_dict(const HashMap<K, V> &p_inp) {
- Dictionary ret;
- for (const KeyValue<K, V> &E : p_inp) {
- ret[E.key] = E.value;
- }
- return ret;
- }
-
- template <class K, class V>
- static void set_from_dict(HashMap<K, V> &r_out, const Dictionary &p_inp) {
- r_out.clear();
- Array keys = p_inp.keys();
- for (int i = 0; i < keys.size(); i++) {
- r_out[keys[i]] = p_inp[keys[i]];
- }
- }
void _build_parent_hierachy(Ref<GLTFState> state);
double _filter_number(double p_float);
String _get_component_type_name(const uint32_t p_component);
@@ -177,7 +87,7 @@ private:
Error _parse_scenes(Ref<GLTFState> state);
Error _parse_nodes(Ref<GLTFState> state);
String _get_type_name(const GLTFType p_component);
- String _get_accessor_type_name(const GLTFDocument::GLTFType p_type);
+ String _get_accessor_type_name(const GLTFType p_type);
String _gen_unique_name(Ref<GLTFState> state, const String &p_name);
String _sanitize_animation_name(const String &name);
String _gen_unique_animation_name(Ref<GLTFState> state, const String &p_name);
diff --git a/modules/gltf/gltf_document_extension.h b/modules/gltf/gltf_document_extension.h
index 556f79e887..0ef9109584 100644
--- a/modules/gltf/gltf_document_extension.h
+++ b/modules/gltf/gltf_document_extension.h
@@ -31,9 +31,8 @@
#ifndef GLTF_DOCUMENT_EXTENSION_H
#define GLTF_DOCUMENT_EXTENSION_H
-#include "gltf_accessor.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 4c9e42a00f..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"
@@ -37,8 +37,6 @@
#include "scene/3d/mesh_instance_3d.h"
#include "scene/resources/importer_mesh.h"
-class GLTFDocumentExtension;
-class GLTFDocument;
class GLTFDocumentExtensionConvertImporterMesh : public GLTFDocumentExtension {
GDCLASS(GLTFDocumentExtensionConvertImporterMesh, GLTFDocumentExtension);
@@ -48,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.cpp b/modules/gltf/gltf_state.cpp
index 989fa476c2..a5f7bcf9d6 100644
--- a/modules/gltf/gltf_state.cpp
+++ b/modules/gltf/gltf_state.cpp
@@ -150,51 +150,51 @@ void GLTFState::set_use_named_skin_binds(bool p_use_named_skin_binds) {
}
Array GLTFState::get_nodes() {
- return GLTFDocument::to_array(nodes);
+ return GLTFTemplateConvert::to_array(nodes);
}
void GLTFState::set_nodes(Array p_nodes) {
- GLTFDocument::set_from_array(nodes, p_nodes);
+ GLTFTemplateConvert::set_from_array(nodes, p_nodes);
}
Array GLTFState::get_buffers() {
- return GLTFDocument::to_array(buffers);
+ return GLTFTemplateConvert::to_array(buffers);
}
void GLTFState::set_buffers(Array p_buffers) {
- GLTFDocument::set_from_array(buffers, p_buffers);
+ GLTFTemplateConvert::set_from_array(buffers, p_buffers);
}
Array GLTFState::get_buffer_views() {
- return GLTFDocument::to_array(buffer_views);
+ return GLTFTemplateConvert::to_array(buffer_views);
}
void GLTFState::set_buffer_views(Array p_buffer_views) {
- GLTFDocument::set_from_array(buffer_views, p_buffer_views);
+ GLTFTemplateConvert::set_from_array(buffer_views, p_buffer_views);
}
Array GLTFState::get_accessors() {
- return GLTFDocument::to_array(accessors);
+ return GLTFTemplateConvert::to_array(accessors);
}
void GLTFState::set_accessors(Array p_accessors) {
- GLTFDocument::set_from_array(accessors, p_accessors);
+ GLTFTemplateConvert::set_from_array(accessors, p_accessors);
}
Array GLTFState::get_meshes() {
- return GLTFDocument::to_array(meshes);
+ return GLTFTemplateConvert::to_array(meshes);
}
void GLTFState::set_meshes(Array p_meshes) {
- GLTFDocument::set_from_array(meshes, p_meshes);
+ GLTFTemplateConvert::set_from_array(meshes, p_meshes);
}
Array GLTFState::get_materials() {
- return GLTFDocument::to_array(materials);
+ return GLTFTemplateConvert::to_array(materials);
}
void GLTFState::set_materials(Array p_materials) {
- GLTFDocument::set_from_array(materials, p_materials);
+ GLTFTemplateConvert::set_from_array(materials, p_materials);
}
String GLTFState::get_scene_name() {
@@ -206,91 +206,91 @@ void GLTFState::set_scene_name(String p_scene_name) {
}
Array GLTFState::get_root_nodes() {
- return GLTFDocument::to_array(root_nodes);
+ return GLTFTemplateConvert::to_array(root_nodes);
}
void GLTFState::set_root_nodes(Array p_root_nodes) {
- GLTFDocument::set_from_array(root_nodes, p_root_nodes);
+ GLTFTemplateConvert::set_from_array(root_nodes, p_root_nodes);
}
Array GLTFState::get_textures() {
- return GLTFDocument::to_array(textures);
+ return GLTFTemplateConvert::to_array(textures);
}
void GLTFState::set_textures(Array p_textures) {
- GLTFDocument::set_from_array(textures, p_textures);
+ GLTFTemplateConvert::set_from_array(textures, p_textures);
}
Array GLTFState::get_images() {
- return GLTFDocument::to_array(images);
+ return GLTFTemplateConvert::to_array(images);
}
void GLTFState::set_images(Array p_images) {
- GLTFDocument::set_from_array(images, p_images);
+ GLTFTemplateConvert::set_from_array(images, p_images);
}
Array GLTFState::get_skins() {
- return GLTFDocument::to_array(skins);
+ return GLTFTemplateConvert::to_array(skins);
}
void GLTFState::set_skins(Array p_skins) {
- GLTFDocument::set_from_array(skins, p_skins);
+ GLTFTemplateConvert::set_from_array(skins, p_skins);
}
Array GLTFState::get_cameras() {
- return GLTFDocument::to_array(cameras);
+ return GLTFTemplateConvert::to_array(cameras);
}
void GLTFState::set_cameras(Array p_cameras) {
- GLTFDocument::set_from_array(cameras, p_cameras);
+ GLTFTemplateConvert::set_from_array(cameras, p_cameras);
}
Array GLTFState::get_lights() {
- return GLTFDocument::to_array(lights);
+ return GLTFTemplateConvert::to_array(lights);
}
void GLTFState::set_lights(Array p_lights) {
- GLTFDocument::set_from_array(lights, p_lights);
+ GLTFTemplateConvert::set_from_array(lights, p_lights);
}
Array GLTFState::get_unique_names() {
- return GLTFDocument::to_array(unique_names);
+ return GLTFTemplateConvert::to_array(unique_names);
}
void GLTFState::set_unique_names(Array p_unique_names) {
- GLTFDocument::set_from_array(unique_names, p_unique_names);
+ GLTFTemplateConvert::set_from_array(unique_names, p_unique_names);
}
Array GLTFState::get_unique_animation_names() {
- return GLTFDocument::to_array(unique_animation_names);
+ return GLTFTemplateConvert::to_array(unique_animation_names);
}
void GLTFState::set_unique_animation_names(Array p_unique_animation_names) {
- GLTFDocument::set_from_array(unique_animation_names, p_unique_animation_names);
+ GLTFTemplateConvert::set_from_array(unique_animation_names, p_unique_animation_names);
}
Array GLTFState::get_skeletons() {
- return GLTFDocument::to_array(skeletons);
+ return GLTFTemplateConvert::to_array(skeletons);
}
void GLTFState::set_skeletons(Array p_skeletons) {
- GLTFDocument::set_from_array(skeletons, p_skeletons);
+ GLTFTemplateConvert::set_from_array(skeletons, p_skeletons);
}
Dictionary GLTFState::get_skeleton_to_node() {
- return GLTFDocument::to_dict(skeleton_to_node);
+ return GLTFTemplateConvert::to_dict(skeleton_to_node);
}
void GLTFState::set_skeleton_to_node(Dictionary p_skeleton_to_node) {
- GLTFDocument::set_from_dict(skeleton_to_node, p_skeleton_to_node);
+ GLTFTemplateConvert::set_from_dict(skeleton_to_node, p_skeleton_to_node);
}
Array GLTFState::get_animations() {
- return GLTFDocument::to_array(animations);
+ return GLTFTemplateConvert::to_array(animations);
}
void GLTFState::set_animations(Array p_animations) {
- GLTFDocument::set_from_array(animations, p_animations);
+ GLTFTemplateConvert::set_from_array(animations, p_animations);
}
Node *GLTFState::get_scene_node(GLTFNodeIndex idx) {
diff --git a/modules/gltf/gltf_state.h b/modules/gltf/gltf_state.h
index 2fdef19038..d2a4948f06 100644
--- a/modules/gltf/gltf_state.h
+++ b/modules/gltf/gltf_state.h
@@ -31,18 +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_document.h"
-#include "gltf_document_extension.h"
-#include "gltf_light.h"
-#include "gltf_mesh.h"
-#include "gltf_node.h"
-#include "gltf_skeleton.h"
-#include "gltf_skin.h"
-#include "gltf_texture.h"
+#include "extensions/gltf_light.h"
+#include "gltf_template_convert.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"
@@ -60,6 +59,7 @@ class GLTFState : public Resource {
Vector<uint8_t> glb_data;
bool use_named_skin_binds = false;
+ bool use_khr_texture_transform = false;
bool discard_meshes_and_materials = false;
Vector<Ref<GLTFNode>> nodes;
@@ -192,4 +192,5 @@ public:
// this->material_cache = p_material_cache;
//}
};
+
#endif // GLTF_STATE_H
diff --git a/modules/gltf/gltf_template_convert.h b/modules/gltf/gltf_template_convert.h
new file mode 100644
index 0000000000..c915d3deb0
--- /dev/null
+++ b/modules/gltf/gltf_template_convert.h
@@ -0,0 +1,94 @@
+/*************************************************************************/
+/* gltf_template_convert.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef GLTF_TEMPLATE_CONVERT_H
+#define GLTF_TEMPLATE_CONVERT_H
+
+#include "core/templates/hash_set.h"
+#include "core/variant/array.h"
+#include "core/variant/dictionary.h"
+
+namespace GLTFTemplateConvert {
+template <class T>
+static Array to_array(const Vector<T> &p_inp) {
+ Array ret;
+ for (int i = 0; i < p_inp.size(); i++) {
+ ret.push_back(p_inp[i]);
+ }
+ return ret;
+}
+
+template <class T>
+static Array to_array(const HashSet<T> &p_inp) {
+ Array ret;
+ typename HashSet<T>::Iterator elem = p_inp.begin();
+ while (elem) {
+ ret.push_back(*elem);
+ ++elem;
+ }
+ return ret;
+}
+
+template <class T>
+static void set_from_array(Vector<T> &r_out, const Array &p_inp) {
+ r_out.clear();
+ for (int i = 0; i < p_inp.size(); i++) {
+ r_out.push_back(p_inp[i]);
+ }
+}
+
+template <class T>
+static void set_from_array(HashSet<T> &r_out, const Array &p_inp) {
+ r_out.clear();
+ for (int i = 0; i < p_inp.size(); i++) {
+ r_out.insert(p_inp[i]);
+ }
+}
+
+template <class K, class V>
+static Dictionary to_dict(const HashMap<K, V> &p_inp) {
+ Dictionary ret;
+ for (const KeyValue<K, V> &E : p_inp) {
+ ret[E.key] = E.value;
+ }
+ return ret;
+}
+
+template <class K, class V>
+static void set_from_dict(HashMap<K, V> &r_out, const Dictionary &p_inp) {
+ r_out.clear();
+ Array keys = p_inp.keys();
+ for (int i = 0; i < keys.size(); i++) {
+ r_out[keys[i]] = p_inp[keys[i]];
+ }
+}
+} //namespace GLTFTemplateConvert
+
+#endif // GLTF_TEMPLATE_CONVERT_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 1daf2f90a7..1b8911fe72 100644
--- a/modules/gltf/gltf_accessor.cpp
+++ b/modules/gltf/structures/gltf_accessor.cpp
@@ -30,8 +30,6 @@
#include "gltf_accessor.h"
-#include "gltf_document_extension.h"
-
void GLTFAccessor::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_buffer_view"), &GLTFAccessor::get_buffer_view);
ClassDB::bind_method(D_METHOD("set_buffer_view", "buffer_view"), &GLTFAccessor::set_buffer_view);
@@ -67,7 +65,7 @@ void GLTFAccessor::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "component_type"), "set_component_type", "get_component_type"); // int
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "normalized"), "set_normalized", "get_normalized"); // bool
ADD_PROPERTY(PropertyInfo(Variant::INT, "count"), "set_count", "get_count"); // int
- ADD_PROPERTY(PropertyInfo(Variant::INT, "type"), "set_type", "get_type"); // GLTFDocument::GLTFType
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "type"), "set_type", "get_type"); // GLTFType
ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT64_ARRAY, "min"), "set_min", "get_min"); // Vector<real_t>
ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT64_ARRAY, "max"), "set_max", "get_max"); // Vector<real_t>
ADD_PROPERTY(PropertyInfo(Variant::INT, "sparse_count"), "set_sparse_count", "get_sparse_count"); // int
@@ -123,7 +121,7 @@ int GLTFAccessor::get_type() {
}
void GLTFAccessor::set_type(int p_type) {
- type = (GLTFDocument::GLTFType)p_type; // TODO: Register enum
+ type = (GLTFType)p_type; // TODO: Register enum
}
Vector<double> GLTFAccessor::get_min() {
diff --git a/modules/gltf/gltf_accessor.h b/modules/gltf/structures/gltf_accessor.h
index f412dc2c7f..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_document.h"
+#include "../gltf_defines.h"
struct GLTFAccessor : public Resource {
GDCLASS(GLTFAccessor, Resource);
@@ -45,7 +45,7 @@ private:
int component_type = 0;
bool normalized = false;
int count = 0;
- GLTFDocument::GLTFType type = GLTFDocument::TYPE_SCALAR;
+ GLTFType type = GLTFType::TYPE_SCALAR;
Vector<double> min;
Vector<double> max;
int sparse_count = 0;
@@ -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 560d56f35c..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_document.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 929ad3eca0..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_document.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 b813f39a27..90a6b0f50f 100644
--- a/modules/gltf/gltf_skeleton.cpp
+++ b/modules/gltf/structures/gltf_skeleton.cpp
@@ -30,6 +30,9 @@
#include "gltf_skeleton.h"
+#include "../gltf_template_convert.h"
+#include "scene/3d/bone_attachment_3d.h"
+
void GLTFSkeleton::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_joints"), &GLTFSkeleton::get_joints);
ClassDB::bind_method(D_METHOD("set_joints", "joints"), &GLTFSkeleton::set_joints);
@@ -70,19 +73,19 @@ Skeleton3D *GLTFSkeleton::get_godot_skeleton() {
}
Array GLTFSkeleton::get_unique_names() {
- return GLTFDocument::to_array(unique_names);
+ return GLTFTemplateConvert::to_array(unique_names);
}
void GLTFSkeleton::set_unique_names(Array p_unique_names) {
- GLTFDocument::set_from_array(unique_names, p_unique_names);
+ GLTFTemplateConvert::set_from_array(unique_names, p_unique_names);
}
Dictionary GLTFSkeleton::get_godot_bone_node() {
- return GLTFDocument::to_dict(godot_bone_node);
+ return GLTFTemplateConvert::to_dict(godot_bone_node);
}
void GLTFSkeleton::set_godot_bone_node(Dictionary p_indict) {
- GLTFDocument::set_from_dict(godot_bone_node, p_indict);
+ GLTFTemplateConvert::set_from_dict(godot_bone_node, p_indict);
}
BoneAttachment3D *GLTFSkeleton::get_bone_attachment(int idx) {
diff --git a/modules/gltf/gltf_skeleton.h b/modules/gltf/structures/gltf_skeleton.h
index 92ee6e6234..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_document.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 e8005aa0c1..2e46ee3be2 100644
--- a/modules/gltf/gltf_skin.cpp
+++ b/modules/gltf/structures/gltf_skin.cpp
@@ -30,6 +30,9 @@
#include "gltf_skin.h"
+#include "../gltf_template_convert.h"
+#include "scene/resources/skin.h"
+
void GLTFSkin::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_skin_root"), &GLTFSkin::get_skin_root);
ClassDB::bind_method(D_METHOD("set_skin_root", "skin_root"), &GLTFSkin::set_skin_root);
@@ -81,11 +84,11 @@ void GLTFSkin::set_joints_original(Vector<GLTFNodeIndex> p_joints_original) {
}
Array GLTFSkin::get_inverse_binds() {
- return GLTFDocument::to_array(inverse_binds);
+ return GLTFTemplateConvert::to_array(inverse_binds);
}
void GLTFSkin::set_inverse_binds(Array p_inverse_binds) {
- GLTFDocument::set_from_array(inverse_binds, p_inverse_binds);
+ GLTFTemplateConvert::set_from_array(inverse_binds, p_inverse_binds);
}
Vector<GLTFNodeIndex> GLTFSkin::get_joints() {
@@ -121,11 +124,11 @@ void GLTFSkin::set_skeleton(int p_skeleton) {
}
Dictionary GLTFSkin::get_joint_i_to_bone_i() {
- return GLTFDocument::to_dict(joint_i_to_bone_i);
+ return GLTFTemplateConvert::to_dict(joint_i_to_bone_i);
}
void GLTFSkin::set_joint_i_to_bone_i(Dictionary p_joint_i_to_bone_i) {
- GLTFDocument::set_from_dict(joint_i_to_bone_i, p_joint_i_to_bone_i);
+ GLTFTemplateConvert::set_from_dict(joint_i_to_bone_i, p_joint_i_to_bone_i);
}
Dictionary GLTFSkin::get_joint_i_to_name() {
diff --git a/modules/gltf/gltf_skin.h b/modules/gltf/structures/gltf_skin.h
index d946324756..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_document.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 54dd61f9a5..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_document.h"
class GLTFTexture : public Resource {
GDCLASS(GLTFTexture, Resource);
diff --git a/modules/hdr/image_loader_hdr.h b/modules/hdr/image_loader_hdr.h
index f2d53cc206..16c0816562 100644
--- a/modules/hdr/image_loader_hdr.h
+++ b/modules/hdr/image_loader_hdr.h
@@ -40,4 +40,4 @@ public:
ImageLoaderHDR();
};
-#endif
+#endif // IMAGE_LOADER_HDR_H
diff --git a/modules/jpg/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h
index de9700faec..6d631446e7 100644
--- a/modules/jpg/image_loader_jpegd.h
+++ b/modules/jpg/image_loader_jpegd.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef IMAGE_LOADER_JPG_H
-#define IMAGE_LOADER_JPG_H
+#ifndef IMAGE_LOADER_JPEGD_H
+#define IMAGE_LOADER_JPEGD_H
#include "core/io/image_loader.h"
@@ -40,4 +40,4 @@ public:
ImageLoaderJPG();
};
-#endif
+#endif // IMAGE_LOADER_JPEGD_H
diff --git a/modules/jsonrpc/jsonrpc.h b/modules/jsonrpc/jsonrpc.h
index f57d6aef42..1d9f2771b2 100644
--- a/modules/jsonrpc/jsonrpc.h
+++ b/modules/jsonrpc/jsonrpc.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GODOT_JSON_RPC_H
-#define GODOT_JSON_RPC_H
+#ifndef JSONRPC_H
+#define JSONRPC_H
#include "core/object/class_db.h"
#include "core/variant/variant.h"
@@ -67,4 +67,4 @@ public:
VARIANT_ENUM_CAST(JSONRPC::ErrorCode);
-#endif
+#endif // JSONRPC_H
diff --git a/modules/lightmapper_rd/lightmapper_rd.h b/modules/lightmapper_rd/lightmapper_rd.h
index 8cb4b58a18..88860ad0d4 100644
--- a/modules/lightmapper_rd/lightmapper_rd.h
+++ b/modules/lightmapper_rd/lightmapper_rd.h
@@ -256,4 +256,4 @@ public:
LightmapperRD();
};
-#endif // LIGHTMAPPER_H
+#endif // LIGHTMAPPER_RD_H
diff --git a/modules/lightmapper_rd/register_types.h b/modules/lightmapper_rd/register_types.h
index 42e0ebbf77..9b72ff45d7 100644
--- a/modules/lightmapper_rd/register_types.h
+++ b/modules/lightmapper_rd/register_types.h
@@ -36,4 +36,4 @@
void initialize_lightmapper_rd_module(ModuleInitializationLevel p_level);
void uninitialize_lightmapper_rd_module(ModuleInitializationLevel p_level);
-#endif // XATLAS_UNWRAP_REGISTER_TYPES_H
+#endif // LIGHTMAPPER_RD_REGISTER_TYPES_H
diff --git a/modules/mbedtls/dtls_server_mbedtls.h b/modules/mbedtls/dtls_server_mbedtls.h
index 29370062c4..a6626c9f65 100644
--- a/modules/mbedtls/dtls_server_mbedtls.h
+++ b/modules/mbedtls/dtls_server_mbedtls.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef MBED_DTLS_SERVER_H
-#define MBED_DTLS_SERVER_H
+#ifndef DTLS_SERVER_MBEDTLS_H
+#define DTLS_SERVER_MBEDTLS_H
#include "core/io/dtls_server.h"
#include "ssl_context_mbedtls.h"
@@ -54,4 +54,4 @@ public:
~DTLSServerMbedTLS();
};
-#endif // MBED_DTLS_SERVER_H
+#endif // DTLS_SERVER_MBEDTLS_H
diff --git a/modules/mbedtls/ssl_context_mbedtls.h b/modules/mbedtls/ssl_context_mbedtls.h
index dd49792abd..5883388311 100644
--- a/modules/mbedtls/ssl_context_mbedtls.h
+++ b/modules/mbedtls/ssl_context_mbedtls.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef SSL_CONTEXT_MBED_TLS_H
-#define SSL_CONTEXT_MBED_TLS_H
+#ifndef SSL_CONTEXT_MBEDTLS_H
+#define SSL_CONTEXT_MBEDTLS_H
#include "crypto_mbedtls.h"
@@ -90,4 +90,4 @@ public:
~SSLContextMbedTLS();
};
-#endif // SSL_CONTEXT_MBED_TLS_H
+#endif // SSL_CONTEXT_MBEDTLS_H
diff --git a/modules/mbedtls/stream_peer_mbedtls.h b/modules/mbedtls/stream_peer_mbedtls.h
index 7660410e04..68b07feea9 100644
--- a/modules/mbedtls/stream_peer_mbedtls.h
+++ b/modules/mbedtls/stream_peer_mbedtls.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef STREAM_PEER_OPEN_SSL_H
-#define STREAM_PEER_OPEN_SSL_H
+#ifndef STREAM_PEER_MBEDTLS_H
+#define STREAM_PEER_MBEDTLS_H
#include "core/io/stream_peer_ssl.h"
#include "ssl_context_mbedtls.h"
@@ -76,4 +76,4 @@ public:
~StreamPeerMbedTLS();
};
-#endif // STREAM_PEER_SSL_H
+#endif // STREAM_PEER_MBEDTLS_H
diff --git a/modules/meshoptimizer/register_types.h b/modules/meshoptimizer/register_types.h
index 99c71efceb..3a84aab7bc 100644
--- a/modules/meshoptimizer/register_types.h
+++ b/modules/meshoptimizer/register_types.h
@@ -36,4 +36,4 @@
void initialize_meshoptimizer_module(ModuleInitializationLevel p_level);
void uninitialize_meshoptimizer_module(ModuleInitializationLevel p_level);
-#endif // PVR_REGISTER_TYPES_H
+#endif // MESHOPTIMIZER_REGISTER_TYPES_H
diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp
index c37bea519f..98bcdea8f4 100644
--- a/modules/minimp3/audio_stream_mp3.cpp
+++ b/modules/minimp3/audio_stream_mp3.cpp
@@ -46,6 +46,12 @@ int AudioStreamPlaybackMP3::_mix_internal(AudioFrame *p_buffer, int p_frames) {
int frames_mixed_this_step = p_frames;
+ int beat_length_frames = -1;
+ bool beat_loop = mp3_stream->has_loop() && mp3_stream->get_bpm() > 0 && mp3_stream->get_beat_count() > 0;
+ if (beat_loop) {
+ beat_length_frames = mp3_stream->get_beat_count() * mp3_stream->sample_rate * 60 / mp3_stream->get_bpm();
+ }
+
while (todo && active) {
mp3dec_frame_info_t frame_info;
mp3d_sample_t *buf_frame = nullptr;
@@ -54,8 +60,25 @@ int AudioStreamPlaybackMP3::_mix_internal(AudioFrame *p_buffer, int p_frames) {
if (samples_mixed) {
p_buffer[p_frames - todo] = AudioFrame(buf_frame[0], buf_frame[samples_mixed - 1]);
+ if (loop_fade_remaining < FADE_SIZE) {
+ p_buffer[p_frames - todo] += loop_fade[loop_fade_remaining] * (float(FADE_SIZE - loop_fade_remaining) / float(FADE_SIZE));
+ loop_fade_remaining++;
+ }
--todo;
++frames_mixed;
+
+ if (beat_loop && (int)frames_mixed >= beat_length_frames) {
+ for (int i = 0; i < FADE_SIZE; i++) {
+ samples_mixed = mp3dec_ex_read_frame(mp3d, &buf_frame, &frame_info, mp3_stream->channels);
+ loop_fade[i] = AudioFrame(buf_frame[0], buf_frame[samples_mixed - 1]);
+ if (!samples_mixed) {
+ break;
+ }
+ }
+ loop_fade_remaining = 0;
+ seek(mp3_stream->loop_offset);
+ loops++;
+ }
}
else {
@@ -117,6 +140,10 @@ void AudioStreamPlaybackMP3::seek(float p_time) {
mp3dec_ex_seek(mp3d, (uint64_t)frames_mixed * mp3_stream->channels);
}
+void AudioStreamPlaybackMP3::tag_used_streams() {
+ mp3_stream->tag_used(get_playback_position());
+}
+
AudioStreamPlaybackMP3::~AudioStreamPlaybackMP3() {
if (mp3d) {
mp3dec_ex_close(mp3d);
@@ -124,7 +151,7 @@ AudioStreamPlaybackMP3::~AudioStreamPlaybackMP3() {
}
}
-Ref<AudioStreamPlayback> AudioStreamMP3::instance_playback() {
+Ref<AudioStreamPlayback> AudioStreamMP3::instantiate_playback() {
Ref<AudioStreamPlaybackMP3> mp3s;
ERR_FAIL_COND_V_MSG(data.is_empty(), mp3s,
@@ -206,6 +233,36 @@ bool AudioStreamMP3::is_monophonic() const {
return false;
}
+void AudioStreamMP3::set_bpm(double p_bpm) {
+ ERR_FAIL_COND(p_bpm < 0);
+ bpm = p_bpm;
+ emit_changed();
+}
+
+double AudioStreamMP3::get_bpm() const {
+ return bpm;
+}
+
+void AudioStreamMP3::set_beat_count(int p_beat_count) {
+ ERR_FAIL_COND(p_beat_count < 0);
+ beat_count = p_beat_count;
+ emit_changed();
+}
+
+int AudioStreamMP3::get_beat_count() const {
+ return beat_count;
+}
+
+void AudioStreamMP3::set_bar_beats(int p_bar_beats) {
+ ERR_FAIL_COND(p_bar_beats < 0);
+ bar_beats = p_bar_beats;
+ emit_changed();
+}
+
+int AudioStreamMP3::get_bar_beats() const {
+ return bar_beats;
+}
+
void AudioStreamMP3::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_data", "data"), &AudioStreamMP3::set_data);
ClassDB::bind_method(D_METHOD("get_data"), &AudioStreamMP3::get_data);
@@ -216,7 +273,19 @@ void AudioStreamMP3::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamMP3::set_loop_offset);
ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamMP3::get_loop_offset);
+ ClassDB::bind_method(D_METHOD("set_bpm", "bpm"), &AudioStreamMP3::set_bpm);
+ ClassDB::bind_method(D_METHOD("get_bpm"), &AudioStreamMP3::get_bpm);
+
+ ClassDB::bind_method(D_METHOD("set_beat_count", "count"), &AudioStreamMP3::set_beat_count);
+ ClassDB::bind_method(D_METHOD("get_beat_count"), &AudioStreamMP3::get_beat_count);
+
+ ClassDB::bind_method(D_METHOD("set_bar_beats", "count"), &AudioStreamMP3::set_bar_beats);
+ ClassDB::bind_method(D_METHOD("get_bar_beats"), &AudioStreamMP3::get_bar_beats);
+
ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_data", "get_data");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bpm", PROPERTY_HINT_RANGE, "0,400,0.01,or_greater"), "set_bpm", "get_bpm");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "beat_count", PROPERTY_HINT_RANGE, "0,512,1,or_greater"), "set_beat_count", "get_beat_count");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "bar_beats", PROPERTY_HINT_RANGE, "2,32,1,or_greater"), "set_bar_beats", "get_bar_beats");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "loop_offset"), "set_loop_offset", "get_loop_offset");
}
diff --git a/modules/minimp3/audio_stream_mp3.h b/modules/minimp3/audio_stream_mp3.h
index c1a60ddccb..428ac1240e 100644
--- a/modules/minimp3/audio_stream_mp3.h
+++ b/modules/minimp3/audio_stream_mp3.h
@@ -41,6 +41,12 @@ class AudioStreamMP3;
class AudioStreamPlaybackMP3 : public AudioStreamPlaybackResampled {
GDCLASS(AudioStreamPlaybackMP3, AudioStreamPlaybackResampled);
+ enum {
+ FADE_SIZE = 256
+ };
+ AudioFrame loop_fade[FADE_SIZE];
+ int loop_fade_remaining = FADE_SIZE;
+
mp3dec_ex_t *mp3d = nullptr;
uint32_t frames_mixed = 0;
bool active = false;
@@ -64,6 +70,8 @@ public:
virtual float get_playback_position() const override;
virtual void seek(float p_time) override;
+ virtual void tag_used_streams() override;
+
AudioStreamPlaybackMP3() {}
~AudioStreamPlaybackMP3();
};
@@ -85,17 +93,30 @@ class AudioStreamMP3 : public AudioStream {
float loop_offset = 0.0;
void clear_data();
+ double bpm = 0;
+ int beat_count = 0;
+ int bar_beats = 4;
+
protected:
static void _bind_methods();
public:
void set_loop(bool p_enable);
- bool has_loop() const;
+ virtual bool has_loop() const override;
void set_loop_offset(float p_seconds);
float get_loop_offset() const;
- virtual Ref<AudioStreamPlayback> instance_playback() override;
+ void set_bpm(double p_bpm);
+ virtual double get_bpm() const override;
+
+ void set_beat_count(int p_beat_count);
+ virtual int get_beat_count() const override;
+
+ void set_bar_beats(int p_bar_beats);
+ virtual int get_bar_beats() const override;
+
+ virtual Ref<AudioStreamPlayback> instantiate_playback() override;
virtual String get_stream_name() const override;
void set_data(const Vector<uint8_t> &p_data);
diff --git a/modules/minimp3/doc_classes/AudioStreamMP3.xml b/modules/minimp3/doc_classes/AudioStreamMP3.xml
index 404f6c31e5..8f03681c06 100644
--- a/modules/minimp3/doc_classes/AudioStreamMP3.xml
+++ b/modules/minimp3/doc_classes/AudioStreamMP3.xml
@@ -9,6 +9,12 @@
<tutorials>
</tutorials>
<members>
+ <member name="bar_beats" type="int" setter="set_bar_beats" getter="get_bar_beats" default="4">
+ </member>
+ <member name="beat_count" type="int" setter="set_beat_count" getter="get_beat_count" default="0">
+ </member>
+ <member name="bpm" type="float" setter="set_bpm" getter="get_bpm" default="0.0">
+ </member>
<member name="data" type="PackedByteArray" setter="set_data" getter="get_data" default="PackedByteArray()">
Contains the audio data in bytes.
You can load a file without having to import it beforehand using the code snippet below. Keep in mind that this snippet loads the whole file into memory and may not be ideal for huge files (hundreds of megabytes or more).
diff --git a/modules/minimp3/resource_importer_mp3.cpp b/modules/minimp3/resource_importer_mp3.cpp
index e03940f963..8526aeef38 100644
--- a/modules/minimp3/resource_importer_mp3.cpp
+++ b/modules/minimp3/resource_importer_mp3.cpp
@@ -34,6 +34,10 @@
#include "core/io/resource_saver.h"
#include "scene/resources/texture.h"
+#ifdef TOOLS_ENABLED
+#include "editor/import/audio_stream_import_settings.h"
+#endif
+
String ResourceImporterMP3::get_importer_name() const {
return "mp3";
}
@@ -69,14 +73,26 @@ String ResourceImporterMP3::get_preset_name(int p_idx) const {
void ResourceImporterMP3::get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const {
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "loop_offset"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "bpm", PROPERTY_HINT_RANGE, "0,400,0.01,or_greater"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "beat_count", PROPERTY_HINT_RANGE, "0,512,or_greater"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "bar_beats", PROPERTY_HINT_RANGE, "2,32,or_greater"), 4));
}
-Error ResourceImporterMP3::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
- bool loop = p_options["loop"];
- float loop_offset = p_options["loop_offset"];
+#ifdef TOOLS_ENABLED
+bool ResourceImporterMP3::has_advanced_options() const {
+ return true;
+}
+void ResourceImporterMP3::show_advanced_options(const String &p_path) {
+ Ref<AudioStreamMP3> mp3_stream = import_mp3(p_path);
+ if (mp3_stream.is_valid()) {
+ AudioStreamImportSettings::get_singleton()->edit(p_path, "mp3", mp3_stream);
+ }
+}
+#endif
- Ref<FileAccess> f = FileAccess::open(p_source_file, FileAccess::READ);
- ERR_FAIL_COND_V(f.is_null(), ERR_CANT_OPEN);
+Ref<AudioStreamMP3> ResourceImporterMP3::import_mp3(const String &p_path) {
+ Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
+ ERR_FAIL_COND_V(f.is_null(), Ref<AudioStreamMP3>());
uint64_t len = f->get_length();
@@ -90,9 +106,27 @@ Error ResourceImporterMP3::import(const String &p_source_file, const String &p_s
mp3_stream.instantiate();
mp3_stream->set_data(data);
- ERR_FAIL_COND_V(!mp3_stream->get_data().size(), ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(!mp3_stream->get_data().size(), Ref<AudioStreamMP3>());
+
+ return mp3_stream;
+}
+
+Error ResourceImporterMP3::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
+ bool loop = p_options["loop"];
+ float loop_offset = p_options["loop_offset"];
+ double bpm = p_options["bpm"];
+ float beat_count = p_options["beat_count"];
+ float bar_beats = p_options["bar_beats"];
+
+ Ref<AudioStreamMP3> mp3_stream = import_mp3(p_source_file);
+ if (mp3_stream.is_null()) {
+ return ERR_CANT_OPEN;
+ }
mp3_stream->set_loop(loop);
mp3_stream->set_loop_offset(loop_offset);
+ mp3_stream->set_bpm(bpm);
+ mp3_stream->set_beat_count(beat_count);
+ mp3_stream->set_bar_beats(bar_beats);
return ResourceSaver::save(p_save_path + ".mp3str", mp3_stream);
}
diff --git a/modules/minimp3/resource_importer_mp3.h b/modules/minimp3/resource_importer_mp3.h
index 678a3773bb..38729d68f8 100644
--- a/modules/minimp3/resource_importer_mp3.h
+++ b/modules/minimp3/resource_importer_mp3.h
@@ -50,6 +50,12 @@ public:
virtual void get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset = 0) const override;
virtual bool get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) const override;
+#ifdef TOOLS_ENABLED
+ virtual bool has_advanced_options() const override;
+ virtual void show_advanced_options(const String &p_path) override;
+#endif
+ static Ref<AudioStreamMP3> import_mp3(const String &p_path);
+
virtual Error import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
ResourceImporterMP3();
diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp
index 95f1a657a4..b14f5f469c 100644
--- a/modules/mobile_vr/mobile_vr_interface.cpp
+++ b/modules/mobile_vr/mobile_vr_interface.cpp
@@ -452,10 +452,10 @@ Transform3D MobileVRInterface::get_transform_for_view(uint32_t p_view, const Tra
return transform_for_eye;
};
-CameraMatrix MobileVRInterface::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
+Projection MobileVRInterface::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
_THREAD_SAFE_METHOD_
- CameraMatrix eye;
+ Projection eye;
aspect = p_aspect;
eye.set_for_hmd(p_view + 1, p_aspect, intraocular_dist, display_width, display_to_lens, oversample, p_z_near, p_z_far);
diff --git a/modules/mobile_vr/mobile_vr_interface.h b/modules/mobile_vr/mobile_vr_interface.h
index 8ecca3a2ae..b934a09dd3 100644
--- a/modules/mobile_vr/mobile_vr_interface.h
+++ b/modules/mobile_vr/mobile_vr_interface.h
@@ -150,7 +150,7 @@ public:
virtual uint32_t get_view_count() override;
virtual Transform3D get_camera_transform() override;
virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override;
- virtual CameraMatrix get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override;
+ virtual Projection get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override;
virtual Vector<BlitToScreen> post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) override;
virtual void process() override;
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 3dc26cfbe4..1e4d82ca30 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -481,11 +481,14 @@ static String variant_type_to_managed_name(const String &p_var_type_name) {
Variant::VECTOR3,
Variant::VECTOR3I,
Variant::TRANSFORM2D,
+ Variant::VECTOR4,
+ Variant::VECTOR4I,
Variant::PLANE,
Variant::QUATERNION,
Variant::AABB,
Variant::BASIS,
Variant::TRANSFORM3D,
+ Variant::PROJECTION,
Variant::COLOR,
Variant::STRING_NAME,
Variant::NODE_PATH,
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs b/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs
index 6a80e81fdd..e9718cc82c 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs
@@ -339,7 +339,7 @@ MONO_AOT_MODE_LAST = 1000,
string MonoLibFile(string libFileName) => libFileName + ".ios.fat.a";
string MonoLibFromTemplate(string libFileName) =>
- Path.Combine(Internal.FullTemplatesDir, "ios-mono-libs", MonoLibFile(libFileName));
+ Path.Combine(Internal.FullExportTemplatesDir, "ios-mono-libs", MonoLibFile(libFileName));
exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmonosgen-2.0"));
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
index 6a9ead9aa1..cca18a2a1f 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
@@ -337,7 +337,7 @@ namespace GodotTools.Export
string TemplateDirName() => $"data.mono.{platform}.{bits}.{target}";
- string templateDirPath = Path.Combine(Internal.FullTemplatesDir, TemplateDirName());
+ string templateDirPath = Path.Combine(Internal.FullExportTemplatesDir, TemplateDirName());
bool validTemplatePathFound = true;
if (!Directory.Exists(templateDirPath))
@@ -347,7 +347,7 @@ namespace GodotTools.Export
if (isDebug)
{
target = "debug"; // Support both 'release_debug' and 'debug' for the template data directory name
- templateDirPath = Path.Combine(Internal.FullTemplatesDir, TemplateDirName());
+ templateDirPath = Path.Combine(Internal.FullExportTemplatesDir, TemplateDirName());
validTemplatePathFound = true;
if (!Directory.Exists(templateDirPath))
@@ -398,13 +398,13 @@ namespace GodotTools.Export
private static string GetBclProfileDir(string profile)
{
- string templatesDir = Internal.FullTemplatesDir;
+ string templatesDir = Internal.FullExportTemplatesDir;
return Path.Combine(templatesDir, "bcl", profile);
}
private static string DeterminePlatformBclDir(string platform)
{
- string templatesDir = Internal.FullTemplatesDir;
+ string templatesDir = Internal.FullExportTemplatesDir;
string platformBclDir = Path.Combine(templatesDir, "bcl", platform);
if (!File.Exists(Path.Combine(platformBclDir, "mscorlib.dll")))
diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs
index 72985db292..12c90178c9 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs
@@ -12,8 +12,8 @@ namespace GodotTools.Internals
public static string UpdateApiAssembliesFromPrebuilt(string config) =>
internal_UpdateApiAssembliesFromPrebuilt(config);
- public static string FullTemplatesDir =>
- internal_FullTemplatesDir();
+ public static string FullExportTemplatesDir =>
+ internal_FullExportTemplatesDir();
public static string SimplifyGodotPath(this string path) => internal_SimplifyGodotPath(path);
@@ -57,7 +57,7 @@ namespace GodotTools.Internals
private static extern string internal_UpdateApiAssembliesFromPrebuilt(string config);
[MethodImpl(MethodImplOptions.InternalCall)]
- private static extern string internal_FullTemplatesDir();
+ private static extern string internal_FullExportTemplatesDir();
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern string internal_SimplifyGodotPath(this string path);
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 7cc195201b..2e628cb576 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -917,6 +917,8 @@ void BindingsGenerator::_generate_array_extensions(StringBuilder &p_output) {
ARRAY_ALL(Vector2i);
ARRAY_ALL(Vector3);
ARRAY_ALL(Vector3i);
+ ARRAY_ALL(Vector4);
+ ARRAY_ALL(Vector4i);
#undef ARRAY_ALL
#undef ARRAY_IS_EMPTY
@@ -3222,6 +3224,11 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
r_iarg.default_argument = "new %s" + r_iarg.default_argument;
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
break;
+ case Variant::VECTOR4:
+ case Variant::VECTOR4I:
+ r_iarg.default_argument = "new %s" + r_iarg.default_argument;
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
+ break;
case Variant::OBJECT:
ERR_FAIL_COND_V_MSG(!p_val.is_zero(), false,
"Parameter of type '" + String(r_iarg.type.cname) + "' can only have null/zero as the default value.");
@@ -3276,6 +3283,15 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
}
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break;
+ case Variant::PROJECTION: {
+ Projection transform = p_val.operator Projection();
+ if (transform == Projection()) {
+ r_iarg.default_argument = "Projection.Identity";
+ } else {
+ r_iarg.default_argument = "new Projection(new Vector4" + transform.matrix[0].operator String() + ", new Vector4" + transform.matrix[1].operator String() + ", new Vector4" + transform.matrix[2].operator String() + ", new Vector4" + transform.matrix[3].operator String() + ")";
+ }
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
+ } break;
case Variant::BASIS: {
Basis basis = p_val.operator Basis();
if (basis == Basis()) {
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index 1547d0ed2f..ee170e4558 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -590,6 +590,9 @@ class BindingsGenerator {
StringName type_Vector2 = StaticCString::create("Vector2");
StringName type_Rect2 = StaticCString::create("Rect2");
StringName type_Vector3 = StaticCString::create("Vector3");
+ StringName type_Vector3i = StaticCString::create("Vector3i");
+ StringName type_Vector4 = StaticCString::create("Vector4");
+ StringName type_Vector4i = StaticCString::create("Vector4i");
// Object not included as it must be checked for all derived classes
static constexpr int nullable_types_count = 17;
diff --git a/modules/mono/editor/editor_internal_calls.cpp b/modules/mono/editor/editor_internal_calls.cpp
index 5bf3839e94..5e4fe90553 100644
--- a/modules/mono/editor/editor_internal_calls.cpp
+++ b/modules/mono/editor/editor_internal_calls.cpp
@@ -188,8 +188,8 @@ MonoString *godot_icall_Internal_UpdateApiAssembliesFromPrebuilt(MonoString *p_c
return GDMonoMarshal::mono_string_from_godot(error_str);
}
-MonoString *godot_icall_Internal_FullTemplatesDir() {
- String full_templates_dir = EditorSettings::get_singleton()->get_templates_dir().plus_file(VERSION_FULL_CONFIG);
+MonoString *godot_icall_Internal_FullExportTemplatesDir() {
+ String full_templates_dir = EditorSettings::get_singleton()->get_export_templates_dir().plus_file(VERSION_FULL_CONFIG);
return GDMonoMarshal::mono_string_from_godot(full_templates_dir);
}
@@ -364,7 +364,7 @@ void register_editor_internal_calls() {
// Internals
GDMonoUtils::add_internal_call("GodotTools.Internals.Internal::internal_UpdateApiAssembliesFromPrebuilt", godot_icall_Internal_UpdateApiAssembliesFromPrebuilt);
- GDMonoUtils::add_internal_call("GodotTools.Internals.Internal::internal_FullTemplatesDir", godot_icall_Internal_FullTemplatesDir);
+ GDMonoUtils::add_internal_call("GodotTools.Internals.Internal::internal_FullExportTemplatesDir", godot_icall_Internal_FullExportTemplatesDir);
GDMonoUtils::add_internal_call("GodotTools.Internals.Internal::internal_SimplifyGodotPath", godot_icall_Internal_SimplifyGodotPath);
GDMonoUtils::add_internal_call("GodotTools.Internals.Internal::internal_IsMacOSAppBundleInstalled", godot_icall_Internal_IsMacOSAppBundleInstalled);
GDMonoUtils::add_internal_call("GodotTools.Internals.Internal::internal_GodotIs32Bits", godot_icall_Internal_GodotIs32Bits);
diff --git a/modules/mono/editor/editor_internal_calls.h b/modules/mono/editor/editor_internal_calls.h
index a899634d57..8262ac211a 100644
--- a/modules/mono/editor/editor_internal_calls.h
+++ b/modules/mono/editor/editor_internal_calls.h
@@ -28,9 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EDITOR_INTERNAL_CALL_H
-#define EDITOR_INTERNAL_CALL_H
+#ifndef EDITOR_INTERNAL_CALLS_H
+#define EDITOR_INTERNAL_CALLS_H
void register_editor_internal_calls();
-#endif // EDITOR_INTERNAL_CALL_H
+#endif // EDITOR_INTERNAL_CALLS_H
diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h
index 9638b23410..f9ad1a9893 100644
--- a/modules/mono/glue/glue_header.h
+++ b/modules/mono/glue/glue_header.h
@@ -28,6 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef GLUE_HEADER_H
+#define GLUE_HEADER_H
+
#ifdef MONO_GLUE_ENABLED
#include "../mono_gd/gd_mono_marshal.h"
@@ -84,3 +87,5 @@ void godot_register_glue_header_icalls() {
#include "arguments_vector.h"
#endif // MONO_GLUE_ENABLED
+
+#endif // GLUE_HEADER_H
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index ab9e508c99..e2aff1d19d 100644
--- a/modules/mono/mono_gc_handle.h
+++ b/modules/mono/mono_gc_handle.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef CSHARP_GC_HANDLE_H
-#define CSHARP_GC_HANDLE_H
+#ifndef MONO_GC_HANDLE_H
+#define MONO_GC_HANDLE_H
#include <mono/jit/jit.h>
@@ -104,4 +104,4 @@ public:
~MonoGCHandleRef() { release(); }
};
-#endif // CSHARP_GC_HANDLE_H
+#endif // MONO_GC_HANDLE_H
diff --git a/modules/mono/mono_gd/gd_mono_cache.cpp b/modules/mono/mono_gd/gd_mono_cache.cpp
index fd78fae4ad..69d8c7edc9 100644
--- a/modules/mono/mono_gd/gd_mono_cache.cpp
+++ b/modules/mono/mono_gd/gd_mono_cache.cpp
@@ -108,9 +108,12 @@ void CachedData::clear_godot_api_cache() {
class_Transform2D = nullptr;
class_Vector3 = nullptr;
class_Vector3i = nullptr;
+ class_Vector4 = nullptr;
+ class_Vector4i = nullptr;
class_Basis = nullptr;
class_Quaternion = nullptr;
class_Transform3D = nullptr;
+ class_Projection = nullptr;
class_AABB = nullptr;
class_Color = nullptr;
class_Plane = nullptr;
@@ -239,9 +242,12 @@ void update_godot_api_cache() {
CACHE_CLASS_AND_CHECK(Transform2D, GODOT_API_CLASS(Transform2D));
CACHE_CLASS_AND_CHECK(Vector3, GODOT_API_CLASS(Vector3));
CACHE_CLASS_AND_CHECK(Vector3i, GODOT_API_CLASS(Vector3i));
+ CACHE_CLASS_AND_CHECK(Vector4, GODOT_API_CLASS(Vector4));
+ CACHE_CLASS_AND_CHECK(Vector4i, GODOT_API_CLASS(Vector4i));
CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis));
CACHE_CLASS_AND_CHECK(Quaternion, GODOT_API_CLASS(Quaternion));
CACHE_CLASS_AND_CHECK(Transform3D, GODOT_API_CLASS(Transform3D));
+ CACHE_CLASS_AND_CHECK(Projection, GODOT_API_CLASS(Projection));
CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB));
CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color));
CACHE_CLASS_AND_CHECK(Plane, GODOT_API_CLASS(Plane));
diff --git a/modules/mono/mono_gd/gd_mono_cache.h b/modules/mono/mono_gd/gd_mono_cache.h
index b3b0865608..e9cc26899e 100644
--- a/modules/mono/mono_gd/gd_mono_cache.h
+++ b/modules/mono/mono_gd/gd_mono_cache.h
@@ -79,9 +79,12 @@ struct CachedData {
GDMonoClass *class_Transform2D = nullptr;
GDMonoClass *class_Vector3 = nullptr;
GDMonoClass *class_Vector3i = nullptr;
+ GDMonoClass *class_Vector4 = nullptr;
+ GDMonoClass *class_Vector4i = nullptr;
GDMonoClass *class_Basis = nullptr;
GDMonoClass *class_Quaternion = nullptr;
GDMonoClass *class_Transform3D = nullptr;
+ GDMonoClass *class_Projection = nullptr;
GDMonoClass *class_AABB = nullptr;
GDMonoClass *class_Color = nullptr;
GDMonoClass *class_Plane = nullptr;
diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp
index 333a06c94a..cb025fc67a 100644
--- a/modules/mono/mono_gd/gd_mono_field.cpp
+++ b/modules/mono/mono_gd/gd_mono_field.cpp
@@ -140,6 +140,18 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
break;
}
+ if (tclass == CACHED_CLASS(Vector4)) {
+ GDMonoMarshal::M_Vector4 from = MARSHALLED_OUT(Vector4, p_value.operator ::Vector4());
+ mono_field_set_value(p_object, mono_field, &from);
+ break;
+ }
+
+ if (tclass == CACHED_CLASS(Vector4i)) {
+ GDMonoMarshal::M_Vector4i from = MARSHALLED_OUT(Vector4i, p_value.operator ::Vector4i());
+ mono_field_set_value(p_object, mono_field, &from);
+ break;
+ }
+
if (tclass == CACHED_CLASS(Basis)) {
GDMonoMarshal::M_Basis from = MARSHALLED_OUT(Basis, p_value.operator ::Basis());
mono_field_set_value(p_object, mono_field, &from);
@@ -158,6 +170,12 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
break;
}
+ if (tclass == CACHED_CLASS(Projection)) {
+ GDMonoMarshal::M_Projection from = MARSHALLED_OUT(Projection, p_value.operator ::Projection());
+ mono_field_set_value(p_object, mono_field, &from);
+ break;
+ }
+
if (tclass == CACHED_CLASS(AABB)) {
GDMonoMarshal::M_AABB from = MARSHALLED_OUT(AABB, p_value.operator ::AABB());
mono_field_set_value(p_object, mono_field, &from);
@@ -328,6 +346,14 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
GDMonoMarshal::M_Vector3i from = MARSHALLED_OUT(Vector3i, p_value.operator ::Vector3i());
mono_field_set_value(p_object, mono_field, &from);
} break;
+ case Variant::VECTOR4: {
+ GDMonoMarshal::M_Vector4 from = MARSHALLED_OUT(Vector4, p_value.operator ::Vector4());
+ mono_field_set_value(p_object, mono_field, &from);
+ } break;
+ case Variant::VECTOR4I: {
+ GDMonoMarshal::M_Vector4i from = MARSHALLED_OUT(Vector4i, p_value.operator ::Vector4i());
+ mono_field_set_value(p_object, mono_field, &from);
+ } break;
case Variant::TRANSFORM2D: {
GDMonoMarshal::M_Transform2D from = MARSHALLED_OUT(Transform2D, p_value.operator ::Transform2D());
mono_field_set_value(p_object, mono_field, &from);
@@ -352,6 +378,10 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
GDMonoMarshal::M_Transform3D from = MARSHALLED_OUT(Transform3D, p_value.operator ::Transform3D());
mono_field_set_value(p_object, mono_field, &from);
} break;
+ case Variant::PROJECTION: {
+ GDMonoMarshal::M_Projection from = MARSHALLED_OUT(Projection, p_value.operator ::Projection());
+ mono_field_set_value(p_object, mono_field, &from);
+ } break;
case Variant::COLOR: {
GDMonoMarshal::M_Color from = MARSHALLED_OUT(Color, p_value.operator ::Color());
mono_field_set_value(p_object, mono_field, &from);
diff --git a/modules/mono/mono_gd/gd_mono_field.h b/modules/mono/mono_gd/gd_mono_field.h
index 87ef245f3f..1d30f7a369 100644
--- a/modules/mono/mono_gd/gd_mono_field.h
+++ b/modules/mono/mono_gd/gd_mono_field.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GDMONOFIELD_H
-#define GDMONOFIELD_H
+#ifndef GD_MONO_FIELD_H
+#define GD_MONO_FIELD_H
#include "gd_mono.h"
#include "gd_mono_header.h"
@@ -75,4 +75,4 @@ public:
~GDMonoField();
};
-#endif // GDMONOFIELD_H
+#endif // GD_MONO_FIELD_H
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index 957abca37b..a860442764 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -99,6 +99,13 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_
if (vtclass == CACHED_CLASS(Vector3i)) {
return Variant::VECTOR3I;
}
+ if (vtclass == CACHED_CLASS(Vector4)) {
+ return Variant::VECTOR4;
+ }
+
+ if (vtclass == CACHED_CLASS(Vector4i)) {
+ return Variant::VECTOR4I;
+ }
if (vtclass == CACHED_CLASS(Basis)) {
return Variant::BASIS;
@@ -111,7 +118,9 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_
if (vtclass == CACHED_CLASS(Transform3D)) {
return Variant::TRANSFORM3D;
}
-
+ if (vtclass == CACHED_CLASS(Projection)) {
+ return Variant::PROJECTION;
+ }
if (vtclass == CACHED_CLASS(AABB)) {
return Variant::AABB;
}
@@ -539,6 +548,14 @@ MonoObject *variant_to_mono_object(const Variant &p_var) {
GDMonoMarshal::M_Transform2D from = MARSHALLED_OUT(Transform2D, p_var.operator ::Transform2D());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Transform2D), &from);
}
+ case Variant::VECTOR4: {
+ GDMonoMarshal::M_Vector4 from = MARSHALLED_OUT(Vector4, p_var.operator ::Vector4());
+ return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Vector4), &from);
+ }
+ case Variant::VECTOR4I: {
+ GDMonoMarshal::M_Vector4i from = MARSHALLED_OUT(Vector4i, p_var.operator ::Vector4i());
+ return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Vector4i), &from);
+ }
case Variant::PLANE: {
GDMonoMarshal::M_Plane from = MARSHALLED_OUT(Plane, p_var.operator ::Plane());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Plane), &from);
@@ -559,6 +576,10 @@ MonoObject *variant_to_mono_object(const Variant &p_var) {
GDMonoMarshal::M_Transform3D from = MARSHALLED_OUT(Transform3D, p_var.operator ::Transform3D());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Transform3D), &from);
}
+ case Variant::PROJECTION: {
+ GDMonoMarshal::M_Projection from = MARSHALLED_OUT(Projection, p_var.operator ::Projection());
+ return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Projection), &from);
+ }
case Variant::COLOR: {
GDMonoMarshal::M_Color from = MARSHALLED_OUT(Color, p_var.operator ::Color());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Color), &from);
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index 778e52b6cb..3b6fd25d71 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GDMONOMARSHAL_H
-#define GDMONOMARSHAL_H
+#ifndef GD_MONO_MARSHAL_H
+#define GD_MONO_MARSHAL_H
#include "core/variant/variant.h"
@@ -256,6 +256,18 @@ enum {
offsetof(Vector3, y) == (sizeof(real_t) * 1) &&
offsetof(Vector3, z) == (sizeof(real_t) * 2)),
+ MATCHES_Vector4 = (MATCHES_real_t && (sizeof(Vector4) == (sizeof(real_t) * 4)) &&
+ offsetof(Vector4, x) == (sizeof(real_t) * 0) &&
+ offsetof(Vector4, y) == (sizeof(real_t) * 1) &&
+ offsetof(Vector4, z) == (sizeof(real_t) * 2) &&
+ offsetof(Vector4, w) == (sizeof(real_t) * 3)),
+
+ MATCHES_Vector4i = (MATCHES_int && (sizeof(Vector4i) == (sizeof(int32_t) * 4i)) &&
+ offsetof(Vector4i, x) == (sizeof(int32_t) * 0) &&
+ offsetof(Vector4i, y) == (sizeof(int32_t) * 1) &&
+ offsetof(Vector4i, z) == (sizeof(int32_t) * 2) &&
+ offsetof(Vector4i, w) == (sizeof(int32_t) * 3)),
+
MATCHES_Vector3i = (MATCHES_int && (sizeof(Vector3i) == (sizeof(int32_t) * 3)) &&
offsetof(Vector3i, x) == (sizeof(int32_t) * 0) &&
offsetof(Vector3i, y) == (sizeof(int32_t) * 1) &&
@@ -273,6 +285,8 @@ enum {
offsetof(Transform3D, basis) == 0 &&
offsetof(Transform3D, origin) == sizeof(Basis)),
+ MATCHES_Projection = (MATCHES_Vector4 && (sizeof(Projection) == (sizeof(Vector4) * 4))),
+
MATCHES_AABB = (MATCHES_Vector3 && (sizeof(AABB) == (sizeof(Vector3) * 2)) &&
offsetof(AABB, position) == (sizeof(Vector3) * 0) &&
offsetof(AABB, size) == (sizeof(Vector3) * 1)),
@@ -291,9 +305,9 @@ enum {
// In the future we may force this if we want to ref return these structs
#ifdef GD_MONO_FORCE_INTEROP_STRUCT_COPY
/* clang-format off */
-static_assert(MATCHES_Vector2 && MATCHES_Rect2 && MATCHES_Transform2D && MATCHES_Vector3 &&
- MATCHES_Basis && MATCHES_Quaternion && MATCHES_Transform3D && MATCHES_AABB && MATCHES_Color &&
- MATCHES_Plane && MATCHES_Vector2i && MATCHES_Rect2i && MATCHES_Vector3i);
+static_assert(MATCHES_Vector2 && MATCHES_Rect2 && MATCHES_Transform2D && MATCHES_Vector3 && MATCHES_Vector4 &&
+ MATCHES_Basis && MATCHES_Quaternion && MATCHES_Transform3D && MATCHES_Projection && MATCHES_AABB && MATCHES_Color &&
+ MATCHES_Plane && MATCHES_Vector2i && MATCHES_Rect2i && MATCHES_Vector3i && MATCHES_Vector4i);
/* clang-format on */
#endif
} // namespace InteropLayout
@@ -401,6 +415,32 @@ struct M_Vector3i {
}
};
+struct M_Vector4 {
+ real_t x, y, z, w;
+
+ static _FORCE_INLINE_ Vector4 convert_to(const M_Vector4 &p_from) {
+ return Vector4(p_from.x, p_from.y, p_from.z, p_from.w);
+ }
+
+ static _FORCE_INLINE_ M_Vector4 convert_from(const Vector4 &p_from) {
+ M_Vector4 ret = { p_from.x, p_from.y, p_from.z, p_from.w };
+ return ret;
+ }
+};
+
+struct M_Vector4i {
+ int32_t x, y, z, w;
+
+ static _FORCE_INLINE_ Vector4i convert_to(const M_Vector4i &p_from) {
+ return Vector4i(p_from.x, p_from.y, p_from.z, p_from.w);
+ }
+
+ static _FORCE_INLINE_ M_Vector4i convert_from(const Vector4i &p_from) {
+ M_Vector4i ret = { p_from.x, p_from.y, p_from.z, p_from.w };
+ return ret;
+ }
+};
+
struct M_Basis {
M_Vector3 elements[3];
@@ -447,6 +487,22 @@ struct M_Transform3D {
}
};
+struct M_Projection {
+ M_Vector4 vec1;
+ M_Vector4 vec2;
+ M_Vector4 vec3;
+ M_Vector4 vec4;
+
+ static _FORCE_INLINE_ Projection convert_to(const M_Projection &p_from) {
+ return Projection(M_Vector4::convert_to(p_from.vec1), M_Vector4::convert_to(p_from.vec2), M_Vector4::convert_to(p_from.vec3), M_Vector4::convert_to(p_from.vec4));
+ }
+
+ static _FORCE_INLINE_ M_Projection convert_from(const Projection &p_from) {
+ M_Projection ret = { M_Vector4::convert_from(p_from.matrix[0]), M_Vector4::convert_from(p_from.matrix[1]), M_Vector4::convert_from(p_from.matrix[2]), M_Vector4::convert_from(p_from.matrix[3]) };
+ return ret;
+ }
+};
+
struct M_AABB {
M_Vector3 position;
M_Vector3 size;
@@ -533,8 +589,11 @@ DECL_TYPE_MARSHAL_TEMPLATES(Transform2D)
DECL_TYPE_MARSHAL_TEMPLATES(Vector3)
DECL_TYPE_MARSHAL_TEMPLATES(Vector3i)
DECL_TYPE_MARSHAL_TEMPLATES(Basis)
+DECL_TYPE_MARSHAL_TEMPLATES(Vector4)
+DECL_TYPE_MARSHAL_TEMPLATES(Vector4i)
DECL_TYPE_MARSHAL_TEMPLATES(Quaternion)
DECL_TYPE_MARSHAL_TEMPLATES(Transform3D)
+DECL_TYPE_MARSHAL_TEMPLATES(Projection)
DECL_TYPE_MARSHAL_TEMPLATES(AABB)
DECL_TYPE_MARSHAL_TEMPLATES(Color)
DECL_TYPE_MARSHAL_TEMPLATES(Plane)
@@ -543,4 +602,4 @@ DECL_TYPE_MARSHAL_TEMPLATES(Plane)
#define MARSHALLED_OUT(m_type, m_from) (GDMonoMarshal::marshalled_out_##m_type(m_from))
} // namespace GDMonoMarshal
-#endif // GDMONOMARSHAL_H
+#endif // GD_MONO_MARSHAL_H
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index 246a1cd31e..300cacfa4b 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GD_MONOUTILS_H
-#define GD_MONOUTILS_H
+#ifndef GD_MONO_UTILS_H
+#define GD_MONO_UTILS_H
#include <mono/metadata/threads.h>
@@ -202,4 +202,4 @@ void add_internal_call(const char *p_name, R (*p_func)(P...)) {
#define GD_MONO_ASSERT_THREAD_ATTACHED ((void)0)
#endif
-#endif // GD_MONOUTILS_H
+#endif // GD_MONO_UTILS_H
diff --git a/modules/mono/utils/macos_utils.h b/modules/mono/utils/macos_utils.h
index 7892cb2785..ca4957f5a7 100644
--- a/modules/mono/utils/macos_utils.h
+++ b/modules/mono/utils/macos_utils.h
@@ -30,8 +30,8 @@
#include "core/string/ustring.h"
-#ifndef MACOS_UTILS_H
-#define MACOS_UTILS_H
+#ifndef MONO_MACOS_UTILS_H
+#define MONO_MACOS_UTILS_H
#ifdef MACOS_ENABLED
@@ -39,4 +39,4 @@ bool macos_is_app_bundle_installed(const String &p_bundle_id);
#endif
-#endif // MACOS_UTILS_H
+#endif // MONO_MACOS_UTILS_H
diff --git a/modules/mono/utils/macros.h b/modules/mono/utils/macros.h
index 2ca1a4cbf1..b7bd9a2495 100644
--- a/modules/mono/utils/macros.h
+++ b/modules/mono/utils/macros.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef UTIL_MACROS_H
-#define UTIL_MACROS_H
+#ifndef MONO_MACROS_H
+#define MONO_MACROS_H
#define _GD_VARNAME_CONCAT_B_(m_ignore, m_name) m_name
#define _GD_VARNAME_CONCAT_A_(m_a, m_b, m_c) _GD_VARNAME_CONCAT_B_(hello there, m_a##m_b##m_c)
@@ -69,4 +69,4 @@ public:
#define SCOPE_EXIT \
auto GD_UNIQUE_NAME(gd_scope_exit) = gdmono::ScopeExitAux() + [=]() -> void
-#endif // UTIL_MACROS_H
+#endif // MONO_MACROS_H
diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h
index a8cd8daf04..9a2c757361 100644
--- a/modules/mono/utils/path_utils.h
+++ b/modules/mono/utils/path_utils.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef PATH_UTILS_H
-#define PATH_UTILS_H
+#ifndef MONO_PATH_UTILS_H
+#define MONO_PATH_UTILS_H
#include "core/string/string_builder.h"
#include "core/string/ustring.h"
@@ -58,4 +58,4 @@ String realpath(const String &p_path);
String relative_to(const String &p_path, const String &p_relative_to);
} // namespace path
-#endif // PATH_UTILS_H
+#endif // MONO_PATH_UTILS_H
diff --git a/modules/mono/utils/string_utils.h b/modules/mono/utils/string_utils.h
index d79888716a..fa4c5e89f4 100644
--- a/modules/mono/utils/string_utils.h
+++ b/modules/mono/utils/string_utils.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef STRING_FORMAT_H
-#define STRING_FORMAT_H
+#ifndef MONO_STRING_UTILS_H
+#define MONO_STRING_UTILS_H
#include "core/string/ustring.h"
#include "core/variant/variant.h"
@@ -59,4 +59,4 @@ String str_format(const char *p_format, va_list p_list) _PRINTF_FORMAT_ATTRIBUTE
char *str_format_new(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_1_2;
char *str_format_new(const char *p_format, va_list p_list) _PRINTF_FORMAT_ATTRIBUTE_1_0;
-#endif // STRING_FORMAT_H
+#endif // MONO_STRING_UTILS_H
diff --git a/modules/navigation/nav_map.cpp b/modules/navigation/nav_map.cpp
index 17d6e0a0a1..46daa54239 100644
--- a/modules/navigation/nav_map.cpp
+++ b/modules/navigation/nav_map.cpp
@@ -30,9 +30,9 @@
#include "nav_map.h"
+#include "core/object/worker_thread_pool.h"
#include "nav_region.h"
#include "rvo_agent.h"
-
#include <algorithm>
#define THREE_POINTS_CROSS_PRODUCT(m_a, m_b, m_c) (((m_c) - (m_a)).cross((m_b) - (m_a)))
@@ -683,14 +683,8 @@ void NavMap::compute_single_step(uint32_t index, RvoAgent **agent) {
void NavMap::step(real_t p_deltatime) {
deltatime = p_deltatime;
if (controlled_agents.size() > 0) {
- if (step_work_pool.get_thread_count() == 0) {
- step_work_pool.init();
- }
- step_work_pool.do_work(
- controlled_agents.size(),
- this,
- &NavMap::compute_single_step,
- controlled_agents.data());
+ WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &NavMap::compute_single_step, controlled_agents.data(), controlled_agents.size(), -1, true, SNAME("NavigationMapAgents"));
+ WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);
}
}
@@ -736,5 +730,4 @@ NavMap::NavMap() {
}
NavMap::~NavMap() {
- step_work_pool.finish();
}
diff --git a/modules/navigation/nav_map.h b/modules/navigation/nav_map.h
index 2036dbecd7..98a5c24b3e 100644
--- a/modules/navigation/nav_map.h
+++ b/modules/navigation/nav_map.h
@@ -34,8 +34,8 @@
#include "nav_rid.h"
#include "core/math/math_defs.h"
+#include "core/object/worker_thread_pool.h"
#include "core/templates/rb_map.h"
-#include "core/templates/thread_work_pool.h"
#include "nav_utils.h"
#include <KdTree.h>
@@ -81,9 +81,6 @@ class NavMap : public NavRid {
/// Change the id each time the map is updated.
uint32_t map_update_id = 0;
- /// Pooled threads for computing steps
- ThreadWorkPool step_work_pool;
-
public:
NavMap();
~NavMap();
diff --git a/modules/ogg/ogg_packet_sequence.cpp b/modules/ogg/ogg_packet_sequence.cpp
index da52ecfdd5..e18fa9e590 100644
--- a/modules/ogg/ogg_packet_sequence.cpp
+++ b/modules/ogg/ogg_packet_sequence.cpp
@@ -106,7 +106,7 @@ float OGGPacketSequence::get_length() const {
return granule_pos / sampling_rate;
}
-Ref<OGGPacketSequencePlayback> OGGPacketSequence::instance_playback() {
+Ref<OGGPacketSequencePlayback> OGGPacketSequence::instantiate_playback() {
Ref<OGGPacketSequencePlayback> playback;
playback.instantiate();
playback->ogg_packet_sequence = Ref<OGGPacketSequence>(this);
diff --git a/modules/ogg/ogg_packet_sequence.h b/modules/ogg/ogg_packet_sequence.h
index 73e3cb4fff..76b673c6ac 100644
--- a/modules/ogg/ogg_packet_sequence.h
+++ b/modules/ogg/ogg_packet_sequence.h
@@ -86,7 +86,7 @@ public:
// Returns the granule position of the last page in this sequence.
int64_t get_final_granule_pos() const;
- Ref<OGGPacketSequencePlayback> instance_playback();
+ Ref<OGGPacketSequencePlayback> instantiate_playback();
OGGPacketSequence() {}
virtual ~OGGPacketSequence() {}
diff --git a/modules/openxr/action_map/openxr_action.h b/modules/openxr/action_map/openxr_action.h
index 5e57f89133..a7c1c9988c 100644
--- a/modules/openxr/action_map/openxr_action.h
+++ b/modules/openxr/action_map/openxr_action.h
@@ -84,4 +84,4 @@ public:
VARIANT_ENUM_CAST(OpenXRAction::ActionType);
-#endif // !OPENXR_ACTION_H
+#endif // OPENXR_ACTION_H
diff --git a/modules/openxr/action_map/openxr_action_map.h b/modules/openxr/action_map/openxr_action_map.h
index dcd8fc71aa..8659cd3942 100644
--- a/modules/openxr/action_map/openxr_action_map.h
+++ b/modules/openxr/action_map/openxr_action_map.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef OPENXR_ACTION_SETS_H
-#define OPENXR_ACTION_SETS_H
+#ifndef OPENXR_ACTION_MAP_H
+#define OPENXR_ACTION_MAP_H
#include "core/io/resource.h"
@@ -79,4 +79,4 @@ public:
~OpenXRActionMap();
};
-#endif // !OPENXR_ACTION_SETS_H
+#endif // OPENXR_ACTION_MAP_H
diff --git a/modules/openxr/action_map/openxr_action_set.h b/modules/openxr/action_map/openxr_action_set.h
index b1d7168894..2ef7ba4c32 100644
--- a/modules/openxr/action_map/openxr_action_set.h
+++ b/modules/openxr/action_map/openxr_action_set.h
@@ -72,4 +72,4 @@ public:
~OpenXRActionSet();
};
-#endif // !OPENXR_ACTION_SET_H
+#endif // OPENXR_ACTION_SET_H
diff --git a/modules/openxr/action_map/openxr_defs.h b/modules/openxr/action_map/openxr_defs.h
index 9bdd9a6ded..446e6eb9c6 100644
--- a/modules/openxr/action_map/openxr_defs.h
+++ b/modules/openxr/action_map/openxr_defs.h
@@ -121,4 +121,4 @@ public:
static PackedStringArray get_interaction_profile_paths();
};
-#endif // !OPENXR_DEFS_H
+#endif // OPENXR_DEFS_H
diff --git a/modules/openxr/action_map/openxr_interaction_profile.cpp b/modules/openxr/action_map/openxr_interaction_profile.cpp
index 342c36cdff..99d7a17acf 100644
--- a/modules/openxr/action_map/openxr_interaction_profile.cpp
+++ b/modules/openxr/action_map/openxr_interaction_profile.cpp
@@ -40,7 +40,7 @@ void OpenXRIPBinding::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_paths"), &OpenXRIPBinding::get_paths);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "paths", PROPERTY_HINT_ARRAY_TYPE, "STRING"), "set_paths", "get_paths");
- ClassDB::bind_method(D_METHOD("has_path"), &OpenXRIPBinding::has_path);
+ ClassDB::bind_method(D_METHOD("has_path", "path"), &OpenXRIPBinding::has_path);
ClassDB::bind_method(D_METHOD("add_path", "path"), &OpenXRIPBinding::add_path);
ClassDB::bind_method(D_METHOD("remove_path", "path"), &OpenXRIPBinding::remove_path);
}
diff --git a/modules/openxr/action_map/openxr_interaction_profile.h b/modules/openxr/action_map/openxr_interaction_profile.h
index 46b1bda50f..c77fd490bb 100644
--- a/modules/openxr/action_map/openxr_interaction_profile.h
+++ b/modules/openxr/action_map/openxr_interaction_profile.h
@@ -98,4 +98,4 @@ public:
~OpenXRInteractionProfile();
};
-#endif // !OPENXR_INTERACTION_PROFILE_H
+#endif // OPENXR_INTERACTION_PROFILE_H
diff --git a/modules/openxr/doc_classes/OpenXRIPBinding.xml b/modules/openxr/doc_classes/OpenXRIPBinding.xml
index 9e1176874a..f96637f2f5 100644
--- a/modules/openxr/doc_classes/OpenXRIPBinding.xml
+++ b/modules/openxr/doc_classes/OpenXRIPBinding.xml
@@ -24,7 +24,7 @@
</method>
<method name="has_path" qualifiers="const">
<return type="bool" />
- <argument index="0" name="arg0" type="String" />
+ <argument index="0" name="path" type="String" />
<description>
Returns [code]true[/code] if this input/output path is part of this binding.
</description>
diff --git a/modules/openxr/doc_classes/OpenXRInterface.xml b/modules/openxr/doc_classes/OpenXRInterface.xml
index 74f708bc95..25bf496de9 100644
--- a/modules/openxr/doc_classes/OpenXRInterface.xml
+++ b/modules/openxr/doc_classes/OpenXRInterface.xml
@@ -5,10 +5,10 @@
</brief_description>
<description>
The OpenXR interface allows Godot to interact with OpenXR runtimes and make it possible to create XR experiences and games.
- Due to the needs of OpenXR this interface works slightly different then other plugin based XR interfaces. It needs to be initialised when Godot starts. You need to enable OpenXR, settings for this can be found in your games project settings under the XR heading. You do need to mark a viewport for use with XR in order for Godot to know which render result should be output to the headset.
+ Due to the needs of OpenXR this interface works slightly different than other plugin based XR interfaces. It needs to be initialised when Godot starts. You need to enable OpenXR, settings for this can be found in your games project settings under the XR heading. You do need to mark a viewport for use with XR in order for Godot to know which render result should be output to the headset.
</description>
<tutorials>
- <link title="OpenXR documentation">$DOCS_URL/tutorials/vr/openxr/index.html</link>
+ <link title="Setting up XR">$DOCS_URL/tutorials/xr/setting_up_xr.html</link>
</tutorials>
<signals>
<signal name="pose_recentered">
diff --git a/modules/openxr/editor/openxr_action_editor.h b/modules/openxr/editor/openxr_action_editor.h
index 6e1b7ab779..6cf098cf08 100644
--- a/modules/openxr/editor/openxr_action_editor.h
+++ b/modules/openxr/editor/openxr_action_editor.h
@@ -64,4 +64,4 @@ public:
OpenXRActionEditor(Ref<OpenXRAction> p_action);
};
-#endif // !OPENXR_ACTION_EDITOR_H
+#endif // OPENXR_ACTION_EDITOR_H
diff --git a/modules/openxr/editor/openxr_action_map_editor.h b/modules/openxr/editor/openxr_action_map_editor.h
index dfc941b500..a19bc90f56 100644
--- a/modules/openxr/editor/openxr_action_map_editor.h
+++ b/modules/openxr/editor/openxr_action_map_editor.h
@@ -97,4 +97,4 @@ public:
~OpenXRActionMapEditor();
};
-#endif // !OPENXR_ACTION_MAP_EDITOR_H
+#endif // OPENXR_ACTION_MAP_EDITOR_H
diff --git a/modules/openxr/editor/openxr_action_set_editor.h b/modules/openxr/editor/openxr_action_set_editor.h
index f3960dcbf9..d8c85d03dd 100644
--- a/modules/openxr/editor/openxr_action_set_editor.h
+++ b/modules/openxr/editor/openxr_action_set_editor.h
@@ -85,4 +85,4 @@ public:
OpenXRActionSetEditor(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRActionSet> p_action_set);
};
-#endif // !OPENXR_ACTION_SET_EDITOR_H
+#endif // OPENXR_ACTION_SET_EDITOR_H
diff --git a/modules/openxr/editor/openxr_editor_plugin.h b/modules/openxr/editor/openxr_editor_plugin.h
index af8ee7d54c..ce230ee95b 100644
--- a/modules/openxr/editor/openxr_editor_plugin.h
+++ b/modules/openxr/editor/openxr_editor_plugin.h
@@ -50,4 +50,4 @@ public:
~OpenXREditorPlugin();
};
-#endif // !OPENXR_EDITOR_PLUGIN_H
+#endif // OPENXR_EDITOR_PLUGIN_H
diff --git a/modules/openxr/editor/openxr_interaction_profile_editor.h b/modules/openxr/editor/openxr_interaction_profile_editor.h
index f50da1a003..20a37a80eb 100644
--- a/modules/openxr/editor/openxr_interaction_profile_editor.h
+++ b/modules/openxr/editor/openxr_interaction_profile_editor.h
@@ -80,4 +80,4 @@ public:
OpenXRInteractionProfileEditor(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRInteractionProfile> p_interaction_profile);
};
-#endif // !OPENXR_INTERACTION_PROFILE_EDITOR_H
+#endif // OPENXR_INTERACTION_PROFILE_EDITOR_H
diff --git a/modules/openxr/editor/openxr_select_action_dialog.h b/modules/openxr/editor/openxr_select_action_dialog.h
index ea2c30373b..cbe1380e18 100644
--- a/modules/openxr/editor/openxr_select_action_dialog.h
+++ b/modules/openxr/editor/openxr_select_action_dialog.h
@@ -64,4 +64,4 @@ public:
OpenXRSelectActionDialog(Ref<OpenXRActionMap> p_action_map);
};
-#endif // !OPENXR_SELECT_ACTION_DIALOG_H
+#endif // OPENXR_SELECT_ACTION_DIALOG_H
diff --git a/modules/openxr/editor/openxr_select_interaction_profile_dialog.h b/modules/openxr/editor/openxr_select_interaction_profile_dialog.h
index d177861ff3..54bfe3120a 100644
--- a/modules/openxr/editor/openxr_select_interaction_profile_dialog.h
+++ b/modules/openxr/editor/openxr_select_interaction_profile_dialog.h
@@ -63,4 +63,4 @@ public:
OpenXRSelectInteractionProfileDialog();
};
-#endif // !OPENXR_SELECT_INTERACTION_PROFILE_DIALOG_H
+#endif // OPENXR_SELECT_INTERACTION_PROFILE_DIALOG_H
diff --git a/modules/openxr/extensions/openxr_android_extension.h b/modules/openxr/extensions/openxr_android_extension.h
index e102197a55..88b0e310e7 100644
--- a/modules/openxr/extensions/openxr_android_extension.h
+++ b/modules/openxr/extensions/openxr_android_extension.h
@@ -44,4 +44,4 @@ private:
static OpenXRAndroidExtension *singleton;
};
-#endif // !OPENXR_ANDROID_EXTENSION_H
+#endif // OPENXR_ANDROID_EXTENSION_H
diff --git a/modules/openxr/extensions/openxr_extension_wrapper.h b/modules/openxr/extensions/openxr_extension_wrapper.h
index 0f7c0ba0bc..ecc6e0dd4e 100644
--- a/modules/openxr/extensions/openxr_extension_wrapper.h
+++ b/modules/openxr/extensions/openxr_extension_wrapper.h
@@ -32,7 +32,7 @@
#define OPENXR_EXTENSION_WRAPPER_H
#include "core/error/error_macros.h"
-#include "core/math/camera_matrix.h"
+#include "core/math/projection.h"
#include "core/templates/hash_map.h"
#include "core/templates/rid.h"
@@ -97,11 +97,11 @@ public:
virtual String get_swapchain_format_name(int64_t p_swapchain_format) const = 0;
virtual bool get_swapchain_image_data(XrSwapchain p_swapchain, int64_t p_swapchain_format, uint32_t p_width, uint32_t p_height, uint32_t p_sample_count, uint32_t p_array_size, void **r_swapchain_graphics_data) = 0;
virtual void cleanup_swapchain_graphics_data(void **p_swapchain_graphics_data) = 0;
- virtual bool create_projection_fov(const XrFovf p_fov, double p_z_near, double p_z_far, CameraMatrix &r_camera_matrix) = 0;
+ virtual bool create_projection_fov(const XrFovf p_fov, double p_z_near, double p_z_far, Projection &r_camera_matrix) = 0;
virtual bool copy_render_target_to_image(RID p_from_render_target, void *p_swapchain_graphics_data, int p_image_index) = 0;
OpenXRGraphicsExtensionWrapper(OpenXRAPI *p_openxr_api) :
OpenXRExtensionWrapper(p_openxr_api){};
};
-#endif // ~OPENXR_EXTENSION_WRAPPER_H
+#endif // OPENXR_EXTENSION_WRAPPER_H
diff --git a/modules/openxr/extensions/openxr_htc_vive_tracker_extension.h b/modules/openxr/extensions/openxr_htc_vive_tracker_extension.h
index 7670bc074b..7f37351f27 100644
--- a/modules/openxr/extensions/openxr_htc_vive_tracker_extension.h
+++ b/modules/openxr/extensions/openxr_htc_vive_tracker_extension.h
@@ -49,4 +49,4 @@ private:
bool available = false;
};
-#endif // !OPENXR_HTC_VIVE_TRACKER_EXTENSION_H
+#endif // OPENXR_HTC_VIVE_TRACKER_EXTENSION_H
diff --git a/modules/openxr/extensions/openxr_vulkan_extension.cpp b/modules/openxr/extensions/openxr_vulkan_extension.cpp
index 3d3d4de5b6..2608c4ac17 100644
--- a/modules/openxr/extensions/openxr_vulkan_extension.cpp
+++ b/modules/openxr/extensions/openxr_vulkan_extension.cpp
@@ -420,7 +420,7 @@ bool OpenXRVulkanExtension::get_swapchain_image_data(XrSwapchain p_swapchain, in
return true;
}
-bool OpenXRVulkanExtension::create_projection_fov(const XrFovf p_fov, double p_z_near, double p_z_far, CameraMatrix &r_camera_matrix) {
+bool OpenXRVulkanExtension::create_projection_fov(const XrFovf p_fov, double p_z_near, double p_z_far, Projection &r_camera_matrix) {
// Even though this is a Vulkan renderer we're using OpenGL coordinate systems
XrMatrix4x4f matrix;
XrMatrix4x4f_CreateProjectionFov(&matrix, GRAPHICS_OPENGL, p_fov, (float)p_z_near, (float)p_z_far);
diff --git a/modules/openxr/extensions/openxr_vulkan_extension.h b/modules/openxr/extensions/openxr_vulkan_extension.h
index 1e34fe1f80..5dddc4b9c9 100644
--- a/modules/openxr/extensions/openxr_vulkan_extension.h
+++ b/modules/openxr/extensions/openxr_vulkan_extension.h
@@ -63,7 +63,7 @@ public:
virtual String get_swapchain_format_name(int64_t p_swapchain_format) const override;
virtual bool get_swapchain_image_data(XrSwapchain p_swapchain, int64_t p_swapchain_format, uint32_t p_width, uint32_t p_height, uint32_t p_sample_count, uint32_t p_array_size, void **r_swapchain_graphics_data) override;
virtual void cleanup_swapchain_graphics_data(void **p_swapchain_graphics_data) override;
- virtual bool create_projection_fov(const XrFovf p_fov, double p_z_near, double p_z_far, CameraMatrix &r_camera_matrix) override;
+ virtual bool create_projection_fov(const XrFovf p_fov, double p_z_near, double p_z_far, Projection &r_camera_matrix) override;
virtual bool copy_render_target_to_image(RID p_from_render_target, void *p_swapchain_graphics_data, int p_image_index) override;
private:
@@ -90,4 +90,4 @@ private:
XrResult xrCreateVulkanDeviceKHR(XrInstance p_instance, const XrVulkanDeviceCreateInfoKHR *p_create_info, VkDevice *r_device, VkResult *r_result);
};
-#endif // !OPENXR_VULKAN_EXTENSION_H
+#endif // OPENXR_VULKAN_EXTENSION_H
diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp
index 5e35942012..938b017e3a 100644
--- a/modules/openxr/openxr_api.cpp
+++ b/modules/openxr/openxr_api.cpp
@@ -1180,7 +1180,7 @@ bool OpenXRAPI::get_view_transform(uint32_t p_view, Transform3D &r_transform) {
return true;
}
-bool OpenXRAPI::get_view_projection(uint32_t p_view, double p_z_near, double p_z_far, CameraMatrix &p_camera_matrix) {
+bool OpenXRAPI::get_view_projection(uint32_t p_view, double p_z_near, double p_z_far, Projection &p_camera_matrix) {
ERR_FAIL_COND_V(!running, false);
ERR_FAIL_NULL_V(graphics_extension, false);
diff --git a/modules/openxr/openxr_api.h b/modules/openxr/openxr_api.h
index fe9e2937b2..dc224c4237 100644
--- a/modules/openxr/openxr_api.h
+++ b/modules/openxr/openxr_api.h
@@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef OPENXR_DRIVER_H
-#define OPENXR_DRIVER_H
+#ifndef OPENXR_API_H
+#define OPENXR_API_H
#include "core/error/error_macros.h"
-#include "core/math/camera_matrix.h"
+#include "core/math/projection.h"
#include "core/math/transform_3d.h"
#include "core/math/vector2.h"
#include "core/os/memory.h"
@@ -249,7 +249,7 @@ public:
Size2 get_recommended_target_size();
XRPose::TrackingConfidence get_head_center(Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity);
bool get_view_transform(uint32_t p_view, Transform3D &r_transform);
- bool get_view_projection(uint32_t p_view, double p_z_near, double p_z_far, CameraMatrix &p_camera_matrix);
+ bool get_view_projection(uint32_t p_view, double p_z_near, double p_z_far, Projection &p_camera_matrix);
bool process();
void pre_render();
@@ -292,4 +292,4 @@ public:
~OpenXRAPI();
};
-#endif // !OPENXR_DRIVER_H
+#endif // OPENXR_API_H
diff --git a/modules/openxr/openxr_interface.cpp b/modules/openxr/openxr_interface.cpp
index 9dfa005600..1447be5c77 100644
--- a/modules/openxr/openxr_interface.cpp
+++ b/modules/openxr/openxr_interface.cpp
@@ -631,8 +631,8 @@ Transform3D OpenXRInterface::get_transform_for_view(uint32_t p_view, const Trans
return p_cam_transform * xr_server->get_reference_frame() * t;
}
-CameraMatrix OpenXRInterface::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
- CameraMatrix cm;
+Projection OpenXRInterface::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
+ Projection cm;
if (openxr_api) {
if (openxr_api->get_view_projection(p_view, p_z_near, p_z_far, cm)) {
diff --git a/modules/openxr/openxr_interface.h b/modules/openxr/openxr_interface.h
index a223acfed0..a99012fd1d 100644
--- a/modules/openxr/openxr_interface.h
+++ b/modules/openxr/openxr_interface.h
@@ -121,7 +121,7 @@ public:
virtual uint32_t get_view_count() override;
virtual Transform3D get_camera_transform() override;
virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override;
- virtual CameraMatrix get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override;
+ virtual Projection get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override;
virtual void process() override;
virtual void pre_render() override;
@@ -140,4 +140,4 @@ public:
~OpenXRInterface();
};
-#endif // !OPENXR_INTERFACE_H
+#endif // OPENXR_INTERFACE_H
diff --git a/modules/openxr/openxr_util.h b/modules/openxr/openxr_util.h
index 4371b74d2f..a5cc7cd512 100644
--- a/modules/openxr/openxr_util.h
+++ b/modules/openxr/openxr_util.h
@@ -44,4 +44,4 @@ public:
static String make_xr_version_string(XrVersion p_version);
};
-#endif // !OPENXR_UTIL_H
+#endif // OPENXR_UTIL_H
diff --git a/modules/raycast/lightmap_raycaster.h b/modules/raycast/lightmap_raycaster.h
index 4266b46ea8..2e9f59dda4 100644
--- a/modules/raycast/lightmap_raycaster.h
+++ b/modules/raycast/lightmap_raycaster.h
@@ -74,4 +74,4 @@ public:
~LightmapRaycasterEmbree();
};
-#endif
+#endif // LIGHTMAP_RAYCASTER_H
diff --git a/modules/raycast/raycast_occlusion_cull.cpp b/modules/raycast/raycast_occlusion_cull.cpp
index 89e75f774e..13824c3830 100644
--- a/modules/raycast/raycast_occlusion_cull.cpp
+++ b/modules/raycast/raycast_occlusion_cull.cpp
@@ -30,6 +30,7 @@
#include "raycast_occlusion_cull.h"
#include "core/config/project_settings.h"
+#include "core/object/worker_thread_pool.h"
#include "core/templates/local_vector.h"
#ifdef __SSE2__
@@ -78,9 +79,9 @@ void RaycastOcclusionCull::RaycastHZBuffer::resize(const Size2i &p_size) {
memset(camera_ray_masks.ptr(), ~0, camera_rays_tile_count * TILE_RAYS * sizeof(uint32_t));
}
-void RaycastOcclusionCull::RaycastHZBuffer::update_camera_rays(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_work_pool) {
+void RaycastOcclusionCull::RaycastHZBuffer::update_camera_rays(const Transform3D &p_cam_transform, const Projection &p_cam_projection, bool p_cam_orthogonal) {
CameraRayThreadData td;
- td.thread_count = p_thread_work_pool.get_thread_count();
+ td.thread_count = WorkerThreadPool::get_singleton()->get_thread_count();
td.z_near = p_cam_projection.get_z_near();
td.z_far = p_cam_projection.get_z_far() * 1.05f;
@@ -88,7 +89,7 @@ void RaycastOcclusionCull::RaycastHZBuffer::update_camera_rays(const Transform3D
td.camera_dir = -p_cam_transform.basis.get_column(2);
td.camera_orthogonal = p_cam_orthogonal;
- CameraMatrix inv_camera_matrix = p_cam_projection.inverse();
+ Projection inv_camera_matrix = p_cam_projection.inverse();
Vector3 camera_corner_proj = Vector3(-1.0f, -1.0f, -1.0f);
Vector3 camera_corner_view = inv_camera_matrix.xform(camera_corner_proj);
td.pixel_corner = p_cam_transform.xform(camera_corner_view);
@@ -106,7 +107,8 @@ void RaycastOcclusionCull::RaycastHZBuffer::update_camera_rays(const Transform3D
debug_tex_range = td.z_far;
- p_thread_work_pool.do_work(td.thread_count, this, &RaycastHZBuffer::_camera_rays_threaded, &td);
+ WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &RaycastHZBuffer::_camera_rays_threaded, &td, td.thread_count, -1, true, SNAME("RaycastOcclusionCullUpdateCamera"));
+ WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);
}
void RaycastOcclusionCull::RaycastHZBuffer::_camera_rays_threaded(uint32_t p_thread, const CameraRayThreadData *p_data) {
@@ -331,10 +333,10 @@ void RaycastOcclusionCull::scenario_remove_instance(RID p_scenario, RID p_instan
}
void RaycastOcclusionCull::Scenario::_update_dirty_instance_thread(int p_idx, RID *p_instances) {
- _update_dirty_instance(p_idx, p_instances, nullptr);
+ _update_dirty_instance(p_idx, p_instances);
}
-void RaycastOcclusionCull::Scenario::_update_dirty_instance(int p_idx, RID *p_instances, ThreadWorkPool *p_thread_pool) {
+void RaycastOcclusionCull::Scenario::_update_dirty_instance(int p_idx, RID *p_instances) {
OccluderInstance *occ_inst = instances.getptr(p_instances[p_idx]);
if (!occ_inst) {
@@ -355,14 +357,16 @@ void RaycastOcclusionCull::Scenario::_update_dirty_instance(int p_idx, RID *p_in
const Vector3 *read_ptr = occ->vertices.ptr();
Vector3 *write_ptr = occ_inst->xformed_vertices.ptr();
- if (p_thread_pool && vertices_size > 1024) {
+ if (vertices_size > 1024) {
TransformThreadData td;
td.xform = occ_inst->xform;
td.read = read_ptr;
td.write = write_ptr;
td.vertex_count = vertices_size;
- td.thread_count = p_thread_pool->get_thread_count();
- p_thread_pool->do_work(td.thread_count, this, &Scenario::_transform_vertices_thread, &td);
+ td.thread_count = WorkerThreadPool::get_singleton()->get_thread_count();
+ WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &Scenario::_transform_vertices_thread, &td, td.thread_count, -1, true, SNAME("RaycastOcclusionCull"));
+ WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);
+
} else {
_transform_vertices_range(read_ptr, write_ptr, occ_inst->xform, 0, vertices_size);
}
@@ -392,7 +396,7 @@ void RaycastOcclusionCull::Scenario::_commit_scene(void *p_ud) {
scenario->commit_done = true;
}
-bool RaycastOcclusionCull::Scenario::update(ThreadWorkPool &p_thread_pool) {
+bool RaycastOcclusionCull::Scenario::update() {
ERR_FAIL_COND_V(singleton == nullptr, false);
if (commit_thread == nullptr) {
@@ -426,13 +430,15 @@ bool RaycastOcclusionCull::Scenario::update(ThreadWorkPool &p_thread_pool) {
instances.erase(removed_instances[i]);
}
- if (dirty_instances_array.size() / p_thread_pool.get_thread_count() > 128) {
+ if (dirty_instances_array.size() / WorkerThreadPool::get_singleton()->get_thread_count() > 128) {
// Lots of instances, use per-instance threading
- p_thread_pool.do_work(dirty_instances_array.size(), this, &Scenario::_update_dirty_instance_thread, dirty_instances_array.ptr());
+ WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &Scenario::_update_dirty_instance_thread, dirty_instances_array.ptr(), dirty_instances_array.size(), -1, true, SNAME("RaycastOcclusionCullUpdate"));
+ WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);
+
} else {
// Few instances, use threading on the vertex transforms
for (unsigned int i = 0; i < dirty_instances_array.size(); i++) {
- _update_dirty_instance(i, dirty_instances_array.ptr(), &p_thread_pool);
+ _update_dirty_instance(i, dirty_instances_array.ptr());
}
}
@@ -484,7 +490,7 @@ void RaycastOcclusionCull::Scenario::_raycast(uint32_t p_idx, const RaycastThrea
rtcIntersect16((const int *)&p_raycast_data->masks[p_idx * TILE_RAYS], ebr_scene[current_scene_idx], &ctx, &p_raycast_data->rays[p_idx]);
}
-void RaycastOcclusionCull::Scenario::raycast(CameraRayTile *r_rays, const uint32_t *p_valid_masks, uint32_t p_tile_count, ThreadWorkPool &p_thread_pool) const {
+void RaycastOcclusionCull::Scenario::raycast(CameraRayTile *r_rays, const uint32_t *p_valid_masks, uint32_t p_tile_count) const {
ERR_FAIL_COND(singleton == nullptr);
if (raycast_singleton->ebr_device == nullptr) {
return; // Embree is initialized on demand when there is some scenario with occluders in it.
@@ -498,7 +504,8 @@ void RaycastOcclusionCull::Scenario::raycast(CameraRayTile *r_rays, const uint32
td.rays = r_rays;
td.masks = p_valid_masks;
- p_thread_pool.do_work(p_tile_count, this, &Scenario::_raycast, &td);
+ WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &Scenario::_raycast, &td, p_tile_count, -1, true, SNAME("RaycastOcclusionCullRaycast"));
+ WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);
}
////////////////////////////////////////////////////////
@@ -524,7 +531,7 @@ void RaycastOcclusionCull::buffer_set_size(RID p_buffer, const Vector2i &p_size)
buffers[p_buffer].resize(p_size);
}
-void RaycastOcclusionCull::buffer_update(RID p_buffer, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_pool) {
+void RaycastOcclusionCull::buffer_update(RID p_buffer, const Transform3D &p_cam_transform, const Projection &p_cam_projection, bool p_cam_orthogonal) {
if (!buffers.has(p_buffer)) {
return;
}
@@ -537,16 +544,16 @@ void RaycastOcclusionCull::buffer_update(RID p_buffer, const Transform3D &p_cam_
Scenario &scenario = scenarios[buffer.scenario_rid];
- bool removed = scenario.update(p_thread_pool);
+ bool removed = scenario.update();
if (removed) {
scenarios.erase(buffer.scenario_rid);
return;
}
- buffer.update_camera_rays(p_cam_transform, p_cam_projection, p_cam_orthogonal, p_thread_pool);
+ buffer.update_camera_rays(p_cam_transform, p_cam_projection, p_cam_orthogonal);
- scenario.raycast(buffer.camera_rays, buffer.camera_ray_masks.ptr(), buffer.camera_rays_tile_count, p_thread_pool);
+ scenario.raycast(buffer.camera_rays, buffer.camera_ray_masks.ptr(), buffer.camera_rays_tile_count);
buffer.sort_rays(-p_cam_transform.basis.get_column(2), p_cam_orthogonal);
buffer.update_mips();
}
diff --git a/modules/raycast/raycast_occlusion_cull.h b/modules/raycast/raycast_occlusion_cull.h
index 6562c4e9c4..056b808640 100644
--- a/modules/raycast/raycast_occlusion_cull.h
+++ b/modules/raycast/raycast_occlusion_cull.h
@@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef OCCLUSION_CULL_RAYCASTER_H
-#define OCCLUSION_CULL_RAYCASTER_H
+#ifndef RAYCAST_OCCLUSION_CULL_H
+#define RAYCAST_OCCLUSION_CULL_H
#include "core/io/image.h"
-#include "core/math/camera_matrix.h"
+#include "core/math/projection.h"
#include "core/object/object.h"
#include "core/object/ref_counted.h"
#include "core/templates/local_vector.h"
@@ -76,7 +76,7 @@ public:
virtual void clear() override;
virtual void resize(const Size2i &p_size) override;
void sort_rays(const Vector3 &p_camera_dir, bool p_orthogonal);
- void update_camera_rays(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_work_pool);
+ void update_camera_rays(const Transform3D &p_cam_transform, const Projection &p_cam_projection, bool p_cam_orthogonal);
~RaycastHZBuffer();
};
@@ -143,14 +143,14 @@ private:
LocalVector<RID> removed_instances;
void _update_dirty_instance_thread(int p_idx, RID *p_instances);
- void _update_dirty_instance(int p_idx, RID *p_instances, ThreadWorkPool *p_thread_pool);
+ void _update_dirty_instance(int p_idx, RID *p_instances);
void _transform_vertices_thread(uint32_t p_thread, TransformThreadData *p_data);
void _transform_vertices_range(const Vector3 *p_read, Vector3 *p_write, const Transform3D &p_xform, int p_from, int p_to);
static void _commit_scene(void *p_ud);
- bool update(ThreadWorkPool &p_thread_pool);
+ bool update();
void _raycast(uint32_t p_thread, const RaycastThreadData *p_raycast_data) const;
- void raycast(CameraRayTile *r_rays, const uint32_t *p_valid_masks, uint32_t p_tile_count, ThreadWorkPool &p_thread_pool) const;
+ void raycast(CameraRayTile *r_rays, const uint32_t *p_valid_masks, uint32_t p_tile_count) const;
};
static RaycastOcclusionCull *raycast_singleton;
@@ -183,7 +183,8 @@ public:
virtual HZBuffer *buffer_get_ptr(RID p_buffer) override;
virtual void buffer_set_scenario(RID p_buffer, RID p_scenario) override;
virtual void buffer_set_size(RID p_buffer, const Vector2i &p_size) override;
- virtual void buffer_update(RID p_buffer, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_pool) override;
+ virtual void buffer_update(RID p_buffer, const Transform3D &p_cam_transform, const Projection &p_cam_projection, bool p_cam_orthogonal) override;
+
virtual RID buffer_get_debug_texture(RID p_buffer) override;
virtual void set_build_quality(RS::ViewportOcclusionCullingBuildQuality p_quality) override;
@@ -192,4 +193,4 @@ public:
~RaycastOcclusionCull();
};
-#endif // OCCLUSION_CULL_RAYCASTER_H
+#endif // RAYCAST_OCCLUSION_CULL_H
diff --git a/modules/raycast/static_raycaster.h b/modules/raycast/static_raycaster.h
index e2909f9b56..607a392683 100644
--- a/modules/raycast/static_raycaster.h
+++ b/modules/raycast/static_raycaster.h
@@ -61,4 +61,4 @@ public:
~StaticRaycasterEmbree();
};
-#endif
+#endif // STATIC_RAYCASTER_H
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp
index dcb1f1d744..87e2fae2d0 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -80,8 +80,8 @@ void ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, String p_strin
float fw, fh;
picture->size(&fw, &fh);
- uint32_t width = MIN(fw * p_scale, 16 * 1024);
- uint32_t height = MIN(fh * p_scale, 16 * 1024);
+ uint32_t width = MIN(round(fw * p_scale), 16 * 1024);
+ uint32_t height = MIN(round(fh * p_scale), 16 * 1024);
picture->size(width, height);
std::unique_ptr<tvg::SwCanvas> sw_canvas = tvg::SwCanvas::gen();
diff --git a/modules/text_server_adv/script_iterator.h b/modules/text_server_adv/script_iterator.h
index 2bd045b91a..025b62c6fb 100644
--- a/modules/text_server_adv/script_iterator.h
+++ b/modules/text_server_adv/script_iterator.h
@@ -75,4 +75,4 @@ public:
ScriptIterator(const String &p_string, int p_start, int p_length);
};
-#endif //SCRIPT_ITERATOR_H
+#endif // SCRIPT_ITERATOR_H
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index fe2279df69..fa234081f0 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "text_server_adv.h"
+#include "core/object/worker_thread_pool.h"
#ifdef GDEXTENSION
// Headers for building as GDExtension plug-in.
@@ -1039,10 +1040,8 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_msdf(
td.projection = &projection;
td.distancePixelConversion = &distancePixelConversion;
- if (p_font_data->work_pool.get_thread_count() == 0) {
- p_font_data->work_pool.init();
- }
- p_font_data->work_pool.do_work(h, this, &TextServerAdvanced::_generateMTSDF_threaded, &td);
+ WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &TextServerAdvanced::_generateMTSDF_threaded, &td, h, -1, true, SNAME("FontServerRasterizeMSDF"));
+ WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);
msdfgen::msdfErrorCorrection(image, shape, projection, p_pixel_range, config);
diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h
index a772955d90..8cd0e753ba 100644
--- a/modules/text_server_adv/text_server_adv.h
+++ b/modules/text_server_adv/text_server_adv.h
@@ -65,11 +65,12 @@
#include <godot_cpp/classes/image.hpp>
#include <godot_cpp/classes/image_texture.hpp>
#include <godot_cpp/classes/ref.hpp>
+#include <godot_cpp/classes/worker_thread_pool.hpp>
#include <godot_cpp/templates/hash_map.hpp>
#include <godot_cpp/templates/hash_set.hpp>
#include <godot_cpp/templates/rid_owner.hpp>
-#include <godot_cpp/templates/thread_work_pool.hpp>
+
#include <godot_cpp/templates/vector.hpp>
using namespace godot;
@@ -77,9 +78,9 @@ using namespace godot;
#else
// Headers for building as built-in module.
+#include "core/object/worker_thread_pool.h"
#include "core/templates/hash_map.h"
#include "core/templates/rid_owner.h"
-#include "core/templates/thread_work_pool.h"
#include "scene/resources/texture.h"
#include "servers/text/text_server_extension.h"
@@ -252,10 +253,8 @@ class TextServerAdvanced : public TextServerExtension {
const uint8_t *data_ptr;
size_t data_size;
int face_index = 0;
- mutable ThreadWorkPool work_pool;
~FontAdvanced() {
- work_pool.finish();
for (const KeyValue<Vector2i, FontForSizeAdvanced *> &E : cache) {
memdelete(E.value);
}
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index b845beb158..50ea4677b1 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -461,10 +461,8 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_msdf(
td.projection = &projection;
td.distancePixelConversion = &distancePixelConversion;
- if (p_font_data->work_pool.get_thread_count() == 0) {
- p_font_data->work_pool.init();
- }
- p_font_data->work_pool.do_work(h, this, &TextServerFallback::_generateMTSDF_threaded, &td);
+ WorkerThreadPool::GroupID group_id = WorkerThreadPool::get_singleton()->add_template_group_task(this, &TextServerFallback::_generateMTSDF_threaded, &td, h, -1, true, SNAME("TextServerFBRenderMSDF"));
+ WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_id);
msdfgen::msdfErrorCorrection(image, shape, projection, p_pixel_range, config);
diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h
index 497403afd7..adb5cbb817 100644
--- a/modules/text_server_fb/text_server_fb.h
+++ b/modules/text_server_fb/text_server_fb.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef TEXT_SERVER_FALLBACK_H
-#define TEXT_SERVER_FALLBACK_H
+#ifndef TEXT_SERVER_FB_H
+#define TEXT_SERVER_FB_H
/*************************************************************************/
/* Fallback Text Server provides simplified TS functionality, without */
@@ -79,9 +79,9 @@ using namespace godot;
#include "servers/text/text_server_extension.h"
+#include "core/object/worker_thread_pool.h"
#include "core/templates/hash_map.h"
#include "core/templates/rid_owner.h"
-#include "core/templates/thread_work_pool.h"
#include "scene/resources/texture.h"
#include "modules/modules_enabled.gen.h" // For freetype, msdfgen.
@@ -208,10 +208,7 @@ class TextServerFallback : public TextServerExtension {
size_t data_size;
int face_index = 0;
- mutable ThreadWorkPool work_pool;
-
~FontFallback() {
- work_pool.finish();
for (const KeyValue<Vector2i, FontForSizeFallback *> &E : cache) {
memdelete(E.value);
}
@@ -586,4 +583,4 @@ public:
~TextServerFallback();
};
-#endif // TEXT_SERVER_FALLBACK_H
+#endif // TEXT_SERVER_FB_H
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 8940ed6aff..00d799dc24 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -170,7 +170,7 @@ protected:
static void _bind_methods();
public:
- Ref<VideoStreamPlayback> instance_playback() override {
+ Ref<VideoStreamPlayback> instantiate_playback() override {
Ref<VideoStreamPlaybackTheora> pb = memnew(VideoStreamPlaybackTheora);
pb->set_audio_track(audio_track);
pb->set_file(file);
@@ -192,4 +192,4 @@ public:
virtual String get_resource_type(const String &p_path) const;
};
-#endif
+#endif // VIDEO_STREAM_THEORA_H
diff --git a/modules/tinyexr/image_loader_tinyexr.h b/modules/tinyexr/image_loader_tinyexr.h
index c147861c26..0d3de93956 100644
--- a/modules/tinyexr/image_loader_tinyexr.h
+++ b/modules/tinyexr/image_loader_tinyexr.h
@@ -40,4 +40,4 @@ public:
ImageLoaderTinyEXR();
};
-#endif
+#endif // IMAGE_LOADER_TINYEXR_H
diff --git a/modules/upnp/upnp.h b/modules/upnp/upnp.h
index 6d87b42c56..be7ede3ee0 100644
--- a/modules/upnp/upnp.h
+++ b/modules/upnp/upnp.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GODOT_UPNP_H
-#define GODOT_UPNP_H
+#ifndef UPNP_H
+#define UPNP_H
#include "core/object/ref_counted.h"
@@ -121,4 +121,4 @@ public:
VARIANT_ENUM_CAST(UPNP::UPNPResult)
-#endif // GODOT_UPNP_H
+#endif // UPNP_H
diff --git a/modules/upnp/upnp_device.h b/modules/upnp/upnp_device.h
index 18491dce27..1c9dc82df5 100644
--- a/modules/upnp/upnp_device.h
+++ b/modules/upnp/upnp_device.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GODOT_UPNP_DEVICE_H
-#define GODOT_UPNP_DEVICE_H
+#ifndef UPNP_DEVICE_H
+#define UPNP_DEVICE_H
#include "core/object/ref_counted.h"
@@ -90,4 +90,4 @@ private:
VARIANT_ENUM_CAST(UPNPDevice::IGDStatus)
-#endif // GODOT_UPNP_DEVICE_H
+#endif // UPNP_DEVICE_H
diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp
index 522ed8719b..74a61bc4b7 100644
--- a/modules/visual_script/editor/visual_script_editor.cpp
+++ b/modules/visual_script/editor/visual_script_editor.cpp
@@ -376,6 +376,12 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
case Variant::VECTOR3I:
color = Color(0.84, 0.49, 0.93);
break;
+ case Variant::VECTOR4:
+ color = Color(0.84, 0.49, 0.94);
+ break;
+ case Variant::VECTOR4I:
+ color = Color(0.84, 0.49, 0.94);
+ break;
case Variant::TRANSFORM2D:
color = Color(0.77, 0.93, 0.41);
break;
@@ -4821,12 +4827,15 @@ VisualScriptEditor::VisualScriptEditor() {
base_type_map.insert("Rect2i", Variant::RECT2I);
base_type_map.insert("Vector3", Variant::VECTOR3);
base_type_map.insert("Vector3i", Variant::VECTOR3I);
+ base_type_map.insert("Vector4", Variant::VECTOR4);
+ base_type_map.insert("Vector4i", Variant::VECTOR4I);
base_type_map.insert("Transform2D", Variant::TRANSFORM2D);
base_type_map.insert("Plane", Variant::PLANE);
base_type_map.insert("Quaternion", Variant::QUATERNION);
base_type_map.insert("AABB", Variant::AABB);
base_type_map.insert("Basis", Variant::BASIS);
base_type_map.insert("Transform3D", Variant::TRANSFORM3D);
+ base_type_map.insert("Projection", Variant::PROJECTION);
base_type_map.insert("Color", Variant::COLOR);
base_type_map.insert("NodePath", Variant::NODE_PATH);
base_type_map.insert("RID", Variant::RID);
diff --git a/modules/visual_script/editor/visual_script_editor.h b/modules/visual_script/editor/visual_script_editor.h
index fd59d22cbe..a6df7bba73 100644
--- a/modules/visual_script/editor/visual_script_editor.h
+++ b/modules/visual_script/editor/visual_script_editor.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef VISUALSCRIPT_EDITOR_H
-#define VISUALSCRIPT_EDITOR_H
+#ifndef VISUAL_SCRIPT_EDITOR_H
+#define VISUAL_SCRIPT_EDITOR_H
#include "../visual_script.h"
#include "editor/create_dialog.h"
@@ -374,4 +374,4 @@ public:
#endif
-#endif // VISUALSCRIPT_EDITOR_H
+#endif // VISUAL_SCRIPT_EDITOR_H
diff --git a/modules/visual_script/editor/visual_script_property_selector.h b/modules/visual_script/editor/visual_script_property_selector.h
index 91d81bba47..41f8eea735 100644
--- a/modules/visual_script/editor/visual_script_property_selector.h
+++ b/modules/visual_script/editor/visual_script_property_selector.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef VISUALSCRIPT_PROPERTYSELECTOR_H
-#define VISUALSCRIPT_PROPERTYSELECTOR_H
+#ifndef VISUAL_SCRIPT_PROPERTY_SELECTOR_H
+#define VISUAL_SCRIPT_PROPERTY_SELECTOR_H
#include "../visual_script.h"
#include "editor/editor_help.h"
@@ -226,4 +226,4 @@ public:
SearchRunner(VisualScriptPropertySelector *p_selector_ui, Tree *p_results_tree);
};
-#endif // VISUALSCRIPT_PROPERTYSELECTOR_H
+#endif // VISUAL_SCRIPT_PROPERTY_SELECTOR_H
diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h
index c93eb0686b..7e10f98f36 100644
--- a/modules/visual_script/visual_script_expression.h
+++ b/modules/visual_script/visual_script_expression.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef VISUALSCRIPTEXPRESSION_H
-#define VISUALSCRIPTEXPRESSION_H
+#ifndef VISUAL_SCRIPT_EXPRESSION_H
+#define VISUAL_SCRIPT_EXPRESSION_H
#include "visual_script.h"
#include "visual_script_builtin_funcs.h"
@@ -281,4 +281,4 @@ public:
void register_visual_script_expression_node();
-#endif // VISUALSCRIPTEXPRESSION_H
+#endif // VISUAL_SCRIPT_EXPRESSION_H
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 2dfc6da181..41f5b28677 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -4025,6 +4025,8 @@ void register_visual_script_nodes() {
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::VECTOR2I), create_node_deconst_typed<Variant::Type::VECTOR2I>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::VECTOR3), create_node_deconst_typed<Variant::Type::VECTOR3>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::VECTOR3I), create_node_deconst_typed<Variant::Type::VECTOR3I>);
+ VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::VECTOR4), create_node_deconst_typed<Variant::Type::VECTOR4>);
+ VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::VECTOR4I), create_node_deconst_typed<Variant::Type::VECTOR4I>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::COLOR), create_node_deconst_typed<Variant::Type::COLOR>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::RECT2), create_node_deconst_typed<Variant::Type::RECT2>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::RECT2I), create_node_deconst_typed<Variant::Type::RECT2I>);
@@ -4034,6 +4036,7 @@ void register_visual_script_nodes() {
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::AABB), create_node_deconst_typed<Variant::Type::AABB>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::BASIS), create_node_deconst_typed<Variant::Type::BASIS>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::TRANSFORM3D), create_node_deconst_typed<Variant::Type::TRANSFORM3D>);
+ VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::PROJECTION), create_node_deconst_typed<Variant::Type::PROJECTION>);
VisualScriptLanguage::singleton->add_register_func("functions/compose_array", create_node_generic<VisualScriptComposeArray>);
for (int i = 1; i < Variant::VARIANT_MAX; i++) {
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 89a6b03ff8..76f7317daa 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -43,28 +43,93 @@ int AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_fram
int todo = p_frames;
- int start_buffer = 0;
+ int beat_length_frames = -1;
+ bool beat_loop = vorbis_stream->has_loop();
+ if (beat_loop && vorbis_stream->get_bpm() > 0 && vorbis_stream->get_beat_count() > 0) {
+ beat_length_frames = vorbis_stream->get_beat_count() * vorbis_data->get_sampling_rate() * 60 / vorbis_stream->get_bpm();
+ }
while (todo > 0 && active) {
AudioFrame *buffer = p_buffer;
- if (start_buffer > 0) {
- buffer = buffer + start_buffer;
+ buffer += p_frames - todo;
+
+ int to_mix = todo;
+ if (beat_length_frames >= 0 && (beat_length_frames - (int)frames_mixed) < to_mix) {
+ to_mix = MAX(0, beat_length_frames - (int)frames_mixed);
}
- int mixed = _mix_frames_vorbis(buffer, todo);
+
+ int mixed = _mix_frames_vorbis(buffer, to_mix);
ERR_FAIL_COND_V(mixed < 0, 0);
todo -= mixed;
frames_mixed += mixed;
- start_buffer += mixed;
+
+ if (loop_fade_remaining < FADE_SIZE) {
+ int to_fade = loop_fade_remaining + MIN(FADE_SIZE - loop_fade_remaining, mixed);
+ for (int i = loop_fade_remaining; i < to_fade; i++) {
+ buffer[i - loop_fade_remaining] += loop_fade[i] * (float(FADE_SIZE - i) / float(FADE_SIZE));
+ }
+ loop_fade_remaining = to_fade;
+ }
+
+ if (beat_length_frames >= 0) {
+ /**
+ * Length determined by beat length
+ * This code is commented out because, in practice, it is prefered that the fade
+ * is done by the transitioner and this stream just goes on until it ends while fading out.
+ *
+ * End fade implementation is left here for reference in case at some point this feature
+ * is desired.
+
+ if (!beat_loop && (int)frames_mixed > beat_length_frames - FADE_SIZE) {
+ print_line("beat length fade/after mix?");
+ //No loop, just fade and finish
+ for (int i = 0; i < mixed; i++) {
+ int idx = frames_mixed + i - mixed;
+ buffer[i] *= 1.0 - float(MAX(0, (idx - (beat_length_frames - FADE_SIZE)))) / float(FADE_SIZE);
+ }
+ if ((int)frames_mixed == beat_length_frames) {
+ for (int i = p_frames - todo; i < p_frames; i++) {
+ p_buffer[i] = AudioFrame(0, 0);
+ }
+ active = false;
+ break;
+ }
+ } else
+ **/
+
+ if (beat_loop && beat_length_frames <= (int)frames_mixed) {
+ // End of file when doing beat-based looping. <= used instead of == because importer editing
+ if (!have_packets_left && !have_samples_left) {
+ //Nothing remaining, so do nothing.
+ loop_fade_remaining = FADE_SIZE;
+ } else {
+ // Add some loop fade;
+ int faded_mix = _mix_frames_vorbis(loop_fade, FADE_SIZE);
+
+ for (int i = faded_mix; i < FADE_SIZE; i++) {
+ // In case lesss was mixed, pad with zeros
+ loop_fade[i] = AudioFrame(0, 0);
+ }
+ loop_fade_remaining = 0;
+ }
+
+ seek(vorbis_stream->loop_offset);
+ loops++;
+ // We still have buffer to fill, start from this element in the next iteration.
+ continue;
+ }
+ }
+
if (!have_packets_left && !have_samples_left) {
- //end of file!
+ // Actual end of file!
bool is_not_empty = mixed > 0 || vorbis_stream->get_length() > 0;
if (vorbis_stream->loop && is_not_empty) {
//loop
seek(vorbis_stream->loop_offset);
loops++;
- // we still have buffer to fill, start from this element in the next iteration.
- start_buffer = p_frames - todo;
+ // We still have buffer to fill, start from this element in the next iteration.
+
} else {
for (int i = p_frames - todo; i < p_frames; i++) {
p_buffer[i] = AudioFrame(0, 0);
@@ -130,7 +195,7 @@ bool AudioStreamPlaybackOGGVorbis::_alloc_vorbis() {
comment_is_allocated = true;
ERR_FAIL_COND_V(vorbis_data.is_null(), false);
- vorbis_data_playback = vorbis_data->instance_playback();
+ vorbis_data_playback = vorbis_data->instantiate_playback();
ogg_packet *packet;
int err;
@@ -160,6 +225,7 @@ bool AudioStreamPlaybackOGGVorbis::_alloc_vorbis() {
void AudioStreamPlaybackOGGVorbis::start(float p_from_pos) {
ERR_FAIL_COND(!ready);
+ loop_fade_remaining = FADE_SIZE;
active = true;
seek(p_from_pos);
loops = 0;
@@ -182,6 +248,10 @@ float AudioStreamPlaybackOGGVorbis::get_playback_position() const {
return float(frames_mixed) / vorbis_data->get_sampling_rate();
}
+void AudioStreamPlaybackOGGVorbis::tag_used_streams() {
+ vorbis_stream->tag_used(get_playback_position());
+}
+
void AudioStreamPlaybackOGGVorbis::seek(float p_time) {
ERR_FAIL_COND(!ready);
ERR_FAIL_COND(vorbis_stream.is_null());
@@ -315,7 +385,7 @@ AudioStreamPlaybackOGGVorbis::~AudioStreamPlaybackOGGVorbis() {
}
}
-Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instance_playback() {
+Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instantiate_playback() {
Ref<AudioStreamPlaybackOGGVorbis> ovs;
ERR_FAIL_COND_V(packet_sequence.is_null(), nullptr);
@@ -347,7 +417,7 @@ void AudioStreamOGGVorbis::maybe_update_info() {
vorbis_info_init(&info);
vorbis_comment_init(&comment);
- Ref<OGGPacketSequencePlayback> packet_sequence_playback = packet_sequence->instance_playback();
+ Ref<OGGPacketSequencePlayback> packet_sequence_playback = packet_sequence->instantiate_playback();
for (int i = 0; i < 3; i++) {
ogg_packet *packet;
@@ -405,6 +475,36 @@ float AudioStreamOGGVorbis::get_length() const {
return packet_sequence->get_length();
}
+void AudioStreamOGGVorbis::set_bpm(double p_bpm) {
+ ERR_FAIL_COND(p_bpm < 0);
+ bpm = p_bpm;
+ emit_changed();
+}
+
+double AudioStreamOGGVorbis::get_bpm() const {
+ return bpm;
+}
+
+void AudioStreamOGGVorbis::set_beat_count(int p_beat_count) {
+ ERR_FAIL_COND(p_beat_count < 0);
+ beat_count = p_beat_count;
+ emit_changed();
+}
+
+int AudioStreamOGGVorbis::get_beat_count() const {
+ return beat_count;
+}
+
+void AudioStreamOGGVorbis::set_bar_beats(int p_bar_beats) {
+ ERR_FAIL_COND(p_bar_beats < 2);
+ bar_beats = p_bar_beats;
+ emit_changed();
+}
+
+int AudioStreamOGGVorbis::get_bar_beats() const {
+ return bar_beats;
+}
+
bool AudioStreamOGGVorbis::is_monophonic() const {
return false;
}
@@ -419,7 +519,19 @@ void AudioStreamOGGVorbis::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamOGGVorbis::set_loop_offset);
ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamOGGVorbis::get_loop_offset);
+ ClassDB::bind_method(D_METHOD("set_bpm", "bpm"), &AudioStreamOGGVorbis::set_bpm);
+ ClassDB::bind_method(D_METHOD("get_bpm"), &AudioStreamOGGVorbis::get_bpm);
+
+ ClassDB::bind_method(D_METHOD("set_beat_count", "count"), &AudioStreamOGGVorbis::set_beat_count);
+ ClassDB::bind_method(D_METHOD("get_beat_count"), &AudioStreamOGGVorbis::get_beat_count);
+
+ ClassDB::bind_method(D_METHOD("set_bar_beats", "count"), &AudioStreamOGGVorbis::set_bar_beats);
+ ClassDB::bind_method(D_METHOD("get_bar_beats"), &AudioStreamOGGVorbis::get_bar_beats);
+
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "packet_sequence", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_packet_sequence", "get_packet_sequence");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bpm", PROPERTY_HINT_RANGE, "0,400,0.01,or_greater"), "set_bpm", "get_bpm");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "beat_count", PROPERTY_HINT_RANGE, "0,512,1,or_greater"), "set_beat_count", "get_beat_count");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "bar_beats", PROPERTY_HINT_RANGE, "2,32,1,or_greater"), "set_bar_beats", "get_bar_beats");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "loop_offset"), "set_loop_offset", "get_loop_offset");
}
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index b09ef9ff5d..9b6d928d87 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef AUDIO_STREAM_LIBVORBIS_H
-#define AUDIO_STREAM_LIBVORBIS_H
+#ifndef AUDIO_STREAM_OGG_VORBIS_H
+#define AUDIO_STREAM_OGG_VORBIS_H
#include "core/variant/variant.h"
#include "modules/ogg/ogg_packet_sequence.h"
@@ -45,6 +45,12 @@ class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled {
bool active = false;
int loops = 0;
+ enum {
+ FADE_SIZE = 256
+ };
+ AudioFrame loop_fade[FADE_SIZE];
+ int loop_fade_remaining = FADE_SIZE;
+
vorbis_info info;
vorbis_comment comment;
vorbis_dsp_state dsp_state;
@@ -66,6 +72,7 @@ class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled {
Ref<OGGPacketSequencePlayback> vorbis_data_playback;
Ref<AudioStreamOGGVorbis> vorbis_stream;
+ int _mix_frames(AudioFrame *p_buffer, int p_frames);
int _mix_frames_vorbis(AudioFrame *p_buffer, int p_frames);
// Allocates vorbis data structures. Returns true upon success, false on failure.
@@ -85,6 +92,8 @@ public:
virtual float get_playback_position() const override;
virtual void seek(float p_time) override;
+ virtual void tag_used_streams() override;
+
AudioStreamPlaybackOGGVorbis() {}
~AudioStreamPlaybackOGGVorbis();
};
@@ -107,17 +116,30 @@ class AudioStreamOGGVorbis : public AudioStream {
Ref<OGGPacketSequence> packet_sequence;
+ double bpm = 0;
+ int beat_count = 0;
+ int bar_beats = 4;
+
protected:
static void _bind_methods();
public:
void set_loop(bool p_enable);
- bool has_loop() const;
+ virtual bool has_loop() const override;
void set_loop_offset(float p_seconds);
float get_loop_offset() const;
- virtual Ref<AudioStreamPlayback> instance_playback() override;
+ void set_bpm(double p_bpm);
+ virtual double get_bpm() const override;
+
+ void set_beat_count(int p_beat_count);
+ virtual int get_beat_count() const override;
+
+ void set_bar_beats(int p_bar_beats);
+ virtual int get_bar_beats() const override;
+
+ virtual Ref<AudioStreamPlayback> instantiate_playback() override;
virtual String get_stream_name() const override;
void set_packet_sequence(Ref<OGGPacketSequence> p_packet_sequence);
@@ -131,4 +153,4 @@ public:
virtual ~AudioStreamOGGVorbis();
};
-#endif // AUDIO_STREAM_LIBVORBIS_H
+#endif // AUDIO_STREAM_OGG_VORBIS_H
diff --git a/modules/vorbis/doc_classes/AudioStreamOGGVorbis.xml b/modules/vorbis/doc_classes/AudioStreamOGGVorbis.xml
index 2f210a6cb4..f87296dcd8 100644
--- a/modules/vorbis/doc_classes/AudioStreamOGGVorbis.xml
+++ b/modules/vorbis/doc_classes/AudioStreamOGGVorbis.xml
@@ -7,6 +7,12 @@
<tutorials>
</tutorials>
<members>
+ <member name="bar_beats" type="int" setter="set_bar_beats" getter="get_bar_beats" default="4">
+ </member>
+ <member name="beat_count" type="int" setter="set_beat_count" getter="get_beat_count" default="0">
+ </member>
+ <member name="bpm" type="float" setter="set_bpm" getter="get_bpm" default="0.0">
+ </member>
<member name="loop" type="bool" setter="set_loop" getter="has_loop" default="false">
If [code]true[/code], the stream will automatically loop when it reaches the end.
</member>
diff --git a/modules/vorbis/resource_importer_ogg_vorbis.cpp b/modules/vorbis/resource_importer_ogg_vorbis.cpp
index 7ee6446313..9461d531fd 100644
--- a/modules/vorbis/resource_importer_ogg_vorbis.cpp
+++ b/modules/vorbis/resource_importer_ogg_vorbis.cpp
@@ -30,13 +30,16 @@
#include "resource_importer_ogg_vorbis.h"
-#include "audio_stream_ogg_vorbis.h"
#include "core/io/file_access.h"
#include "core/io/resource_saver.h"
#include "scene/resources/texture.h"
#include "thirdparty/libogg/ogg/ogg.h"
#include "thirdparty/libvorbis/vorbis/codec.h"
+#ifdef TOOLS_ENABLED
+#include "editor/import/audio_stream_import_settings.h"
+#endif
+
String ResourceImporterOGGVorbis::get_importer_name() const {
return "oggvorbisstr";
}
@@ -72,14 +75,14 @@ String ResourceImporterOGGVorbis::get_preset_name(int p_idx) const {
void ResourceImporterOGGVorbis::get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const {
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "loop_offset"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "bpm", PROPERTY_HINT_RANGE, "0,400,0.01,or_greater"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "beat_count", PROPERTY_HINT_RANGE, "0,512,or_greater"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "bar_beats", PROPERTY_HINT_RANGE, "2,32,or_greater"), 4));
}
-Error ResourceImporterOGGVorbis::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
- bool loop = p_options["loop"];
- float loop_offset = p_options["loop_offset"];
-
- Ref<FileAccess> f = FileAccess::open(p_source_file, FileAccess::READ);
- ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_OPEN, "Cannot open file '" + p_source_file + "'.");
+Ref<AudioStreamOGGVorbis> ResourceImporterOGGVorbis::import_ogg_vorbis(const String &p_path) {
+ Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
+ ERR_FAIL_COND_V_MSG(f.is_null(), Ref<AudioStreamOGGVorbis>(), "Cannot open file '" + p_path + "'.");
uint64_t len = f->get_length();
@@ -107,16 +110,16 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
size_t packet_count = 0;
bool done = false;
while (!done) {
- ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Error::ERR_INVALID_DATA, "Ogg sync error " + itos(err));
+ ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOGGVorbis>(), "Ogg sync error " + itos(err));
while (ogg_sync_pageout(&sync_state, &page) != 1) {
if (cursor >= len) {
done = true;
break;
}
- ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Error::ERR_INVALID_DATA, "Ogg sync error " + itos(err));
+ ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOGGVorbis>(), "Ogg sync error " + itos(err));
char *sync_buf = ogg_sync_buffer(&sync_state, OGG_SYNC_BUFFER_SIZE);
- ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Error::ERR_INVALID_DATA, "Ogg sync error " + itos(err));
- ERR_FAIL_COND_V(cursor > len, Error::ERR_INVALID_DATA);
+ ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOGGVorbis>(), "Ogg sync error " + itos(err));
+ ERR_FAIL_COND_V(cursor > len, Ref<AudioStreamOGGVorbis>());
size_t copy_size = len - cursor;
if (copy_size > OGG_SYNC_BUFFER_SIZE) {
copy_size = OGG_SYNC_BUFFER_SIZE;
@@ -124,22 +127,22 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
memcpy(sync_buf, &file_data[cursor], copy_size);
ogg_sync_wrote(&sync_state, copy_size);
cursor += copy_size;
- ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Error::ERR_INVALID_DATA, "Ogg sync error " + itos(err));
+ ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOGGVorbis>(), "Ogg sync error " + itos(err));
}
if (done) {
break;
}
- ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Error::ERR_INVALID_DATA, "Ogg sync error " + itos(err));
+ ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOGGVorbis>(), "Ogg sync error " + itos(err));
// Have a page now.
if (!initialized_stream) {
if (ogg_stream_init(&stream_state, ogg_page_serialno(&page))) {
- ERR_FAIL_V_MSG(Error::ERR_OUT_OF_MEMORY, "Failed allocating memory for OGG Vorbis stream.");
+ ERR_FAIL_V_MSG(Ref<AudioStreamOGGVorbis>(), "Failed allocating memory for OGG Vorbis stream.");
}
initialized_stream = true;
}
ogg_stream_pagein(&stream_state, &page);
- ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Error::ERR_INVALID_DATA, "Ogg stream error " + itos(err));
+ ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Ref<AudioStreamOGGVorbis>(), "Ogg stream error " + itos(err));
int desync_iters = 0;
Vector<Vector<uint8_t>> packet_data;
@@ -150,7 +153,7 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
if (err == -1) {
// According to the docs this is usually recoverable, but don't sit here spinning forever.
desync_iters++;
- ERR_FAIL_COND_V_MSG(desync_iters > 100, Error::ERR_INVALID_DATA, "Packet sync issue during ogg import");
+ ERR_FAIL_COND_V_MSG(desync_iters > 100, Ref<AudioStreamOGGVorbis>(), "Packet sync issue during ogg import");
continue;
} else if (err == 0) {
// Not enough data to fully reconstruct a packet. Go on to the next page.
@@ -183,12 +186,45 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
ogg_sync_clear(&sync_state);
if (ogg_packet_sequence->get_packet_granule_positions().is_empty()) {
- ERR_FAIL_V_MSG(Error::ERR_FILE_CORRUPT, "OGG Vorbis decoding failed. Check that your data is a valid OGG Vorbis audio stream.");
+ ERR_FAIL_V_MSG(Ref<AudioStreamOGGVorbis>(), "OGG Vorbis decoding failed. Check that your data is a valid OGG Vorbis audio stream.");
}
ogg_vorbis_stream->set_packet_sequence(ogg_packet_sequence);
+
+ return ogg_vorbis_stream;
+}
+
+#ifdef TOOLS_ENABLED
+
+bool ResourceImporterOGGVorbis::has_advanced_options() const {
+ return true;
+}
+
+void ResourceImporterOGGVorbis::show_advanced_options(const String &p_path) {
+ Ref<AudioStreamOGGVorbis> ogg_stream = import_ogg_vorbis(p_path);
+ if (ogg_stream.is_valid()) {
+ AudioStreamImportSettings::get_singleton()->edit(p_path, "oggvorbisstr", ogg_stream);
+ }
+}
+#endif
+
+Error ResourceImporterOGGVorbis::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
+ bool loop = p_options["loop"];
+ float loop_offset = p_options["loop_offset"];
+ double bpm = p_options["bpm"];
+ int beat_count = p_options["beat_count"];
+ int bar_beats = p_options["bar_beats"];
+
+ Ref<AudioStreamOGGVorbis> ogg_vorbis_stream = import_ogg_vorbis(p_source_file);
+ if (ogg_vorbis_stream.is_null()) {
+ return ERR_CANT_OPEN;
+ }
+
ogg_vorbis_stream->set_loop(loop);
ogg_vorbis_stream->set_loop_offset(loop_offset);
+ ogg_vorbis_stream->set_bpm(bpm);
+ ogg_vorbis_stream->set_beat_count(beat_count);
+ ogg_vorbis_stream->set_bar_beats(bar_beats);
return ResourceSaver::save(p_save_path + ".oggvorbisstr", ogg_vorbis_stream);
}
diff --git a/modules/vorbis/resource_importer_ogg_vorbis.h b/modules/vorbis/resource_importer_ogg_vorbis.h
index 3b4a68a1fd..e6e98a29c1 100644
--- a/modules/vorbis/resource_importer_ogg_vorbis.h
+++ b/modules/vorbis/resource_importer_ogg_vorbis.h
@@ -31,6 +31,7 @@
#ifndef RESOURCE_IMPORTER_OGG_VORBIS_H
#define RESOURCE_IMPORTER_OGG_VORBIS_H
+#include "audio_stream_ogg_vorbis.h"
#include "core/io/resource_importer.h"
class ResourceImporterOGGVorbis : public ResourceImporter {
@@ -43,7 +44,13 @@ class ResourceImporterOGGVorbis : public ResourceImporter {
private:
// virtual int get_samples_in_packet(Vector<uint8_t> p_packet) = 0;
+ static Ref<AudioStreamOGGVorbis> import_ogg_vorbis(const String &p_path);
+
public:
+#ifdef TOOLS_ENABLED
+ virtual bool has_advanced_options() const override;
+ virtual void show_advanced_options(const String &p_path) override;
+#endif
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual String get_save_extension() const override;
virtual String get_resource_type() const override;
diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h
index 448f683eb3..9a5dc6cd7c 100644
--- a/modules/webp/image_loader_webp.h
+++ b/modules/webp/image_loader_webp.h
@@ -40,4 +40,4 @@ public:
ImageLoaderWebP();
};
-#endif
+#endif // IMAGE_LOADER_WEBP_H
diff --git a/modules/webrtc/webrtc_data_channel.h b/modules/webrtc/webrtc_data_channel.h
index 75e29283ec..9d20ad3266 100644
--- a/modules/webrtc/webrtc_data_channel.h
+++ b/modules/webrtc/webrtc_data_channel.h
@@ -81,4 +81,5 @@ public:
VARIANT_ENUM_CAST(WebRTCDataChannel::WriteMode);
VARIANT_ENUM_CAST(WebRTCDataChannel::ChannelState);
+
#endif // WEBRTC_DATA_CHANNEL_H
diff --git a/modules/webrtc/webrtc_multiplayer_peer.h b/modules/webrtc/webrtc_multiplayer_peer.h
index 97550a3e9d..d4ed7ef7de 100644
--- a/modules/webrtc/webrtc_multiplayer_peer.h
+++ b/modules/webrtc/webrtc_multiplayer_peer.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef WEBRTC_MULTIPLAYER_H
-#define WEBRTC_MULTIPLAYER_H
+#ifndef WEBRTC_MULTIPLAYER_PEER_H
+#define WEBRTC_MULTIPLAYER_PEER_H
#include "core/multiplayer/multiplayer_peer.h"
#include "webrtc_peer_connection.h"
@@ -106,4 +106,4 @@ public:
ConnectionStatus get_connection_status() const override;
};
-#endif // WEBRTC_MULTIPLAYER_H
+#endif // WEBRTC_MULTIPLAYER_PEER_H
diff --git a/modules/webrtc/webrtc_peer_connection.h b/modules/webrtc/webrtc_peer_connection.h
index 8c324d0942..122ea3d00f 100644
--- a/modules/webrtc/webrtc_peer_connection.h
+++ b/modules/webrtc/webrtc_peer_connection.h
@@ -74,4 +74,5 @@ public:
};
VARIANT_ENUM_CAST(WebRTCPeerConnection::ConnectionState);
+
#endif // WEBRTC_PEER_CONNECTION_H
diff --git a/modules/websocket/emws_client.h b/modules/websocket/emws_client.h
index ca327a56fa..b71fd78124 100644
--- a/modules/websocket/emws_client.h
+++ b/modules/websocket/emws_client.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EMWSCLIENT_H
-#define EMWSCLIENT_H
+#ifndef EMWS_CLIENT_H
+#define EMWS_CLIENT_H
#ifdef JAVASCRIPT_ENABLED
@@ -68,4 +68,4 @@ public:
#endif // JAVASCRIPT_ENABLED
-#endif // EMWSCLIENT_H
+#endif // EMWS_CLIENT_H
diff --git a/modules/websocket/emws_peer.h b/modules/websocket/emws_peer.h
index 6bb4552c37..f52f615c35 100644
--- a/modules/websocket/emws_peer.h
+++ b/modules/websocket/emws_peer.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EMWSPEER_H
-#define EMWSPEER_H
+#ifndef EMWS_PEER_H
+#define EMWS_PEER_H
#ifdef JAVASCRIPT_ENABLED
@@ -90,4 +90,4 @@ public:
#endif // JAVASCRIPT_ENABLED
-#endif // LSWPEER_H
+#endif // EMWS_PEER_H
diff --git a/modules/websocket/emws_server.h b/modules/websocket/emws_server.h
index ae31d9dbb0..14a9449605 100644
--- a/modules/websocket/emws_server.h
+++ b/modules/websocket/emws_server.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EMWSSERVER_H
-#define EMWSSERVER_H
+#ifndef EMWS_SERVER_H
+#define EMWS_SERVER_H
#ifdef JAVASCRIPT_ENABLED
@@ -61,4 +61,4 @@ public:
#endif
-#endif // LWSSERVER_H
+#endif // EMWS_SERVER_H
diff --git a/modules/websocket/websocket_peer.h b/modules/websocket/websocket_peer.h
index 13fef2424f..22099f7258 100644
--- a/modules/websocket/websocket_peer.h
+++ b/modules/websocket/websocket_peer.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef WEBSOCKETPEER_H
-#define WEBSOCKETPEER_H
+#ifndef WEBSOCKET_PEER_H
+#define WEBSOCKET_PEER_H
#include "core/error/error_list.h"
#include "core/io/packet_peer.h"
@@ -66,4 +66,5 @@ public:
};
VARIANT_ENUM_CAST(WebSocketPeer::WriteMode);
-#endif // WEBSOCKETPEER_H
+
+#endif // WEBSOCKET_PEER_H
diff --git a/modules/websocket/websocket_server.h b/modules/websocket/websocket_server.h
index 7bd80851f5..ac04c4e57e 100644
--- a/modules/websocket/websocket_server.h
+++ b/modules/websocket/websocket_server.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef WEBSOCKET_H
-#define WEBSOCKET_H
+#ifndef WEBSOCKET_SERVER_H
+#define WEBSOCKET_SERVER_H
#include "core/crypto/crypto.h"
#include "core/object/ref_counted.h"
@@ -87,4 +87,4 @@ public:
~WebSocketServer();
};
-#endif // WEBSOCKET_H
+#endif // WEBSOCKET_SERVER_H
diff --git a/modules/websocket/wsl_client.h b/modules/websocket/wsl_client.h
index 22d7ffa839..58b867fbe4 100644
--- a/modules/websocket/wsl_client.h
+++ b/modules/websocket/wsl_client.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef WSLCLIENT_H
-#define WSLCLIENT_H
+#ifndef WSL_CLIENT_H
+#define WSL_CLIENT_H
#ifndef JAVASCRIPT_ENABLED
@@ -88,4 +88,4 @@ public:
#endif // JAVASCRIPT_ENABLED
-#endif // WSLCLIENT_H
+#endif // WSL_CLIENT_H
diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h
index abeecdd537..aabd3fd43e 100644
--- a/modules/websocket/wsl_peer.h
+++ b/modules/websocket/wsl_peer.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef WSLPEER_H
-#define WSLPEER_H
+#ifndef WSL_PEER_H
+#define WSL_PEER_H
#ifndef JAVASCRIPT_ENABLED
@@ -112,4 +112,4 @@ public:
#endif // JAVASCRIPT_ENABLED
-#endif // LSWPEER_H
+#endif // WSL_PEER_H
diff --git a/modules/websocket/wsl_server.h b/modules/websocket/wsl_server.h
index a920e9c665..ec7567c732 100644
--- a/modules/websocket/wsl_server.h
+++ b/modules/websocket/wsl_server.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef WSLSERVER_H
-#define WSLSERVER_H
+#ifndef WSL_SERVER_H
+#define WSL_SERVER_H
#ifndef JAVASCRIPT_ENABLED
@@ -95,4 +95,4 @@ public:
#endif // JAVASCRIPT_ENABLED
-#endif // WSLSERVER_H
+#endif // WSL_SERVER_H
diff --git a/modules/webxr/godot_webxr.h b/modules/webxr/godot_webxr.h
index 34225df001..52104895d4 100644
--- a/modules/webxr/godot_webxr.h
+++ b/modules/webxr/godot_webxr.h
@@ -82,4 +82,4 @@ extern int *godot_webxr_get_bounds_geometry();
}
#endif
-#endif /* GODOT_WEBXR_H */
+#endif // GODOT_WEBXR_H
diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp
index 74e744402b..07e6760555 100644
--- a/modules/webxr/webxr_interface_js.cpp
+++ b/modules/webxr/webxr_interface_js.cpp
@@ -363,8 +363,8 @@ Transform3D WebXRInterfaceJS::get_transform_for_view(uint32_t p_view, const Tran
return p_cam_transform * xr_server->get_reference_frame() * transform_for_eye;
};
-CameraMatrix WebXRInterfaceJS::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
- CameraMatrix eye;
+Projection WebXRInterfaceJS::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
+ Projection eye;
float *js_matrix = godot_webxr_get_projection_for_eye(p_view + 1);
if (!initialized || js_matrix == nullptr) {
diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h
index 31858194f6..f1ffedba46 100644
--- a/modules/webxr/webxr_interface_js.h
+++ b/modules/webxr/webxr_interface_js.h
@@ -87,7 +87,7 @@ public:
virtual uint32_t get_view_count() override;
virtual Transform3D get_camera_transform() override;
virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override;
- virtual CameraMatrix get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override;
+ virtual Projection get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override;
virtual Vector<BlitToScreen> post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) override;
virtual void process() override;