Godot Engine – Multi-platform 2D and 3D game engine
/**************************************************************************/
/* visionos_definitions.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. */
/**************************************************************************/
#pragma once
#ifdef VISIONOS_ENABLED
#include "core/os/mutex.h"
#include "core/templates/safe_refcount.h"
#include "drivers/metal/metal_objects_shared.h"
#include "drivers/metal/rendering_context_driver_metal.h"
#include "drivers/metal/rendering_device_driver_metal.h"
#include "servers/rendering/renderer_compositor.h"
#include "servers/rendering/rendering_device.h"
#include "servers/rendering/rendering_server.h"
#include "servers/xr/xr_controller_tracker.h"
#include "servers/xr/xr_hand_tracker.h"
#include "servers/xr/xr_interface.h"
#include "servers/xr/xr_positional_tracker.h"
#include "servers/xr/xr_vrs.h"
#ifdef __OBJC__
// When compiling as Objective-C++, include the actual headers
#import <ARKit/ARKit.h>
#else // __OBJC__
// When compiling as C++, use forward declarations for ARKit and CompositorServices types (opaque pointers)
typedef struct ar_world_tracking_provider *ar_world_tracking_provider_t;
typedef struct ar_hand_tracking_provider *ar_hand_tracking_provider_t;
typedef struct ar_accessory_tracking_provider *ar_accessory_tracking_provider_t;
typedef struct ar_data_providers *ar_data_providers_t;
typedef struct ar_data_provider *ar_data_provider_t;
;
typedef struct ar_authorization_results *ar_authorization_results_t;
typedef struct ar_session *ar_session_t;
typedef struct ar_device_anchor *ar_device_anchor_t;
typedef struct ar_hand_anchor *ar_hand_anchor_t;
typedef struct ar_accessories *ar_accessories_t;
typedef struct ar_accessory_anchor *ar_accessory_anchor_t;
#endif // __OBJC__
// Equivalent to ARKit's `ar_authorization_status`
enum class VisionOSAuthorizationStatus {
NOT_DETERMINED,
ALLOWED,
DENIED,
};
// Trackers used by both VisionOSControllerTracking and VisionOSSpatialEventTracking.
struct VisionOSSharedController {
Ref<XRControllerTracker> tracker;
enum class Source {
None,
SpatialEvent,
Controller
};
// Spatial Events override controllers, when active.
Source source = Source::None;
};
#endif // VISIONOS_ENABLED