diff options
Diffstat (limited to 'modules/gdnative')
-rw-r--r-- | modules/gdnative/SCsub | 45 | ||||
-rw-r--r-- | modules/gdnative/arvr/SCsub (renamed from modules/gdnative/nativearvr/SCsub) | 0 | ||||
-rw-r--r-- | modules/gdnative/arvr/arvr_interface_gdnative.cpp (renamed from modules/gdnative/nativearvr/arvr_interface_gdnative.cpp) | 4 | ||||
-rw-r--r-- | modules/gdnative/arvr/arvr_interface_gdnative.h (renamed from modules/gdnative/nativearvr/arvr_interface_gdnative.h) | 2 | ||||
-rw-r--r-- | modules/gdnative/arvr/config.py (renamed from modules/gdnative/nativearvr/config.py) | 0 | ||||
-rw-r--r-- | modules/gdnative/arvr/register_types.cpp (renamed from modules/gdnative/nativearvr/register_types.cpp) | 4 | ||||
-rw-r--r-- | modules/gdnative/arvr/register_types.h (renamed from modules/gdnative/nativearvr/register_types.h) | 4 | ||||
-rw-r--r-- | modules/gdnative/gdnative.cpp | 2 | ||||
-rw-r--r-- | modules/gdnative/gdnative_api.json | 26 | ||||
-rw-r--r-- | modules/gdnative/include/arvr/godot_arvr.h (renamed from modules/gdnative/include/nativearvr/godot_nativearvr.h) | 4 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/gdnative.h | 2 | ||||
-rw-r--r-- | modules/gdnative/register_types.cpp | 6 |
12 files changed, 65 insertions, 34 deletions
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index c0d1d114d7..88588417d1 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -12,7 +12,7 @@ gdn_env.add_source_files(env.modules_sources, "nativescript/*.cpp") gdn_env.Append(CPPPATH=['#modules/gdnative/include/']) -SConscript("nativearvr/SCsub") +SConscript("arvr/SCsub") SConscript("pluginscript/SCsub") def _spaced(e): @@ -25,7 +25,7 @@ def _build_gdnative_api_struct_header(api): '#define GODOT_GDNATIVE_API_STRUCT_H', '', '#include <gdnative/gdnative.h>', - '#include <nativearvr/godot_nativearvr.h>', + '#include <arvr/godot_arvr.h>', '#include <nativescript/godot_nativescript.h>', '#include <pluginscript/godot_pluginscript.h>', '', @@ -35,34 +35,47 @@ def _build_gdnative_api_struct_header(api): 'extern "C" {', '#endif', '', + 'typedef struct godot_gdnative_api_version {', + '\tunsigned int major;', + '\tunsigned int minor;', + '} godot_gdnative_api_version;', + '', + 'typedef struct godot_gdnative_api_struct {', + '\tunsigned int type;', + '\tgodot_gdnative_api_version version;', + '\tconst godot_gdnative_api_struct *next;', + '} godot_gdnative_api_struct;', + '', 'enum GDNATIVE_API_TYPES {', '\tGDNATIVE_' + api['core']['type'] + ',' ] for name in api['extensions']: - out += ['\tGDNATIVE_' + api['extensions'][name]['type'] + ','] + out += ['\tGDNATIVE_EXT_' + api['extensions'][name]['type'] + ','] out += ['};', ''] for name in api['extensions']: out += [ - 'typedef struct godot_gdnative_' + name + '_api_struct {', + 'typedef struct godot_gdnative_ext_' + name + '_api_struct {', '\tunsigned int type;', - '\tconst void *next;' + '\tgodot_gdnative_api_version version;', + '\tconst godot_gdnative_api_struct *next;' ] for funcdef in api['extensions'][name]['api']: args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) out.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args)) - out += ['} godot_gdnative_' + name + '_api_struct;', ''] + out += ['} godot_gdnative_ext_' + name + '_api_struct;', ''] out += [ - 'typedef struct godot_gdnative_api_struct {', + 'typedef struct godot_gdnative_core_api_struct {', '\tunsigned int type;', - '\tconst void *next;', + '\tgodot_gdnative_api_version version;', + '\tconst godot_gdnative_api_struct *next;', '\tunsigned int num_extensions;', - '\tconst void **extensions;', + '\tconst godot_gdnative_api_struct **extensions;', ] for funcdef in api['core']['api']: @@ -70,7 +83,7 @@ def _build_gdnative_api_struct_header(api): out.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args)) out += [ - '} godot_gdnative_api_struct;', + '} godot_gdnative_core_api_struct;', '', '#ifdef __cplusplus', '}', @@ -91,8 +104,9 @@ def _build_gdnative_api_struct_source(api): for name in api['extensions']: out += [ - 'extern const godot_gdnative_' + name + '_api_struct api_extension_' + name + '_struct = {', - '\tGDNATIVE_' + api['extensions'][name]['type'] + ',', + 'extern const godot_gdnative_ext_' + name + '_api_struct api_extension_' + name + '_struct = {', + '\tGDNATIVE_EXT_' + api['extensions'][name]['type'] + ',', + '\t{' + str(api['extensions'][name]['version']['major']) + ', ' + str(api['extensions'][name]['version']['minor']) + '},', '\tNULL,' ] @@ -101,16 +115,17 @@ def _build_gdnative_api_struct_source(api): out += ['};\n'] - out += ['', 'const void *gdnative_extensions_pointers[] = {'] + out += ['', 'const godot_gdnative_api_struct *gdnative_extensions_pointers[] = {'] for name in api['extensions']: - out += ['\t(void *)&api_extension_' + name + '_struct,'] + out += ['\t(godot_gdnative_api_struct *)&api_extension_' + name + '_struct,'] out += ['};\n'] out += [ - 'extern const godot_gdnative_api_struct api_struct = {', + 'extern const godot_gdnative_core_api_struct api_struct = {', '\tGDNATIVE_' + api['core']['type'] + ',', + '\t{' + str(api['core']['version']['major']) + ', ' + str(api['core']['version']['minor']) + '},', '\tNULL,', '\t' + str(len(api['extensions'])) + ',', '\tgdnative_extensions_pointers,', diff --git a/modules/gdnative/nativearvr/SCsub b/modules/gdnative/arvr/SCsub index ecc5996108..ecc5996108 100644 --- a/modules/gdnative/nativearvr/SCsub +++ b/modules/gdnative/arvr/SCsub diff --git a/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp index e2a7019fa4..02f2ee7424 100644 --- a/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp +++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp @@ -166,11 +166,11 @@ void ARVRInterfaceGDNative::uninitialize() { interface->uninitialize(data); } -Size2 ARVRInterfaceGDNative::get_recommended_render_targetsize() { +Size2 ARVRInterfaceGDNative::get_render_targetsize() { ERR_FAIL_COND_V(interface == NULL, Size2()); - godot_vector2 result = interface->get_recommended_render_targetsize(data); + godot_vector2 result = interface->get_render_targetsize(data); Vector2 *vec = (Vector2 *)&result; return *vec; diff --git a/modules/gdnative/nativearvr/arvr_interface_gdnative.h b/modules/gdnative/arvr/arvr_interface_gdnative.h index e45b51e070..96f7b580d5 100644 --- a/modules/gdnative/nativearvr/arvr_interface_gdnative.h +++ b/modules/gdnative/arvr/arvr_interface_gdnative.h @@ -68,7 +68,7 @@ public: virtual void set_anchor_detection_is_enabled(bool p_enable); /** rendering and internal **/ - virtual Size2 get_recommended_render_targetsize(); + virtual Size2 get_render_targetsize(); virtual bool is_stereo(); virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform); diff --git a/modules/gdnative/nativearvr/config.py b/modules/gdnative/arvr/config.py index 4d1bdfe4d1..4d1bdfe4d1 100644 --- a/modules/gdnative/nativearvr/config.py +++ b/modules/gdnative/arvr/config.py diff --git a/modules/gdnative/nativearvr/register_types.cpp b/modules/gdnative/arvr/register_types.cpp index c7d7847a21..139750a02d 100644 --- a/modules/gdnative/nativearvr/register_types.cpp +++ b/modules/gdnative/arvr/register_types.cpp @@ -31,9 +31,9 @@ #include "register_types.h" #include "arvr_interface_gdnative.h" -void register_nativearvr_types() { +void register_arvr_types() { ClassDB::register_class<ARVRInterfaceGDNative>(); } -void unregister_nativearvr_types() { +void unregister_arvr_types() { } diff --git a/modules/gdnative/nativearvr/register_types.h b/modules/gdnative/arvr/register_types.h index 5e7557c7e9..4918319926 100644 --- a/modules/gdnative/nativearvr/register_types.h +++ b/modules/gdnative/arvr/register_types.h @@ -28,5 +28,5 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -void register_nativearvr_types(); -void unregister_nativearvr_types(); +void register_arvr_types(); +void unregister_arvr_types(); diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 3fc04a5498..832a0cb859 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -41,7 +41,7 @@ const String init_symbol = "godot_gdnative_init"; const String terminate_symbol = "godot_gdnative_terminate"; // Defined in gdnative_api_struct.gen.cpp -extern const godot_gdnative_api_struct api_struct; +extern const godot_gdnative_core_api_struct api_struct; String GDNativeLibrary::platform_names[NUM_PLATFORMS + 1] = { "X11_32bit", diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 2a67911aac..770fb429c7 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -1,6 +1,10 @@ { "core": { - "type": "CORE_1_0_0", + "type": "CORE", + "version": { + "major": 1, + "minor": 0 + }, "api": [ { "name": "godot_color_new_rgba", @@ -5604,7 +5608,11 @@ }, "extensions": { "nativescript": { - "type": "NATIVESCRIPT_1_0_0", + "type": "NATIVESCRIPT", + "version": { + "major": 1, + "minor": 0 + }, "api": [ { "name": "godot_nativescript_register_class", @@ -5670,7 +5678,11 @@ ] }, "pluginscript": { - "type": "PLUGINSCRIPT_1_0_0", + "type": "PLUGINSCRIPT", + "version": { + "major": 1, + "minor": 0 + }, "api": [ { "name": "godot_pluginscript_register_language", @@ -5681,8 +5693,12 @@ } ] }, - "nativearvr": { - "type": "NATIVEARVR_1_0_0", + "arvr": { + "type": "ARVR", + "version": { + "major": 1, + "minor": 0 + }, "api": [ { "name": "godot_arvr_register_interface", diff --git a/modules/gdnative/include/nativearvr/godot_nativearvr.h b/modules/gdnative/include/arvr/godot_arvr.h index a4f4d6a9f1..be13ac954b 100644 --- a/modules/gdnative/include/nativearvr/godot_nativearvr.h +++ b/modules/gdnative/include/arvr/godot_arvr.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* godot_nativearvr.h */ +/* godot_arvr.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -47,7 +47,7 @@ typedef struct { godot_bool (*is_initialized)(const void *); godot_bool (*initialize)(void *); void (*uninitialize)(void *); - godot_vector2 (*get_recommended_render_targetsize)(const 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 *); diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 25d45db306..8fa96fd3af 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -237,7 +237,7 @@ typedef struct { uint64_t editor_api_hash; uint64_t no_api_hash; godot_object *gd_native_library; // pointer to GDNativeLibrary that is being initialized - const struct godot_gdnative_api_struct *api_struct; + const struct godot_gdnative_core_api_struct *api_struct; const godot_string *active_library_path; } godot_gdnative_init_options; diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 87f9cddaa2..19a62b9c4f 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -35,7 +35,7 @@ #include "io/resource_loader.h" #include "io/resource_saver.h" -#include "nativearvr/register_types.h" +#include "arvr/register_types.h" #include "nativescript/register_types.h" #include "pluginscript/register_types.h" @@ -157,7 +157,7 @@ void register_gdnative_types() { GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall); - register_nativearvr_types(); + register_arvr_types(); register_nativescript_types(); register_pluginscript_types(); @@ -214,7 +214,7 @@ void unregister_gdnative_types() { unregister_pluginscript_types(); unregister_nativescript_types(); - unregister_nativearvr_types(); + unregister_arvr_types(); memdelete(GDNativeCallRegistry::singleton); |