From bc25bde5b44b12e15bf9be0676ce6d0efbe3c417 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 25 May 2023 20:24:38 +0200 Subject: [PATCH] Initial cleanup pass. --- SCsub | 3 +- android/android_gdn.cpp | 2 +- arvr/SCsub | 6 - arvr/arvr_interface_gdnative.cpp | 450 ------------------------- arvr/arvr_interface_gdnative.h | 89 ----- arvr/register_types.cpp | 39 --- arvr/register_types.h | 37 -- config.py | 1 - doc_classes/ARVRInterfaceGDNative.xml | 15 - gdnative.cpp | 2 +- gdnative.h | 2 +- gdnative/aabb.cpp | 2 +- gdnative/array.cpp | 8 +- gdnative/basis.cpp | 2 +- gdnative/color.cpp | 4 +- gdnative/dictionary.cpp | 4 +- gdnative/gdnative.cpp | 10 +- gdnative/node_path.cpp | 4 +- gdnative/plane.cpp | 2 +- gdnative/pool_arrays.cpp | 8 +- gdnative/quat.cpp | 2 +- gdnative/rect2.cpp | 2 +- gdnative/rid.cpp | 6 +- gdnative/string.cpp | 6 +- gdnative/string_name.cpp | 4 +- gdnative/transform.cpp | 2 +- gdnative/transform2d.cpp | 2 +- gdnative/variant.cpp | 2 +- gdnative/vector2.cpp | 2 +- gdnative/vector3.cpp | 4 +- gdnative_builders.py | 2 - include/arvr/godot_arvr.h | 98 ------ include/net/godot_net.h | 3 - include/net/godot_webrtc.h | 129 ------- nativescript/api_generator.cpp | 4 +- nativescript/api_generator.h | 2 +- nativescript/godot_nativescript.cpp | 8 +- nativescript/nativescript.cpp | 2 +- nativescript/nativescript.h | 6 +- net/SCsub | 6 +- net/multiplayer_peer_gdnative.h | 4 +- net/packet_peer_gdnative.h | 4 +- net/stream_peer_gdnative.h | 4 +- net/webrtc_gdnative.cpp | 8 +- pluginscript/pluginscript_instance.cpp | 2 +- pluginscript/pluginscript_instance.h | 2 +- pluginscript/pluginscript_language.cpp | 2 +- pluginscript/pluginscript_language.h | 6 +- pluginscript/pluginscript_loader.h | 2 +- pluginscript/pluginscript_script.h | 2 +- pluginscript/register_types.cpp | 2 +- register_types.cpp | 198 +++++------ register_types.h | 10 +- videodecoder/register_types.cpp | 2 +- videodecoder/video_stream_gdnative.cpp | 2 +- 55 files changed, 182 insertions(+), 1050 deletions(-) delete mode 100644 arvr/SCsub delete mode 100644 arvr/arvr_interface_gdnative.cpp delete mode 100644 arvr/arvr_interface_gdnative.h delete mode 100644 arvr/register_types.cpp delete mode 100644 arvr/register_types.h delete mode 100644 doc_classes/ARVRInterfaceGDNative.xml delete mode 100644 include/arvr/godot_arvr.h delete mode 100644 include/net/godot_webrtc.h diff --git a/SCsub b/SCsub index bc88084..7e97069 100644 --- a/SCsub +++ b/SCsub @@ -12,12 +12,11 @@ env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp") env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp") env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp") -env_gdnative.Prepend(CPPPATH=["#modules/gdnative/include/"]) +env_gdnative.Prepend(CPPPATH=["./include/"]) Export("env_gdnative") SConscript("net/SCsub") -SConscript("arvr/SCsub") SConscript("pluginscript/SCsub") SConscript("videodecoder/SCsub") diff --git a/android/android_gdn.cpp b/android/android_gdn.cpp index ed39eaa..93d298e 100644 --- a/android/android_gdn.cpp +++ b/android/android_gdn.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#include "modules/gdnative/gdnative.h" +#include "gdnative/gdnative.h" // Code by Paritosh97 with minor tweaks by Mux213 // These entry points are only for the android platform and are simple stubs in all others. diff --git a/arvr/SCsub b/arvr/SCsub deleted file mode 100644 index 0b2db3b..0000000 --- a/arvr/SCsub +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python - -Import("env") -Import("env_gdnative") - -env_gdnative.add_source_files(env.modules_sources, "*.cpp") diff --git a/arvr/arvr_interface_gdnative.cpp b/arvr/arvr_interface_gdnative.cpp deleted file mode 100644 index aec17cf..0000000 --- a/arvr/arvr_interface_gdnative.cpp +++ /dev/null @@ -1,450 +0,0 @@ -/**************************************************************************/ -/* arvr_interface_gdnative.cpp */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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. */ -/**************************************************************************/ - -#include "arvr_interface_gdnative.h" -#include "main/input_default.h" -#include "servers/arvr/arvr_positional_tracker.h" -#include "servers/visual/visual_server_globals.h" - -void ARVRInterfaceGDNative::_bind_methods() { - ADD_PROPERTY_DEFAULT("interface_is_initialized", false); - ADD_PROPERTY_DEFAULT("ar_is_anchor_detection_enabled", false); -} - -ARVRInterfaceGDNative::ARVRInterfaceGDNative() { - print_verbose("Construct gdnative interface\n"); - - // we won't have our data pointer until our library gets set - data = nullptr; - - interface = nullptr; -} - -ARVRInterfaceGDNative::~ARVRInterfaceGDNative() { - print_verbose("Destruct gdnative interface\n"); - - if (interface != nullptr && is_initialized()) { - uninitialize(); - }; - - // cleanup after ourselves - cleanup(); -} - -void ARVRInterfaceGDNative::cleanup() { - if (interface != nullptr) { - interface->destructor(data); - data = nullptr; - interface = nullptr; - } -} - -void ARVRInterfaceGDNative::set_interface(const godot_arvr_interface_gdnative *p_interface) { - // this should only be called once, just being paranoid.. - if (interface) { - cleanup(); - } - - // bind to our interface - interface = p_interface; - - // Now we do our constructing... - data = interface->constructor((godot_object *)this); -} - -StringName ARVRInterfaceGDNative::get_name() const { - ERR_FAIL_COND_V(interface == nullptr, StringName()); - - godot_string result = interface->get_name(data); - - StringName name = *(String *)&result; - - godot_string_destroy(&result); - - return name; -} - -int ARVRInterfaceGDNative::get_capabilities() const { - int capabilities; - - ERR_FAIL_COND_V(interface == nullptr, 0); // 0 = None - - capabilities = interface->get_capabilities(data); - - return capabilities; -} - -bool ARVRInterfaceGDNative::get_anchor_detection_is_enabled() const { - ERR_FAIL_COND_V(interface == nullptr, false); - - return interface->get_anchor_detection_is_enabled(data); -} - -void ARVRInterfaceGDNative::set_anchor_detection_is_enabled(bool p_enable) { - ERR_FAIL_COND(interface == nullptr); - - interface->set_anchor_detection_is_enabled(data, p_enable); -} - -int ARVRInterfaceGDNative::get_camera_feed_id() { - ERR_FAIL_COND_V(interface == nullptr, 0); - - if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) { - return (unsigned int)interface->get_camera_feed_id(data); - } else { - return 0; - } -} - -bool ARVRInterfaceGDNative::is_stereo() { - bool stereo; - - ERR_FAIL_COND_V(interface == nullptr, false); - - stereo = interface->is_stereo(data); - - return stereo; -} - -bool ARVRInterfaceGDNative::is_initialized() const { - ERR_FAIL_COND_V(interface == nullptr, false); - - return interface->is_initialized(data); -} - -bool ARVRInterfaceGDNative::initialize() { - ERR_FAIL_COND_V(interface == nullptr, false); - - bool initialized = interface->initialize(data); - - if (initialized) { - // if we successfully initialize our interface and we don't have a primary interface yet, this becomes our primary interface - - ARVRServer *arvr_server = ARVRServer::get_singleton(); - if ((arvr_server != nullptr) && (arvr_server->get_primary_interface() == nullptr)) { - arvr_server->set_primary_interface(this); - }; - }; - - return initialized; -} - -void ARVRInterfaceGDNative::uninitialize() { - ERR_FAIL_COND(interface == nullptr); - - ARVRServer *arvr_server = ARVRServer::get_singleton(); - if (arvr_server != nullptr) { - // Whatever happens, make sure this is no longer our primary interface - arvr_server->clear_primary_interface_if(this); - } - - interface->uninitialize(data); -} - -Size2 ARVRInterfaceGDNative::get_render_targetsize() { - ERR_FAIL_COND_V(interface == nullptr, Size2()); - - godot_vector2 result = interface->get_render_targetsize(data); - Vector2 *vec = (Vector2 *)&result; - - return *vec; -} - -Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform) { - Transform *ret; - - ERR_FAIL_COND_V(interface == nullptr, Transform()); - - godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform); - - ret = (Transform *)&t; - - return *ret; -} - -CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) { - CameraMatrix cm; - - ERR_FAIL_COND_V(interface == nullptr, CameraMatrix()); - - interface->fill_projection_for_eye(data, (godot_real *)cm.matrix, (godot_int)p_eye, p_aspect, p_z_near, p_z_far); - - return cm; -} - -unsigned int ARVRInterfaceGDNative::get_external_texture_for_eye(ARVRInterface::Eyes p_eye) { - ERR_FAIL_COND_V(interface == nullptr, 0); - - if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) { - return (unsigned int)interface->get_external_texture_for_eye(data, (godot_int)p_eye); - } else { - return 0; - } -} - -unsigned int ARVRInterfaceGDNative::get_external_depth_for_eye(ARVRInterface::Eyes p_eye) { - ERR_FAIL_COND_V(interface == nullptr, 0); - - if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 2))) { - return (unsigned int)interface->get_external_depth_for_eye(data, (godot_int)p_eye); - } else { - return 0; - } -} - -void ARVRInterfaceGDNative::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) { - ERR_FAIL_COND(interface == nullptr); - - interface->commit_for_eye(data, (godot_int)p_eye, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect); -} - -void ARVRInterfaceGDNative::process() { - ERR_FAIL_COND(interface == nullptr); - - interface->process(data); -} - -void ARVRInterfaceGDNative::notification(int p_what) { - ERR_FAIL_COND(interface == nullptr); - - // this is only available in interfaces that implement 1.1 or later - if ((interface->version.major > 1) || ((interface->version.major == 1) && (interface->version.minor > 0))) { - interface->notification(data, p_what); - } -} - -///////////////////////////////////////////////////////////////////////////////////// -// some helper callbacks - -extern "C" { - -void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface) { - // If our major version is 0 or bigger then 10, we're likely looking at our constructor pointer from an older plugin - ERR_FAIL_COND_MSG((p_interface->version.major == 0) || (p_interface->version.major > 10), "GDNative ARVR interfaces build for Godot 3.0 are not supported."); - - Ref new_interface; - new_interface.instance(); - new_interface->set_interface((const godot_arvr_interface_gdnative *)p_interface); - ARVRServer::get_singleton()->add_interface(new_interface); -} - -godot_real GDAPI godot_arvr_get_worldscale() { - ARVRServer *arvr_server = ARVRServer::get_singleton(); - ERR_FAIL_NULL_V(arvr_server, 1.0); - - return arvr_server->get_world_scale(); -} - -godot_transform GDAPI godot_arvr_get_reference_frame() { - godot_transform reference_frame; - Transform *reference_frame_ptr = (Transform *)&reference_frame; - - ARVRServer *arvr_server = ARVRServer::get_singleton(); - if (arvr_server != nullptr) { - *reference_frame_ptr = arvr_server->get_reference_frame(); - } else { - godot_transform_new_identity(&reference_frame); - } - - return reference_frame; -} - -void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect) { - // blits out our texture as is, handy for preview display of one of the eyes that is already rendered with lens distortion on an external HMD - ARVRInterface::Eyes eye = (ARVRInterface::Eyes)p_eye; - RID *render_target = (RID *)p_render_target; - Rect2 screen_rect = *(Rect2 *)p_rect; - - if (eye == ARVRInterface::EYE_LEFT) { - screen_rect.size.x /= 2.0; - } else if (p_eye == ARVRInterface::EYE_RIGHT) { - screen_rect.size.x /= 2.0; - screen_rect.position.x += screen_rect.size.x; - } - - VSG::rasterizer->set_current_render_target(RID()); - VSG::rasterizer->blit_render_target_to_screen(*render_target, screen_rect, 0); -} - -godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target) { - // In order to send off our textures to display on our hardware we need the opengl texture ID instead of the render target RID - // This is a handy function to expose that. - RID *render_target = (RID *)p_render_target; - - RID eye_texture = VSG::storage->render_target_get_texture(*render_target); - uint32_t texid = VS::get_singleton()->texture_get_texid(eye_texture); - - return texid; -} - -godot_int GDAPI godot_arvr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { - ARVRServer *arvr_server = ARVRServer::get_singleton(); - ERR_FAIL_NULL_V(arvr_server, 0); - - InputDefault *input = (InputDefault *)Input::get_singleton(); - ERR_FAIL_NULL_V(input, 0); - - Ref new_tracker; - new_tracker.instance(); - new_tracker->set_name(p_device_name); - new_tracker->set_type(ARVRServer::TRACKER_CONTROLLER); - if (p_hand == 1) { - new_tracker->set_hand(ARVRPositionalTracker::TRACKER_LEFT_HAND); - } else if (p_hand == 2) { - new_tracker->set_hand(ARVRPositionalTracker::TRACKER_RIGHT_HAND); - } - - // also register as joystick... - int joyid = input->get_unused_joy_id(); - if (joyid != -1) { - new_tracker->set_joy_id(joyid); - input->joy_connection_changed(joyid, true, p_device_name, ""); - } - - if (p_tracks_orientation) { - Basis orientation; - new_tracker->set_orientation(orientation); - } - if (p_tracks_position) { - Vector3 position; - new_tracker->set_position(position); - } - - // add our tracker to our server and remember its pointer - arvr_server->add_tracker(new_tracker); - - // note, this ID is only unique within controllers! - return new_tracker->get_tracker_id(); -} - -void GDAPI godot_arvr_remove_controller(godot_int p_controller_id) { - ARVRServer *arvr_server = ARVRServer::get_singleton(); - ERR_FAIL_NULL(arvr_server); - - InputDefault *input = (InputDefault *)Input::get_singleton(); - ERR_FAIL_NULL(input); - - Ref remove_tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (remove_tracker.is_valid()) { - // unset our joystick if applicable - int joyid = remove_tracker->get_joy_id(); - if (joyid != -1) { - input->joy_connection_changed(joyid, false, "", ""); - remove_tracker->set_joy_id(-1); - } - - // remove our tracker from our server - arvr_server->remove_tracker(remove_tracker); - remove_tracker.unref(); - } -} - -void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { - ARVRServer *arvr_server = ARVRServer::get_singleton(); - ERR_FAIL_NULL(arvr_server); - - Ref tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker.is_valid()) { - Transform *transform = (Transform *)p_transform; - if (p_tracks_orientation) { - tracker->set_orientation(transform->basis); - } - if (p_tracks_position) { - tracker->set_rw_position(transform->origin); - } - } -} - -void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed) { - ARVRServer *arvr_server = ARVRServer::get_singleton(); - ERR_FAIL_NULL(arvr_server); - - InputDefault *input = (InputDefault *)Input::get_singleton(); - ERR_FAIL_NULL(input); - - Ref tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker.is_valid()) { - int joyid = tracker->get_joy_id(); - if (joyid != -1) { - input->joy_button(joyid, p_button, p_is_pressed); - } - } -} - -void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative) { - ARVRServer *arvr_server = ARVRServer::get_singleton(); - ERR_FAIL_NULL(arvr_server); - - InputDefault *input = (InputDefault *)Input::get_singleton(); - ERR_FAIL_NULL(input); - - Ref tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker.is_valid()) { - int joyid = tracker->get_joy_id(); - if (joyid != -1) { - float value = p_value; - if (!p_can_be_negative) { - // Convert to a value between -1.0f and 1.0f. - value = p_value * 2.0f - 1.0f; - } - input->joy_axis(joyid, p_axis, value); - } - } -} - -godot_real GDAPI godot_arvr_get_controller_rumble(godot_int p_controller_id) { - ARVRServer *arvr_server = ARVRServer::get_singleton(); - ERR_FAIL_NULL_V(arvr_server, 0.0); - - Ref tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker.is_valid()) { - return tracker->get_rumble(); - } - - return 0.0; -} - -void GDAPI godot_arvr_set_interface(godot_object *p_arvr_interface, const godot_arvr_interface_gdnative *p_gdn_interface) { - // If our major version is 0 or bigger then 10, we're likely looking at our constructor pointer from an older plugin - ERR_FAIL_COND_MSG((p_gdn_interface->version.major == 0) || (p_gdn_interface->version.major > 10), "GDNative ARVR interfaces build for Godot 3.0 are not supported."); - - ARVRInterfaceGDNative *interface = (ARVRInterfaceGDNative *)p_arvr_interface; - interface->set_interface((const godot_arvr_interface_gdnative *)p_gdn_interface); -} - -godot_int GDAPI godot_arvr_get_depthid(godot_rid *p_render_target) { - // We also need to access our depth texture for reprojection. - RID *render_target = (RID *)p_render_target; - - uint32_t texid = VSG::storage->render_target_get_depth_texture_id(*render_target); - - return texid; -} -} diff --git a/arvr/arvr_interface_gdnative.h b/arvr/arvr_interface_gdnative.h deleted file mode 100644 index 74c777e..0000000 --- a/arvr/arvr_interface_gdnative.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************/ -/* arvr_interface_gdnative.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 ARVR_INTERFACE_GDNATIVE_H -#define ARVR_INTERFACE_GDNATIVE_H - -#include "modules/gdnative/gdnative.h" -#include "servers/arvr/arvr_interface.h" - -/** - @authors Hinsbart & Karroffel & Mux213 - - This subclass of our AR/VR interface forms a bridge to GDNative. -*/ - -class ARVRInterfaceGDNative : public ARVRInterface { - GDCLASS(ARVRInterfaceGDNative, ARVRInterface); - - void cleanup(); - -protected: - const godot_arvr_interface_gdnative *interface; - void *data; - - static void _bind_methods(); - -public: - /** general interface information **/ - ARVRInterfaceGDNative(); - ~ARVRInterfaceGDNative(); - - void set_interface(const godot_arvr_interface_gdnative *p_interface); - - virtual StringName get_name() const; - virtual int get_capabilities() const; - - virtual bool is_initialized() const; - virtual bool initialize(); - virtual void uninitialize(); - - /** specific to AR **/ - virtual bool get_anchor_detection_is_enabled() const; - virtual void set_anchor_detection_is_enabled(bool p_enable); - virtual int get_camera_feed_id(); - - /** rendering and internal **/ - virtual Size2 get_render_targetsize(); - virtual bool is_stereo(); - virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform); - - // and a CameraMatrix version to ARVRServer - virtual CameraMatrix get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); - - virtual unsigned int get_external_texture_for_eye(ARVRInterface::Eyes p_eye); - virtual unsigned int get_external_depth_for_eye(ARVRInterface::Eyes p_eye); - virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect); - - virtual void process(); - virtual void notification(int p_what); -}; - -#endif // ARVR_INTERFACE_GDNATIVE_H diff --git a/arvr/register_types.cpp b/arvr/register_types.cpp deleted file mode 100644 index 6c647ce..0000000 --- a/arvr/register_types.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************/ -/* register_types.cpp */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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. */ -/**************************************************************************/ - -#include "register_types.h" -#include "arvr_interface_gdnative.h" - -void register_arvr_types() { - ClassDB::register_class(); -} - -void unregister_arvr_types() { -} diff --git a/arvr/register_types.h b/arvr/register_types.h deleted file mode 100644 index 1cb784b..0000000 --- a/arvr/register_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************/ -/* register_types.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 ARVR_REGISTER_TYPES_H -#define ARVR_REGISTER_TYPES_H - -void register_arvr_types(); -void unregister_arvr_types(); - -#endif // ARVR_REGISTER_TYPES_H diff --git a/config.py b/config.py index bf371ed..6c74267 100644 --- a/config.py +++ b/config.py @@ -8,7 +8,6 @@ def configure(env): def get_doc_classes(): return [ - "ARVRInterfaceGDNative", "GDNative", "GDNativeLibrary", "MultiplayerPeerGDNative", diff --git a/doc_classes/ARVRInterfaceGDNative.xml b/doc_classes/ARVRInterfaceGDNative.xml deleted file mode 100644 index 1598dba..0000000 --- a/doc_classes/ARVRInterfaceGDNative.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - GDNative wrapper for an ARVR interface. - - - This is a wrapper class for GDNative implementations of the ARVR interface. To use a GDNative ARVR interface, simply instantiate this object and set your GDNative library containing the ARVR interface implementation. - - - - - - - - diff --git a/gdnative.cpp b/gdnative.cpp index 291a286..f71437b 100644 --- a/gdnative.cpp +++ b/gdnative.cpp @@ -35,7 +35,7 @@ #include "core/os/dir_access.h" #include "core/os/file_access.h" #include "core/os/os.h" -#include "core/project_settings.h" +#include "core/config/project_settings.h" #include "scene/main/scene_tree.h" diff --git a/gdnative.h b/gdnative.h index 237048f..41fdf88 100644 --- a/gdnative.h +++ b/gdnative.h @@ -34,7 +34,7 @@ #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/os/thread_safe.h" -#include "core/resource.h" +#include "core/object/resource.h" #include "gdnative/gdnative.h" #include "gdnative_api_struct.gen.h" diff --git a/gdnative/aabb.cpp b/gdnative/aabb.cpp index 0d4dc8c..d2288cf 100644 --- a/gdnative/aabb.cpp +++ b/gdnative/aabb.cpp @@ -31,7 +31,7 @@ #include "gdnative/aabb.h" #include "core/math/aabb.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/array.cpp b/gdnative/array.cpp index 2f1109e..1c68bb9 100644 --- a/gdnative/array.cpp +++ b/gdnative/array.cpp @@ -30,13 +30,13 @@ #include "gdnative/array.h" -#include "core/array.h" +#include "core/variant/array.h" #include "core/os/memory.h" -#include "core/color.h" -#include "core/pool_vector.h" +#include "core/math/color.h" +#include "core/containers/pool_vector.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/basis.cpp b/gdnative/basis.cpp index d7a31cc..f0f9389 100644 --- a/gdnative/basis.cpp +++ b/gdnative/basis.cpp @@ -31,7 +31,7 @@ #include "gdnative/basis.h" #include "core/math/basis.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/color.cpp b/gdnative/color.cpp index 9b20165..ed884de 100644 --- a/gdnative/color.cpp +++ b/gdnative/color.cpp @@ -30,8 +30,8 @@ #include "gdnative/color.h" -#include "core/color.h" -#include "core/variant.h" +#include "core/math/color.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/dictionary.cpp b/gdnative/dictionary.cpp index fba09ff..69eebde 100644 --- a/gdnative/dictionary.cpp +++ b/gdnative/dictionary.cpp @@ -30,9 +30,9 @@ #include "gdnative/dictionary.h" -#include "core/variant.h" +#include "core/variant/variant.h" // core/variant.h before to avoid compile errors with MSVC -#include "core/dictionary.h" +#include "core/variant/dictionary.h" #include "core/io/json.h" #ifdef __cplusplus diff --git a/gdnative/gdnative.cpp b/gdnative/gdnative.cpp index e6ac47c..ae91b98 100644 --- a/gdnative/gdnative.cpp +++ b/gdnative/gdnative.cpp @@ -30,14 +30,14 @@ #include "gdnative/gdnative.h" -#include "core/class_db.h" -#include "core/engine.h" -#include "core/error_macros.h" +#include "core/object/class_db.h" +#include "core/config/engine.h" +#include "core/error/error_macros.h" #include "core/global_constants.h" #include "core/os/os.h" -#include "core/variant.h" +#include "core/variant/variant.h" -#include "modules/gdnative/gdnative.h" +#include "../gdnative/gdnative.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/node_path.cpp b/gdnative/node_path.cpp index 5223c1f..8345e20 100644 --- a/gdnative/node_path.cpp +++ b/gdnative/node_path.cpp @@ -30,8 +30,8 @@ #include "gdnative/node_path.h" -#include "core/node_path.h" -#include "core/variant.h" +#include "core/string/node_path.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/plane.cpp b/gdnative/plane.cpp index 568bbc1..83d003b 100644 --- a/gdnative/plane.cpp +++ b/gdnative/plane.cpp @@ -31,7 +31,7 @@ #include "gdnative/plane.h" #include "core/math/plane.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/pool_arrays.cpp b/gdnative/pool_arrays.cpp index 3f9af50..df4ba7a 100644 --- a/gdnative/pool_arrays.cpp +++ b/gdnative/pool_arrays.cpp @@ -30,11 +30,11 @@ #include "gdnative/pool_arrays.h" -#include "core/array.h" -#include "core/pool_vector.h" -#include "core/variant.h" +#include "core/variant/array.h" +#include "core/containers/pool_vector.h" +#include "core/variant/variant.h" -#include "core/color.h" +#include "core/math/color.h" #include "core/math/vector2.h" #include "core/math/vector3.h" diff --git a/gdnative/quat.cpp b/gdnative/quat.cpp index 1924513..9ef490d 100644 --- a/gdnative/quat.cpp +++ b/gdnative/quat.cpp @@ -31,7 +31,7 @@ #include "gdnative/quat.h" #include "core/math/quat.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/rect2.cpp b/gdnative/rect2.cpp index 7e16538..0efca3d 100644 --- a/gdnative/rect2.cpp +++ b/gdnative/rect2.cpp @@ -31,7 +31,7 @@ #include "gdnative/rect2.h" #include "core/math/transform_2d.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/rid.cpp b/gdnative/rid.cpp index ad62b33..411292a 100644 --- a/gdnative/rid.cpp +++ b/gdnative/rid.cpp @@ -30,9 +30,9 @@ #include "gdnative/rid.h" -#include "core/resource.h" -#include "core/rid.h" -#include "core/variant.h" +#include "core/object/resource.h" +#include "core/object/rid.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/string.cpp b/gdnative/string.cpp index 62b00e0..267ec77 100644 --- a/gdnative/string.cpp +++ b/gdnative/string.cpp @@ -30,9 +30,9 @@ #include "gdnative/string.h" -#include "core/string_name.h" -#include "core/ustring.h" -#include "core/variant.h" +#include "core/string/string_name.h" +#include "core/string/ustring.h" +#include "core/variant/variant.h" #include diff --git a/gdnative/string_name.cpp b/gdnative/string_name.cpp index 90425e8..9ce53b7 100644 --- a/gdnative/string_name.cpp +++ b/gdnative/string_name.cpp @@ -30,8 +30,8 @@ #include "gdnative/string_name.h" -#include "core/string_name.h" -#include "core/ustring.h" +#include "core/string/string_name.h" +#include "core/string/ustring.h" #include diff --git a/gdnative/transform.cpp b/gdnative/transform.cpp index 2f51143..ff3da2e 100644 --- a/gdnative/transform.cpp +++ b/gdnative/transform.cpp @@ -31,7 +31,7 @@ #include "gdnative/transform.h" #include "core/math/transform.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/transform2d.cpp b/gdnative/transform2d.cpp index 6b4bfd3..938d4b2 100644 --- a/gdnative/transform2d.cpp +++ b/gdnative/transform2d.cpp @@ -31,7 +31,7 @@ #include "gdnative/transform2d.h" #include "core/math/transform_2d.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/variant.cpp b/gdnative/variant.cpp index bb77595..086fc82 100644 --- a/gdnative/variant.cpp +++ b/gdnative/variant.cpp @@ -31,7 +31,7 @@ #include "gdnative/variant.h" #include "core/reference.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/vector2.cpp b/gdnative/vector2.cpp index d9d3d0f..f50780a 100644 --- a/gdnative/vector2.cpp +++ b/gdnative/vector2.cpp @@ -31,7 +31,7 @@ #include "gdnative/vector2.h" #include "core/math/vector2.h" -#include "core/variant.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative/vector3.cpp b/gdnative/vector3.cpp index 6973559..461e254 100644 --- a/gdnative/vector3.cpp +++ b/gdnative/vector3.cpp @@ -30,8 +30,8 @@ #include "gdnative/vector3.h" -#include "core/variant.h" -#include "core/vector.h" +#include "core/variant/variant.h" +#include "core/containers/vector.h" #ifdef __cplusplus extern "C" { diff --git a/gdnative_builders.py b/gdnative_builders.py index d44bf45..55c3eaf 100644 --- a/gdnative_builders.py +++ b/gdnative_builders.py @@ -44,7 +44,6 @@ def _build_gdnative_api_struct_header(api): "", "#include ", "#include ", - "#include ", "#include ", "#include ", "#include ", @@ -286,7 +285,6 @@ def _build_gdnative_wrapper_code(api): "#include ", "#include ", "#include ", - "#include ", "#include ", "", "#include ", diff --git a/include/arvr/godot_arvr.h b/include/arvr/godot_arvr.h deleted file mode 100644 index 7165cce..0000000 --- a/include/arvr/godot_arvr.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************/ -/* godot_arvr.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 GODOT_ARVR_H -#define GODOT_ARVR_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// For future versions of the API we should only add new functions at the end of the structure and use the -// version info to detect whether a call is available - -// Use these to populate version in your plugin -#define GODOTVR_API_MAJOR 1 -#define GODOTVR_API_MINOR 2 - -typedef struct { - godot_gdnative_api_version version; /* version of our API */ - void *(*constructor)(godot_object *); - void (*destructor)(void *); - godot_string (*get_name)(const void *); - godot_int (*get_capabilities)(const void *); - godot_bool (*get_anchor_detection_is_enabled)(const void *); - void (*set_anchor_detection_is_enabled)(void *, godot_bool); - godot_bool (*is_stereo)(const void *); - godot_bool (*is_initialized)(const void *); - godot_bool (*initialize)(void *); - void (*uninitialize)(void *); - godot_vector2 (*get_render_targetsize)(const void *); - godot_transform (*get_transform_for_eye)(void *, godot_int, godot_transform *); - void (*fill_projection_for_eye)(void *, godot_real *, godot_int, godot_real, godot_real, godot_real); - void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *); - void (*process)(void *); - // only in 1.1 onwards - godot_int (*get_external_texture_for_eye)(void *, godot_int); - void (*notification)(void *, godot_int); - godot_int (*get_camera_feed_id)(void *); - // only in 1.2 onwards - godot_int (*get_external_depth_for_eye)(void *, godot_int); -} godot_arvr_interface_gdnative; - -void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface); - -// helper functions to access ARVRServer data -godot_real GDAPI godot_arvr_get_worldscale(); -godot_transform GDAPI godot_arvr_get_reference_frame(); - -// helper functions for rendering -void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect); -godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target); - -// helper functions for updating ARVR controllers -godot_int GDAPI godot_arvr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position); -void GDAPI godot_arvr_remove_controller(godot_int p_controller_id); -void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position); -void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed); -void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative); -godot_real GDAPI godot_arvr_get_controller_rumble(godot_int p_controller_id); - -// ARVR 1.2 functions -void GDAPI godot_arvr_set_interface(godot_object *p_arvr_interface, const godot_arvr_interface_gdnative *p_gdn_interface); -godot_int GDAPI godot_arvr_get_depthid(godot_rid *p_render_target); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_ARVR_H diff --git a/include/net/godot_net.h b/include/net/godot_net.h index eccc31a..9adabf4 100644 --- a/include/net/godot_net.h +++ b/include/net/godot_net.h @@ -114,7 +114,4 @@ void GDAPI godot_net_bind_multiplayer_peer(godot_object *p_obj, const godot_net_ } #endif -// WebRTC Bindings -#include "net/godot_webrtc.h" - #endif // GODOT_NET_H diff --git a/include/net/godot_webrtc.h b/include/net/godot_webrtc.h deleted file mode 100644 index 3984585..0000000 --- a/include/net/godot_webrtc.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************/ -/* godot_webrtc.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 GODOT_WEBRTC_H -#define GODOT_WEBRTC_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define GODOT_NET_WEBRTC_API_MAJOR 3 -#define GODOT_NET_WEBRTC_API_MINOR 4 - -/* Library Interface (used to set default GDNative WebRTC implementation */ -typedef struct { - godot_gdnative_api_version version; /* version of our API */ - - /* Called when the library is unset as default interface via godot_net_set_webrtc_library */ - void (*unregistered)(); - - /* Used by WebRTCPeerConnection create when GDNative is the default implementation. */ - /* Takes a pointer to WebRTCPeerConnectionGDNative, should bind and return OK, failure if binding was unsuccessful. */ - godot_error (*create_peer_connection)(godot_object *); - - void *next; /* For extension */ -} godot_net_webrtc_library; - -/* WebRTCPeerConnection interface */ -typedef struct { - godot_gdnative_api_version version; /* version of our API */ - - godot_object *data; /* User reference */ - - /* This is WebRTCPeerConnection */ - godot_int (*get_connection_state)(const void *); - - godot_error (*initialize)(void *, const godot_dictionary *); - godot_object *(*create_data_channel)(void *, const char *p_channel_name, const godot_dictionary *); - godot_error (*create_offer)(void *); - godot_error (*create_answer)(void *); /* unused for now, should be done automatically on set_local_description */ - godot_error (*set_remote_description)(void *, const char *, const char *); - godot_error (*set_local_description)(void *, const char *, const char *); - godot_error (*add_ice_candidate)(void *, const char *, int, const char *); - godot_error (*poll)(void *); - void (*close)(void *); - - void *next; /* For extension? */ -} godot_net_webrtc_peer_connection; - -/* WebRTCDataChannel interface */ -typedef struct { - godot_gdnative_api_version version; /* version of our API */ - - godot_object *data; /* User reference */ - - /* This is PacketPeer */ - godot_error (*get_packet)(void *, const uint8_t **, int *); - godot_error (*put_packet)(void *, const uint8_t *, int); - godot_int (*get_available_packet_count)(const void *); - godot_int (*get_max_packet_size)(const void *); - - /* This is WebRTCDataChannel */ - void (*set_write_mode)(void *, godot_int); - godot_int (*get_write_mode)(const void *); - bool (*was_string_packet)(const void *); - - godot_int (*get_ready_state)(const void *); - const char *(*get_label)(const void *); - bool (*is_ordered)(const void *); - int (*get_id)(const void *); - int (*get_max_packet_life_time)(const void *); - int (*get_max_retransmits)(const void *); - const char *(*get_protocol)(const void *); - bool (*is_negotiated)(const void *); - - godot_error (*poll)(void *); - void (*close)(void *); - - void *next; /* For extension? */ -} godot_net_webrtc_data_channel; - -/* Extensions to WebRTCDataChannel */ -typedef struct { - int (*get_buffered_amount)(const void *); - - void *next; /* For extension? */ -} godot_net_webrtc_data_channel_ext; - -/* Set the default GDNative library */ -godot_error GDAPI godot_net_set_webrtc_library(const godot_net_webrtc_library *); -/* Binds a WebRTCPeerConnectionGDNative to the provided interface */ -void GDAPI godot_net_bind_webrtc_peer_connection(godot_object *p_obj, const godot_net_webrtc_peer_connection *); -/* Binds a WebRTCDataChannelGDNative to the provided interface */ -void GDAPI godot_net_bind_webrtc_data_channel(godot_object *p_obj, const godot_net_webrtc_data_channel *); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_WEBRTC_H diff --git a/nativescript/api_generator.cpp b/nativescript/api_generator.cpp index f5955ef..df6f814 100644 --- a/nativescript/api_generator.cpp +++ b/nativescript/api_generator.cpp @@ -32,8 +32,8 @@ #ifdef TOOLS_ENABLED -#include "core/class_db.h" -#include "core/engine.h" +#include "core/object/class_db.h" +#include "core/config/engine.h" #include "core/global_constants.h" #include "core/os/file_access.h" #include "core/pair.h" diff --git a/nativescript/api_generator.h b/nativescript/api_generator.h index a262565..077c859 100644 --- a/nativescript/api_generator.h +++ b/nativescript/api_generator.h @@ -32,7 +32,7 @@ #define API_GENERATOR_H #include "core/typedefs.h" -#include "core/ustring.h" +#include "core/string/ustring.h" Error generate_c_api(const String &p_path); diff --git a/nativescript/godot_nativescript.cpp b/nativescript/godot_nativescript.cpp index 63c3be8..a999457 100644 --- a/nativescript/godot_nativescript.cpp +++ b/nativescript/godot_nativescript.cpp @@ -30,11 +30,11 @@ #include "nativescript/godot_nativescript.h" -#include "core/class_db.h" -#include "core/error_macros.h" +#include "core/object/class_db.h" +#include "core/error/error_macros.h" #include "core/global_constants.h" -#include "core/project_settings.h" -#include "core/variant.h" +#include "core/config/project_settings.h" +#include "core/variant/variant.h" #include "gdnative/gdnative.h" #include "nativescript.h" diff --git a/nativescript/nativescript.cpp b/nativescript/nativescript.cpp index 3341b31..0800b52 100644 --- a/nativescript/nativescript.cpp +++ b/nativescript/nativescript.cpp @@ -37,7 +37,7 @@ #include "core/io/file_access_encrypted.h" #include "core/os/file_access.h" #include "core/os/os.h" -#include "core/project_settings.h" +#include "core/config/project_settings.h" #include "main/main.h" diff --git a/nativescript/nativescript.h b/nativescript/nativescript.h index d549cdd..56c698e 100644 --- a/nativescript/nativescript.h +++ b/nativescript/nativescript.h @@ -36,10 +36,10 @@ #include "core/oa_hash_map.h" #include "core/ordered_hash_map.h" #include "core/os/thread_safe.h" -#include "core/resource.h" +#include "core/object/resource.h" #include "core/safe_refcount.h" -#include "core/script_language.h" -#include "core/self_list.h" +#include "core/object/script_language.h" +#include "core/containers/self_list.h" #include "scene/main/node.h" #include "modules/gdnative/gdnative.h" diff --git a/net/SCsub b/net/SCsub index b76500c..6f2a018 100644 --- a/net/SCsub +++ b/net/SCsub @@ -5,8 +5,8 @@ Import("env_gdnative") env_net = env_gdnative.Clone() -has_webrtc = env_net["module_webrtc_enabled"] -if has_webrtc: - env_net.Append(CPPDEFINES=["WEBRTC_GDNATIVE_ENABLED"]) +#has_webrtc = env_net["module_webrtc_enabled"] +#if has_webrtc: +# env_net.Append(CPPDEFINES=["WEBRTC_GDNATIVE_ENABLED"]) env_net.add_source_files(env.modules_sources, "*.cpp") diff --git a/net/multiplayer_peer_gdnative.h b/net/multiplayer_peer_gdnative.h index 8ce46de..8c04349 100644 --- a/net/multiplayer_peer_gdnative.h +++ b/net/multiplayer_peer_gdnative.h @@ -32,8 +32,8 @@ #define MULTIPLAYER_PEER_GDNATIVE_H #include "core/io/networked_multiplayer_peer.h" -#include "modules/gdnative/gdnative.h" -#include "modules/gdnative/include/net/godot_net.h" +#include "../gdnative.h" +#include "../include/net/godot_net.h" class MultiplayerPeerGDNative : public NetworkedMultiplayerPeer { GDCLASS(MultiplayerPeerGDNative, NetworkedMultiplayerPeer); diff --git a/net/packet_peer_gdnative.h b/net/packet_peer_gdnative.h index c3ee947..d8ab3d6 100644 --- a/net/packet_peer_gdnative.h +++ b/net/packet_peer_gdnative.h @@ -32,8 +32,8 @@ #define PACKET_PEER_GDNATIVE_H #include "core/io/packet_peer.h" -#include "modules/gdnative/gdnative.h" -#include "modules/gdnative/include/net/godot_net.h" +#include "../gdnative.h" +#include "../include/net/godot_net.h" class PacketPeerGDNative : public PacketPeer { GDCLASS(PacketPeerGDNative, PacketPeer); diff --git a/net/stream_peer_gdnative.h b/net/stream_peer_gdnative.h index ee98953..30ce0a3 100644 --- a/net/stream_peer_gdnative.h +++ b/net/stream_peer_gdnative.h @@ -32,8 +32,8 @@ #define STREAM_PEER_GDNATIVE_H #include "core/io/stream_peer.h" -#include "modules/gdnative/gdnative.h" -#include "modules/gdnative/include/net/godot_net.h" +#include "../gdnative.h" +#include "../include/net/godot_net.h" class StreamPeerGDNative : public StreamPeer { GDCLASS(StreamPeerGDNative, StreamPeer); diff --git a/net/webrtc_gdnative.cpp b/net/webrtc_gdnative.cpp index 579c756..debd08f 100644 --- a/net/webrtc_gdnative.cpp +++ b/net/webrtc_gdnative.cpp @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#include "modules/gdnative/gdnative.h" -#include "modules/gdnative/include/net/godot_net.h" +#include "../gdnative.h" +#include "../include/net/godot_net.h" #ifdef WEBRTC_GDNATIVE_ENABLED -#include "modules/webrtc/webrtc_data_channel_gdnative.h" -#include "modules/webrtc/webrtc_peer_connection_gdnative.h" +#include "webrtc/webrtc_data_channel_gdnative.h" +#include "webrtc/webrtc_peer_connection_gdnative.h" #endif extern "C" { diff --git a/pluginscript/pluginscript_instance.cpp b/pluginscript/pluginscript_instance.cpp index 603ed17..2885166 100644 --- a/pluginscript/pluginscript_instance.cpp +++ b/pluginscript/pluginscript_instance.cpp @@ -32,7 +32,7 @@ // Godot imports #include "core/os/os.h" -#include "core/variant.h" +#include "core/variant/variant.h" // PluginScript imports #include "pluginscript_language.h" diff --git a/pluginscript/pluginscript_instance.h b/pluginscript/pluginscript_instance.h index 03abec6..b03df8d 100644 --- a/pluginscript/pluginscript_instance.h +++ b/pluginscript/pluginscript_instance.h @@ -32,7 +32,7 @@ #define PLUGINSCRIPT_INSTANCE_H // Godot imports -#include "core/script_language.h" +#include "core/object/script_language.h" // PluginScript imports #include diff --git a/pluginscript/pluginscript_language.cpp b/pluginscript/pluginscript_language.cpp index 9fa951e..c12cec7 100644 --- a/pluginscript/pluginscript_language.cpp +++ b/pluginscript/pluginscript_language.cpp @@ -31,7 +31,7 @@ // Godot imports #include "core/os/file_access.h" #include "core/os/os.h" -#include "core/project_settings.h" +#include "core/config/project_settings.h" // PluginScript imports #include "pluginscript_language.h" #include "pluginscript_script.h" diff --git a/pluginscript/pluginscript_language.h b/pluginscript/pluginscript_language.h index 37cd481..d6700f0 100644 --- a/pluginscript/pluginscript_language.h +++ b/pluginscript/pluginscript_language.h @@ -34,9 +34,9 @@ // Godot imports #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/map.h" -#include "core/script_language.h" -#include "core/self_list.h" +#include "core/containers/rb_map.h" +#include "core/object/script_language.h" +#include "core/containers/self_list.h" // PluginScript imports #include "pluginscript_loader.h" #include diff --git a/pluginscript/pluginscript_loader.h b/pluginscript/pluginscript_loader.h index 32f3c12..b305c26 100644 --- a/pluginscript/pluginscript_loader.h +++ b/pluginscript/pluginscript_loader.h @@ -34,7 +34,7 @@ // Godot imports #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/script_language.h" +#include "core/object/script_language.h" class PluginScriptLanguage; diff --git a/pluginscript/pluginscript_script.h b/pluginscript/pluginscript_script.h index ceaf465..f449cd5 100644 --- a/pluginscript/pluginscript_script.h +++ b/pluginscript/pluginscript_script.h @@ -32,7 +32,7 @@ #define PLUGINSCRIPT_SCRIPT_H // Godot imports -#include "core/script_language.h" +#include "core/object/script_language.h" // PluginScript imports #include "pluginscript_language.h" #include diff --git a/pluginscript/register_types.cpp b/pluginscript/register_types.cpp index 40ce126..6851c4b 100644 --- a/pluginscript/register_types.cpp +++ b/pluginscript/register_types.cpp @@ -34,7 +34,7 @@ #include "core/io/resource_saver.h" #include "core/os/dir_access.h" #include "core/os/os.h" -#include "core/project_settings.h" +#include "core/config/project_settings.h" #include "scene/main/scene_tree.h" #include "pluginscript_language.h" diff --git a/register_types.cpp b/register_types.cpp index 771bb62..03292bc 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -30,21 +30,18 @@ #include "register_types.h" -#include "gdnative/gdnative.h" - #include "gdnative.h" -#include "arvr/register_types.h" #include "nativescript/register_types.h" #include "net/register_types.h" #include "pluginscript/register_types.h" #include "videodecoder/register_types.h" -#include "core/engine.h" +#include "core/config/engine.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/os/os.h" -#include "core/project_settings.h" +#include "core/config/project_settings.h" #ifdef TOOLS_ENABLED #include "editor/editor_export.h" @@ -253,120 +250,123 @@ Vector> singleton_gdnatives; Ref resource_loader_gdnlib; Ref resource_saver_gdnlib; -void register_gdnative_types() { +void register_gdnative_types(ModuleRegistrationLevel p_level) { #ifdef TOOLS_ENABLED - - EditorNode::add_init_callback(editor_init_callback); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorNode::add_init_callback(editor_init_callback); + } #endif - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + ClassDB::register_class(); + ClassDB::register_class(); - resource_loader_gdnlib.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_gdnlib); + resource_loader_gdnlib.instance(); + ResourceLoader::add_resource_format_loader(resource_loader_gdnlib); - resource_saver_gdnlib.instance(); - ResourceSaver::add_resource_format_saver(resource_saver_gdnlib); + resource_saver_gdnlib.instance(); + ResourceSaver::add_resource_format_saver(resource_saver_gdnlib); - GDNativeCallRegistry::singleton = memnew(GDNativeCallRegistry); + GDNativeCallRegistry::singleton = memnew(GDNativeCallRegistry); - GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall); + GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall); - register_net_types(); - register_arvr_types(); - register_nativescript_types(); - register_pluginscript_types(); - register_videodecoder_types(); + register_net_types(); + register_nativescript_types(); + register_pluginscript_types(); + register_videodecoder_types(); - // run singletons + // run singletons - Array singletons = Array(); - if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) { - singletons = ProjectSettings::get_singleton()->get("gdnative/singletons"); - } - Array excluded = Array(); - if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons_disabled")) { - excluded = ProjectSettings::get_singleton()->get("gdnative/singletons_disabled"); - } - - for (int i = 0; i < singletons.size(); i++) { - String path = singletons[i]; - - if (excluded.has(path)) { - continue; + Array singletons = Array(); + if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) { + singletons = ProjectSettings::get_singleton()->get("gdnative/singletons"); + } + Array excluded = Array(); + if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons_disabled")) { + excluded = ProjectSettings::get_singleton()->get("gdnative/singletons_disabled"); } - Ref lib = ResourceLoader::load(path); - Ref singleton; - singleton.instance(); - singleton->set_library(lib); + for (int i = 0; i < singletons.size(); i++) { + String path = singletons[i]; - if (!singleton->initialize()) { - // Can't initialize. Don't make a native_call then - continue; - } + if (excluded.has(path)) { + continue; + } - void *proc_ptr; - Error err = singleton->get_symbol( - lib->get_symbol_prefix() + "gdnative_singleton", - proc_ptr); + Ref lib = ResourceLoader::load(path); + Ref singleton; + singleton.instance(); + singleton->set_library(lib); - if (err != OK) { - ERR_PRINT("No " + lib->get_symbol_prefix() + "gdnative_singleton in \"" + singleton->get_library()->get_current_library_path() + "\" found"); - } else { - singleton_gdnatives.push_back(singleton); - ((void (*)())proc_ptr)(); + if (!singleton->initialize()) { + // Can't initialize. Don't make a native_call then + continue; + } + + void *proc_ptr; + Error err = singleton->get_symbol( + lib->get_symbol_prefix() + "gdnative_singleton", + proc_ptr); + + if (err != OK) { + ERR_PRINT("No " + lib->get_symbol_prefix() + "gdnative_singleton in \"" + singleton->get_library()->get_current_library_path() + "\" found"); + } else { + singleton_gdnatives.push_back(singleton); + ((void (*)())proc_ptr)(); + } } } } -void unregister_gdnative_types() { - for (int i = 0; i < singleton_gdnatives.size(); i++) { - if (singleton_gdnatives[i].is_null()) { - continue; - } +void unregister_gdnative_types(ModuleRegistrationLevel p_level) { + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + for (int i = 0; i < singleton_gdnatives.size(); i++) { + if (singleton_gdnatives[i].is_null()) { + continue; + } - if (!singleton_gdnatives[i]->is_initialized()) { - continue; - } + if (!singleton_gdnatives[i]->is_initialized()) { + continue; + } - singleton_gdnatives.write[i]->terminate(); + singleton_gdnatives.write[i]->terminate(); + } + singleton_gdnatives.clear(); + + unregister_videodecoder_types(); + unregister_pluginscript_types(); + unregister_nativescript_types(); + unregister_net_types(); + + memdelete(GDNativeCallRegistry::singleton); + + ResourceLoader::remove_resource_format_loader(resource_loader_gdnlib); + resource_loader_gdnlib.unref(); + + ResourceSaver::remove_resource_format_saver(resource_saver_gdnlib); + resource_saver_gdnlib.unref(); + + // This is for printing out the sizes of the core types + + /* + print_line(String("array:\t") + itos(sizeof(Array))); + print_line(String("basis:\t") + itos(sizeof(Basis))); + print_line(String("color:\t") + itos(sizeof(Color))); + print_line(String("dict:\t" ) + itos(sizeof(Dictionary))); + print_line(String("node_path:\t") + itos(sizeof(NodePath))); + print_line(String("plane:\t") + itos(sizeof(Plane))); + print_line(String("poolarray:\t") + itos(sizeof(PoolByteArray))); + print_line(String("quat:\t") + itos(sizeof(Quat))); + print_line(String("rect2:\t") + itos(sizeof(Rect2))); + print_line(String("aabb:\t") + itos(sizeof(AABB))); + print_line(String("rid:\t") + itos(sizeof(RID))); + print_line(String("string:\t") + itos(sizeof(String))); + print_line(String("transform:\t") + itos(sizeof(Transform))); + print_line(String("transfo2D:\t") + itos(sizeof(Transform2D))); + print_line(String("variant:\t") + itos(sizeof(Variant))); + print_line(String("vector2:\t") + itos(sizeof(Vector2))); + print_line(String("vector3:\t") + itos(sizeof(Vector3))); + */ } - singleton_gdnatives.clear(); - - unregister_videodecoder_types(); - unregister_pluginscript_types(); - unregister_nativescript_types(); - unregister_arvr_types(); - unregister_net_types(); - - memdelete(GDNativeCallRegistry::singleton); - - ResourceLoader::remove_resource_format_loader(resource_loader_gdnlib); - resource_loader_gdnlib.unref(); - - ResourceSaver::remove_resource_format_saver(resource_saver_gdnlib); - resource_saver_gdnlib.unref(); - - // This is for printing out the sizes of the core types - - /* - print_line(String("array:\t") + itos(sizeof(Array))); - print_line(String("basis:\t") + itos(sizeof(Basis))); - print_line(String("color:\t") + itos(sizeof(Color))); - print_line(String("dict:\t" ) + itos(sizeof(Dictionary))); - print_line(String("node_path:\t") + itos(sizeof(NodePath))); - print_line(String("plane:\t") + itos(sizeof(Plane))); - print_line(String("poolarray:\t") + itos(sizeof(PoolByteArray))); - print_line(String("quat:\t") + itos(sizeof(Quat))); - print_line(String("rect2:\t") + itos(sizeof(Rect2))); - print_line(String("aabb:\t") + itos(sizeof(AABB))); - print_line(String("rid:\t") + itos(sizeof(RID))); - print_line(String("string:\t") + itos(sizeof(String))); - print_line(String("transform:\t") + itos(sizeof(Transform))); - print_line(String("transfo2D:\t") + itos(sizeof(Transform2D))); - print_line(String("variant:\t") + itos(sizeof(Variant))); - print_line(String("vector2:\t") + itos(sizeof(Vector2))); - print_line(String("vector3:\t") + itos(sizeof(Vector3))); - */ } diff --git a/register_types.h b/register_types.h index d4dbcb6..84a2f2b 100644 --- a/register_types.h +++ b/register_types.h @@ -1,3 +1,6 @@ +#ifndef GDNATIVE_REGISTER_TYPES_H +#define GDNATIVE_REGISTER_TYPES_H + /**************************************************************************/ /* register_types.h */ /**************************************************************************/ @@ -28,10 +31,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GDNATIVE_REGISTER_TYPES_H -#define GDNATIVE_REGISTER_TYPES_H +#include "modules/register_module_types.h" -void register_gdnative_types(); -void unregister_gdnative_types(); +void register_gdnative_types(ModuleRegistrationLevel p_level); +void unregister_gdnative_types(ModuleRegistrationLevel p_level); #endif // GDNATIVE_REGISTER_TYPES_H diff --git a/videodecoder/register_types.cpp b/videodecoder/register_types.cpp index 917de8c..79db77c 100644 --- a/videodecoder/register_types.cpp +++ b/videodecoder/register_types.cpp @@ -30,7 +30,7 @@ #include "register_types.h" -#include "core/class_db.h" +#include "core/object/class_db.h" #include "video_stream_gdnative.h" static Ref resource_loader_vsgdnative; diff --git a/videodecoder/video_stream_gdnative.cpp b/videodecoder/video_stream_gdnative.cpp index e25eb7a..7fa2cd0 100644 --- a/videodecoder/video_stream_gdnative.cpp +++ b/videodecoder/video_stream_gdnative.cpp @@ -30,7 +30,7 @@ #include "video_stream_gdnative.h" -#include "core/project_settings.h" +#include "core/config/project_settings.h" #include "servers/audio_server.h" VideoDecoderServer *VideoDecoderServer::instance = nullptr;