Skip to content
0.2.0-dev Download ZIP
89 lines ·4.1 KB Raw
1/**************************************************************************/
2/* visionos_definitions.h */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#pragma once
32
33#ifdef VISIONOS_ENABLED
34
35#include "core/os/mutex.h"
36#include "core/templates/safe_refcount.h"
37#include "drivers/metal/metal_objects_shared.h"
38#include "drivers/metal/rendering_context_driver_metal.h"
39#include "drivers/metal/rendering_device_driver_metal.h"
40#include "servers/rendering/renderer_compositor.h"
41#include "servers/rendering/rendering_device.h"
42#include "servers/rendering/rendering_server.h"
43#include "servers/xr/xr_controller_tracker.h"
44#include "servers/xr/xr_hand_tracker.h"
45#include "servers/xr/xr_interface.h"
46#include "servers/xr/xr_positional_tracker.h"
47#include "servers/xr/xr_vrs.h"
48
49#ifdef __OBJC__
50// When compiling as Objective-C++, include the actual headers
51#import <ARKit/ARKit.h>
52#else // __OBJC__
53// When compiling as C++, use forward declarations for ARKit and CompositorServices types (opaque pointers)
54typedef struct ar_world_tracking_provider *ar_world_tracking_provider_t;
55typedef struct ar_hand_tracking_provider *ar_hand_tracking_provider_t;
56typedef struct ar_accessory_tracking_provider *ar_accessory_tracking_provider_t;
57typedef struct ar_data_providers *ar_data_providers_t;
58typedef struct ar_data_provider *ar_data_provider_t;
59;
60typedef struct ar_authorization_results *ar_authorization_results_t;
61typedef struct ar_session *ar_session_t;
62typedef struct ar_device_anchor *ar_device_anchor_t;
63typedef struct ar_hand_anchor *ar_hand_anchor_t;
64typedef struct ar_accessories *ar_accessories_t;
65typedef struct ar_accessory_anchor *ar_accessory_anchor_t;
66#endif // __OBJC__
67
68// Equivalent to ARKit's `ar_authorization_status`
69enum class VisionOSAuthorizationStatus {
70 NOT_DETERMINED,
71 ALLOWED,
72 DENIED,
73};
74
75// Trackers used by both VisionOSControllerTracking and VisionOSSpatialEventTracking.
76struct VisionOSSharedController {
77 Ref<XRControllerTracker> tracker;
78
79 enum class Source {
80 None,
81 SpatialEvent,
82 Controller
83 };
84
85 // Spatial Events override controllers, when active.
86 Source source = Source::None;
87};
88
89#endif // VISIONOS_ENABLED