| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "servers/xr/xr_interface.h" |
| 34 |
|
| 35 |
class XRInterfaceExtension : public XRInterface { |
| 36 |
GDCLASS(XRInterfaceExtension, XRInterface); |
| 37 |
|
| 38 |
public: |
| 39 |
private: |
| 40 |
bool can_add_blits = false; |
| 41 |
Vector<BlitToScreen> blits; |
| 42 |
|
| 43 |
protected: |
| 44 |
_THREAD_SAFE_CLASS_ |
| 45 |
|
| 46 |
static void _bind_methods(); |
| 47 |
|
| 48 |
public: |
| 49 |
|
| 50 |
virtual StringName get_name() const override; |
| 51 |
virtual uint32_t get_capabilities() const override; |
| 52 |
|
| 53 |
GDVIRTUAL0RC(StringName, _get_name); |
| 54 |
GDVIRTUAL0RC(uint32_t, _get_capabilities); |
| 55 |
|
| 56 |
virtual bool is_initialized() const override; |
| 57 |
virtual bool initialize() override; |
| 58 |
virtual void uninitialize() override; |
| 59 |
virtual Dictionary get_system_info() override; |
| 60 |
|
| 61 |
GDVIRTUAL0RC(bool, _is_initialized); |
| 62 |
GDVIRTUAL0R(bool, _initialize); |
| 63 |
GDVIRTUAL0(_uninitialize); |
| 64 |
GDVIRTUAL0RC(Dictionary, _get_system_info); |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
virtual PackedStringArray get_suggested_tracker_names() const override; |
| 69 |
virtual PackedStringArray get_suggested_pose_names(const StringName &p_tracker_name) const override; |
| 70 |
virtual TrackingStatus get_tracking_status() const override; |
| 71 |
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) override; |
| 72 |
|
| 73 |
GDVIRTUAL0RC(PackedStringArray, _get_suggested_tracker_names); |
| 74 |
GDVIRTUAL1RC(PackedStringArray, _get_suggested_pose_names, const StringName &); |
| 75 |
GDVIRTUAL0RC(XRInterface::TrackingStatus, _get_tracking_status); |
| 76 |
GDVIRTUAL6(_trigger_haptic_pulse, const String &, const StringName &, double, double, double, double); |
| 77 |
|
| 78 |
|
| 79 |
virtual bool supports_play_area_mode(XRInterface::PlayAreaMode p_mode) override; |
| 80 |
virtual XRInterface::PlayAreaMode get_play_area_mode() const override; |
| 81 |
virtual bool set_play_area_mode(XRInterface::PlayAreaMode p_mode) override; |
| 82 |
virtual PackedVector3Array get_play_area() const override; |
| 83 |
|
| 84 |
GDVIRTUAL1RC(bool, _supports_play_area_mode, XRInterface::PlayAreaMode); |
| 85 |
GDVIRTUAL0RC(XRInterface::PlayAreaMode, _get_play_area_mode); |
| 86 |
GDVIRTUAL1RC(bool, _set_play_area_mode, XRInterface::PlayAreaMode); |
| 87 |
GDVIRTUAL0RC(PackedVector3Array, _get_play_area); |
| 88 |
|
| 89 |
|
| 90 |
virtual bool get_anchor_detection_is_enabled() const override; |
| 91 |
virtual void set_anchor_detection_is_enabled(bool p_enable) override; |
| 92 |
virtual int get_camera_feed_id() override; |
| 93 |
|
| 94 |
GDVIRTUAL0RC(bool, _get_anchor_detection_is_enabled); |
| 95 |
GDVIRTUAL1(_set_anchor_detection_is_enabled, bool); |
| 96 |
GDVIRTUAL0RC(int, _get_camera_feed_id); |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
virtual Size2 get_render_target_size() override; |
| 101 |
virtual uint32_t get_view_count() override; |
| 102 |
virtual Transform3D get_camera_transform() override; |
| 103 |
virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override; |
| 104 |
virtual Projection get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override; |
| 105 |
virtual RID get_vrs_texture() override; |
| 106 |
virtual VRSTextureFormat get_vrs_texture_format() override; |
| 107 |
virtual RID get_color_texture() override; |
| 108 |
virtual RID get_depth_texture() override; |
| 109 |
virtual RID get_velocity_texture() override; |
| 110 |
|
| 111 |
GDVIRTUAL0R(Size2, _get_render_target_size); |
| 112 |
GDVIRTUAL0R(uint32_t, _get_view_count); |
| 113 |
GDVIRTUAL0R(Transform3D, _get_camera_transform); |
| 114 |
GDVIRTUAL2R(Transform3D, _get_transform_for_view, uint32_t, const Transform3D &); |
| 115 |
GDVIRTUAL4R(PackedFloat64Array, _get_projection_for_view, uint32_t, double, double, double); |
| 116 |
GDVIRTUAL0R(RID, _get_vrs_texture); |
| 117 |
GDVIRTUAL0R(VRSTextureFormat, _get_vrs_texture_format); |
| 118 |
GDVIRTUAL0R(RID, _get_color_texture); |
| 119 |
GDVIRTUAL0R(RID, _get_depth_texture); |
| 120 |
GDVIRTUAL0R(RID, _get_velocity_texture); |
| 121 |
|
| 122 |
void add_blit(RID p_render_target, Rect2 p_src_rect, Rect2i p_dst_rect, bool p_use_layer = false, uint32_t p_layer = 0, bool p_apply_lens_distortion = false, Vector2 p_eye_center = Vector2(), double p_k1 = 0.0, double p_k2 = 0.0, double p_upscale = 1.0, double p_aspect_ratio = 1.0); |
| 123 |
|
| 124 |
virtual void process() override; |
| 125 |
virtual void pre_render() override; |
| 126 |
virtual bool pre_draw_viewport(RID p_render_target) override; |
| 127 |
virtual Vector<BlitToScreen> post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) override; |
| 128 |
virtual void end_frame() override; |
| 129 |
|
| 130 |
GDVIRTUAL0(_process); |
| 131 |
GDVIRTUAL0(_pre_render); |
| 132 |
GDVIRTUAL1R(bool, _pre_draw_viewport, RID); |
| 133 |
GDVIRTUAL2(_post_draw_viewport, RID, const Rect2 &); |
| 134 |
GDVIRTUAL0(_end_frame); |
| 135 |
|
| 136 |
|
| 137 |
RID get_render_target_texture(RID p_render_target); |
| 138 |
|
| 139 |
}; |