Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
315df87
4.1.3-stable
Makosai Nov 14, 2023
d0a13d3
Create a CI for Godot 4.x
Makosai Nov 14, 2023
d60f0c5
Update ci_4_x.yml
Makosai Nov 14, 2023
97e48dd
Update generate_headers.sh
Makosai Nov 14, 2023
fc06f15
Update CameraMatrix to Projection
Makosai Nov 14, 2023
732fbf8
Update arkit_interface
Makosai Nov 15, 2023
d311ad6
Update arkit
Makosai Nov 15, 2023
97e31c8
Update arkit
Makosai Nov 15, 2023
f91748c
Update arkit_interface.h
Makosai Nov 15, 2023
1f23c75
Merge branch 'master' of github.com:Makosai/godot-ios-plugins-4.x
Makosai Nov 15, 2023
00f5feb
Update arkit_interface.mm
Makosai Nov 15, 2023
d6da370
Update arkit_interface.mm
Makosai Nov 15, 2023
223383b
Update arkit_interface.h
Makosai Nov 15, 2023
b4abc3f
Update arkit_module.cpp
Makosai Nov 15, 2023
1f589a1
4.1.3-stable
Makosai Nov 14, 2023
78abe1e
Create a CI for Godot 4.x
Makosai Nov 14, 2023
6abe422
Update ci_4_x.yml
Makosai Nov 14, 2023
5fdcd02
Update CameraMatrix to Projection
Makosai Nov 14, 2023
c48d597
Update arkit
Makosai Nov 15, 2023
d5db217
Update arkit_interface.h
Makosai Nov 15, 2023
84fd93f
Update arkit_interface
Makosai Nov 15, 2023
4cc3998
Update arkit
Makosai Nov 15, 2023
1be861a
Update arkit_interface.mm
Makosai Nov 15, 2023
1de11b6
Update arkit_interface.mm
Makosai Nov 15, 2023
021e904
Update arkit_interface.h
Makosai Nov 15, 2023
25bfac9
Update arkit_module.cpp
Makosai Nov 15, 2023
7f95055
Update Godot submodule
celyk Feb 16, 2025
6456f8b
Remove unnecessary function overrides
celyk Feb 18, 2025
22dd88b
Update generate_headers.sh for Godot 4.3
celyk Feb 18, 2025
e89efb7
Fix CI
celyk Feb 19, 2025
3bb934d
Implement blit
celyk Feb 19, 2025
a4da8cd
Bugfix orientations
celyk Feb 19, 2025
c382e84
Bugfix anchor pose
celyk Feb 20, 2025
4f165f0
Added ARKitAnchorMesh
celyk Feb 22, 2025
857e7d2
Hook up interface with ARKitAnchorMesh
celyk Feb 22, 2025
4bdaf98
Attempt to expose the class to GDScript
celyk Feb 22, 2025
2c3da44
Fire the tracker_updated signal
celyk Feb 22, 2025
a496fcb
Fix indents
celyk Feb 22, 2025
b8a1da4
Add head tracker
celyk Feb 22, 2025
29d5f21
Add exposure offset
celyk Feb 24, 2025
bc208a2
Orient the ARKit raycast
celyk Feb 24, 2025
3cd7157
Allow ambient_color_temperature
celyk Feb 24, 2025
f39b23a
Prevent crashing. Memory is already freed
celyk Feb 24, 2025
f90a37b
Update all VERSION_MAJOR directives to support Godot 5
Makosai Apr 24, 2025
7112a78
Merge branch 'master' into master
Makosai Apr 24, 2025
fdd9a9c
Merge branch 'pr/74'
Makosai Apr 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/ci_4_x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Continuous integration 4.x
on: [push, pull_request]

jobs:
build:
name: Build (macOS)
runs-on: "macos-latest"

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'

- name: Configuring Python
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version

- name: Generate Headers
run: |
./scripts/generate_headers.sh 4.0 || true

- name: Compile Plugins
run: |
./scripts/release_xcframework.sh 4.0
ls -l bin/release

- uses: actions/upload-artifact@v4
with:
name: plugins
path: bin/release/*
retention-days: 4
if-no-files-found: error
2 changes: 1 addition & 1 deletion godot
Submodule godot updated 12537 files
2 changes: 1 addition & 1 deletion plugins/apn/apn.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include "core/version.h"

#if VERSION_MAJOR == 4
#if VERSION_MAJOR >= 4
#include "core/object/class_db.h"
#else
#include "core/object.h"
Expand Down
2 changes: 1 addition & 1 deletion plugins/apn/apn.mm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#import <Foundation/Foundation.h>

#if VERSION_MAJOR == 4
#if VERSION_MAJOR >= 4
#include "core/object/class_db.h"
#include "core/config/project_settings.h"
#else
Expand Down
2 changes: 1 addition & 1 deletion plugins/apn/apn_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#import "apn_plugin.h"
#import "apn.h"

#if VERSION_MAJOR == 4
#if VERSION_MAJOR >= 4
#import "core/config/engine.h"
#else
#import "core/engine.h"
Expand Down
2 changes: 1 addition & 1 deletion plugins/apn/godot_apn_delegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#import "godot_user_notification_delegate.h"

#if VERSION_MAJOR == 4
#if VERSION_MAJOR >= 4
#import "platform/ios/godot_app_delegate.h"
#else
#import "platform/iphone/godot_app_delegate.h"
Expand Down
2 changes: 1 addition & 1 deletion plugins/apn/godot_app_delegate_extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "core/version.h"

#if VERSION_MAJOR == 4
#if VERSION_MAJOR >= 4
#import "platform/ios/godot_app_delegate.h"
#else
#import "platform/iphone/godot_app_delegate.h"
Expand Down
59 changes: 59 additions & 0 deletions plugins/arkit/arkit_anchor_mesh.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*************************************************************************/
/* arkit_interface.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 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 ARKIT_ANCHOR_MESH_H
#define ARKIT_ANCHOR_MESH_H

#include "core/os/os.h"
#include "core/version.h"
#include "scene/resources/surface_tool.h"

#include "servers/xr/xr_interface.h"
#include "servers/xr/xr_positional_tracker.h"

class ARKitAnchorMesh : public XRPositionalTracker {
GDCLASS(ARKitAnchorMesh, XRPositionalTracker);
_THREAD_SAFE_CLASS_

private:
Ref<Mesh> mesh;

protected:
static void _bind_methods();

public:
void set_mesh(Ref<Mesh> mesh);
Ref<Mesh> get_mesh() const;

ARKitAnchorMesh();
~ARKitAnchorMesh();
};

#endif /* !ARKIT_ANCHOR_MESH_H */
76 changes: 76 additions & 0 deletions plugins/arkit/arkit_anchor_mesh.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*************************************************************************/
/* arkit_interface.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 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. */
/*************************************************************************/

#include "core/os/os.h"
#include "core/version.h"
#include "scene/resources/surface_tool.h"

#include "core/input/input.h"
#include "servers/rendering/rendering_server_globals.h"

#define GODOT_FOCUS_IN_NOTIFICATION DisplayServer::WINDOW_EVENT_FOCUS_IN
#define GODOT_FOCUS_OUT_NOTIFICATION DisplayServer::WINDOW_EVENT_FOCUS_OUT

#define GODOT_MAKE_THREAD_SAFE ;

#define GODOT_AR_STATE_NOT_TRACKING XRInterface::XR_NOT_TRACKING
#define GODOT_AR_STATE_NORMAL_TRACKING XRInterface::XR_NORMAL_TRACKING
#define GODOT_AR_STATE_EXCESSIVE_MOTION XRInterface::XR_EXCESSIVE_MOTION
#define GODOT_AR_STATE_INSUFFICIENT_FEATURES XRInterface::XR_INSUFFICIENT_FEATURES
#define GODOT_AR_STATE_UNKNOWN_TRACKING XRInterface::XR_UNKNOWN_TRACKING

#import <ARKit/ARKit.h>
#import <UIKit/UIKit.h>

#include <dlfcn.h>

#include "arkit_anchor_mesh.h"

void ARKitAnchorMesh::set_mesh(Ref<Mesh> p_mesh) {
mesh = p_mesh;
}

Ref<Mesh> ARKitAnchorMesh::get_mesh() const {
return mesh;
}

void ARKitAnchorMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &ARKitAnchorMesh::set_mesh);
ClassDB::bind_method(D_METHOD("get_mesh"), &ARKitAnchorMesh::get_mesh);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh");
}

ARKitAnchorMesh::ARKitAnchorMesh(){
mesh = NULL;
}

ARKitAnchorMesh::~ARKitAnchorMesh(){

}
81 changes: 64 additions & 17 deletions plugins/arkit/arkit_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@

#include "core/version.h"

#if VERSION_MAJOR == 4
#if VERSION_MAJOR >= 4
#include "servers/xr/xr_interface.h"
#include "servers/xr/xr_positional_tracker.h"
#include "arkit_anchor_mesh.h"

typedef XRInterface GodotBaseARInterface;
typedef XRPositionalTracker GodotARTracker;
typedef ARKitAnchorMesh GodotARTracker;

typedef Vector<uint8_t> GodotUInt8Vector;

Expand Down Expand Up @@ -82,16 +83,22 @@ class ARKitInterface : public GodotBaseARInterface {
bool light_estimation_is_enabled;
real_t ambient_intensity;
real_t ambient_color_temperature;
real_t exposure_offset;

Transform transform;
CameraMatrix projection;
Ref<XRPositionalTracker> m_head;
Transform3D transform;
Projection projection;
float eye_height, z_near, z_far;

Ref<CameraFeed> feed;
size_t image_width[2];
size_t image_height[2];
GodotUInt8Vector img_data[2];

#if VERSION_MAJOR >= 4
XRInterface::TrackingStatus tracking_state;
#endif

struct anchor_map {
GodotARTracker *tracker;
unsigned char uuid[16];
Expand All @@ -111,36 +118,76 @@ class ARKitInterface : public GodotBaseARInterface {
public:
void start_session();
void stop_session();

bool get_anchor_detection_is_enabled() const GODOT_ARKIT_OVERRIDE;
void set_anchor_detection_is_enabled(bool p_enable) GODOT_ARKIT_OVERRIDE;
virtual int get_camera_feed_id() GODOT_ARKIT_OVERRIDE;

bool get_light_estimation_is_enabled() const;
void set_light_estimation_is_enabled(bool p_enable);

real_t get_ambient_intensity() const;
real_t get_ambient_color_temperature() const;
real_t get_exposure_offset() const;

/* while Godot has its own raycast logic this takes ARKits camera into account and hits on any ARAnchor */
Array raycast(Vector2 p_screen_coord);

virtual void notification(int p_what) GODOT_ARKIT_OVERRIDE;

virtual StringName get_name() const GODOT_ARKIT_OVERRIDE;
virtual int get_capabilities() const GODOT_ARKIT_OVERRIDE;
virtual uint32_t get_capabilities() const GODOT_ARKIT_OVERRIDE;

virtual bool is_initialized() const GODOT_ARKIT_OVERRIDE;
virtual bool initialize() GODOT_ARKIT_OVERRIDE;
virtual void uninitialize() GODOT_ARKIT_OVERRIDE;
virtual Dictionary get_system_info() GODOT_ARKIT_OVERRIDE;

virtual PackedStringArray get_suggested_tracker_names() const GODOT_ARKIT_OVERRIDE;
virtual PackedStringArray get_suggested_pose_names(const StringName &p_tracker_name) const GODOT_ARKIT_OVERRIDE;

/** input and output **/
virtual TrackingStatus get_tracking_status() const GODOT_ARKIT_OVERRIDE { return tracking_state; };

virtual void trigger_haptic_pulse(const String &p_action_name, const StringName &p_tracker_name, double p_frequency, double p_amplitude, double p_duration_sec, double p_delay_sec = 0) GODOT_ARKIT_OVERRIDE; /* trigger a haptic pulse */

virtual bool supports_play_area_mode(XRInterface::PlayAreaMode p_mode) GODOT_ARKIT_OVERRIDE;
virtual XRInterface::PlayAreaMode get_play_area_mode() const GODOT_ARKIT_OVERRIDE;
virtual bool set_play_area_mode(XRInterface::PlayAreaMode p_mode) GODOT_ARKIT_OVERRIDE;
virtual PackedVector3Array get_play_area() const GODOT_ARKIT_OVERRIDE;

/** specific to AR **/
virtual bool get_anchor_detection_is_enabled() const GODOT_ARKIT_OVERRIDE;
virtual void set_anchor_detection_is_enabled(bool p_enable) GODOT_ARKIT_OVERRIDE;
virtual int get_camera_feed_id() GODOT_ARKIT_OVERRIDE;

virtual Size2 get_render_target_size() GODOT_ARKIT_OVERRIDE;
virtual uint32_t get_view_count() GODOT_ARKIT_OVERRIDE;
virtual Transform3D get_camera_transform() GODOT_ARKIT_OVERRIDE;
virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) GODOT_ARKIT_OVERRIDE;
virtual Projection get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) GODOT_ARKIT_OVERRIDE;

virtual RID get_vrs_texture() GODOT_ARKIT_OVERRIDE;
virtual RID get_color_texture() GODOT_ARKIT_OVERRIDE;
virtual RID get_depth_texture() GODOT_ARKIT_OVERRIDE;
virtual RID get_velocity_texture() GODOT_ARKIT_OVERRIDE;

virtual Size2 get_render_targetsize() GODOT_ARKIT_OVERRIDE;
virtual bool is_stereo() GODOT_ARKIT_OVERRIDE;
virtual Transform get_transform_for_eye(GodotBaseARInterface::Eyes p_eye, const Transform &p_cam_transform) GODOT_ARKIT_OVERRIDE;
virtual CameraMatrix get_projection_for_eye(GodotBaseARInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) GODOT_ARKIT_OVERRIDE;
virtual void commit_for_eye(GodotBaseARInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) GODOT_ARKIT_OVERRIDE;
/** rendering and internal **/

virtual Transform3D get_camera_transform() GODOT_ARKIT_OVERRIDE;
virtual void process() GODOT_ARKIT_OVERRIDE;
virtual void pre_render() GODOT_ARKIT_OVERRIDE;
virtual bool pre_draw_viewport(RID p_render_target) GODOT_ARKIT_OVERRIDE;
virtual Vector<BlitToScreen> post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) GODOT_ARKIT_OVERRIDE;
virtual void end_frame() GODOT_ARKIT_OVERRIDE;

virtual bool is_passthrough_supported() GODOT_ARKIT_OVERRIDE;
virtual bool is_passthrough_enabled() GODOT_ARKIT_OVERRIDE;
virtual bool start_passthrough() GODOT_ARKIT_OVERRIDE;
virtual void stop_passthrough() GODOT_ARKIT_OVERRIDE;

virtual Array get_supported_environment_blend_modes() GODOT_ARKIT_OVERRIDE;
virtual bool set_environment_blend_mode(EnvironmentBlendMode mode) GODOT_ARKIT_OVERRIDE;

virtual Size2 get_render_target_size() GODOT_ARKIT_OVERRIDE;
virtual uint32_t get_view_count() GODOT_ARKIT_OVERRIDE;
virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) GODOT_ARKIT_OVERRIDE;
virtual Projection get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) GODOT_ARKIT_OVERRIDE;

virtual Vector<BlitToScreen> post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) GODOT_ARKIT_OVERRIDE;

// called by delegate (void * because C++ and Obj-C don't always mix, should really change all platform/ios/*.cpp files to .mm)
void _add_or_update_anchor(GodotARAnchor *p_anchor);
Expand Down
Loading