Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
XRInterfaceExtension¶
继承: XRInterface < RefCounted < Object
XR 接口扩展(插件)的基类。
描述¶
外部 XR 接口插件应继承自这个类。
教程¶
方法¶
void |
_end_frame ( ) virtual |
_get_anchor_detection_is_enabled ( ) virtual const |
|
_get_camera_feed_id ( ) virtual const |
|
_get_camera_transform ( ) virtual |
|
_get_capabilities ( ) virtual const |
|
_get_color_texture ( ) virtual |
|
_get_depth_texture ( ) virtual |
|
_get_name ( ) virtual const |
|
_get_play_area ( ) virtual const |
|
_get_play_area_mode ( ) virtual const |
|
_get_projection_for_view ( int view, float aspect, float z_near, float z_far ) virtual |
|
_get_render_target_size ( ) virtual |
|
_get_suggested_pose_names ( StringName tracker_name ) virtual const |
|
_get_suggested_tracker_names ( ) virtual const |
|
_get_system_info ( ) virtual const |
|
_get_tracking_status ( ) virtual const |
|
_get_transform_for_view ( int view, Transform3D cam_transform ) virtual |
|
_get_velocity_texture ( ) virtual |
|
_get_view_count ( ) virtual |
|
_get_vrs_texture ( ) virtual |
|
_initialize ( ) virtual |
|
_is_initialized ( ) virtual const |
|
void |
_post_draw_viewport ( RID render_target, Rect2 screen_rect ) virtual |
_pre_draw_viewport ( RID render_target ) virtual |
|
void |
_pre_render ( ) virtual |
void |
_process ( ) virtual |
void |
_set_anchor_detection_is_enabled ( bool enabled ) virtual |
_set_play_area_mode ( PlayAreaMode mode ) virtual const |
|
_supports_play_area_mode ( PlayAreaMode mode ) virtual const |
|
void |
_trigger_haptic_pulse ( String action_name, StringName tracker_name, float frequency, float amplitude, float duration_sec, float delay_sec ) virtual |
void |
_uninitialize ( ) virtual |
void |
add_blit ( RID render_target, Rect2 src_rect, Rect2i dst_rect, bool use_layer, int layer, bool apply_lens_distortion, Vector2 eye_center, float k1, float k2, float upscale, float aspect_ratio ) |
get_render_target_texture ( RID render_target ) |
|
方法说明¶
void _end_frame ( ) virtual
如果该接口处于活动状态,并且已提交队列,则调用此方法。
bool _get_anchor_detection_is_enabled ( ) virtual const
如果此接口启用了锚点检测,则返回 true
。
int _get_camera_feed_id ( ) virtual const
返回在 CameraServer 上注册的 CameraFeed 的相机源 ID,该 ID 应在支持 AR 的设备(如果适用)上显示为背景。
Transform3D _get_camera_transform ( ) virtual
返回将 XRCamera3D 放置在世界中的 Transform3D。
int _get_capabilities ( ) virtual const
返回该接口的功能。
RID _get_color_texture ( ) virtual
返回接受渲染结果的颜色纹理(如果适用)。
RID _get_depth_texture ( ) virtual
返回接受渲染结果的深度纹理(如果适用)。
StringName _get_name ( ) virtual const
返回该接口的名称。
PackedVector3Array _get_play_area ( ) virtual const
返回表示游戏区域边界的 PackedVector3Array(如果适用)。
PlayAreaMode _get_play_area_mode ( ) virtual const
返回设置我们的游戏区域的 PlayAreaMode。
PackedFloat64Array _get_projection_for_view ( int view, float aspect, float z_near, float z_far ) virtual
返回给定试图的投影矩阵,形式为 PackedFloat64Array。
Vector2 _get_render_target_size ( ) virtual
返回我们在这个接口上的渲染目标大小,覆盖标记为 XR 视口的 Viewport 的大小。
PackedStringArray _get_suggested_pose_names ( StringName tracker_name ) virtual const
返回一个 PackedStringArray,其中包含由此接口配置的姿势名称。请注意,用户的配置可以覆盖此列表。
PackedStringArray _get_suggested_tracker_names ( ) virtual const
返回一个 PackedStringArray,其中包含由此接口配置的追踪器名称。请注意,用户的配置可以覆盖此列表。
Dictionary _get_system_info ( ) virtual const
返回包含与这个接口相关的系统信息的 Dictionary。
TrackingStatus _get_tracking_status ( ) virtual const
返回指定当前追踪状态的 TrackingStatus。
Transform3D _get_transform_for_view ( int view, Transform3D cam_transform ) virtual
返回给定视图的 Transform3D。
RID _get_velocity_texture ( ) virtual
返回作为渲染目标的速度纹理(如果适用)。
int _get_view_count ( ) virtual
返回此接口所需的视图数量,1 代表单目平面视图,2 代表双目立体视图。
RID _get_vrs_texture ( ) virtual
目前没有这个方法的描述。请帮我们贡献一个!
bool _initialize ( ) virtual
初始化该接口,成功时返回 true
。
bool _is_initialized ( ) virtual const
如果这个接口已初始化,则返回 true
。
void _post_draw_viewport ( RID render_target, Rect2 screen_rect ) virtual
在 XR Viewport 绘制逻辑完成后调用。
bool _pre_draw_viewport ( RID render_target ) virtual
如果这是我们的主要 XRInterfaceExtension,则在我们开始为每个活动的 XR Viewport 处理 Viewport 之前调用,如果该视口应该被渲染,则返回 true
。如果用户摘下头戴式设备,XR 接口可能会返回 false
,我们可以暂停渲染。
void _pre_render ( ) virtual
如果这个 XRInterfaceExtension 在渲染开始前处于激活状态,则会调用这个函数,大多数 XR 接口都会在此时进行追踪同步。
void _process ( ) virtual
如果这个 XRInterfaceExtension 在调用我们的物理和游戏处理前处于激活状态,则会调用这个函数。大多数 XR 接口都会在此时更新其 XRPositionalTracker。
void _set_anchor_detection_is_enabled ( bool enabled ) virtual
如果支持,则在此接口上启用锚点检测。
bool _set_play_area_mode ( PlayAreaMode mode ) virtual const
设置该接口的游玩区域模式。
bool _supports_play_area_mode ( PlayAreaMode mode ) virtual const
如果该接口支持该游玩区域模式,则返回 true
。
void _trigger_haptic_pulse ( String action_name, StringName tracker_name, float frequency, float amplitude, float duration_sec, float delay_sec ) virtual
在指定的追踪器上触发一次触觉脉冲。
void _uninitialize ( ) virtual
将该接口取消初始化。
void add_blit ( RID render_target, Rect2 src_rect, Rect2i dst_rect, bool use_layer, int layer, bool apply_lens_distortion, Vector2 eye_center, float k1, float k2, float upscale, float aspect_ratio )
将我们的渲染结果传输到屏幕上,还可以在此过程中应用镜头失真。只能在处理 _commit_views
时调用。
RID get_color_texture ( )
目前没有这个方法的描述。请帮我们贡献一个!
RID get_depth_texture ( )
目前没有这个方法的描述。请帮我们贡献一个!
RID get_render_target_texture ( RID render_target )
如果接口支持,则返回一个纹理的有效 RID,我们应更将当前帧渲染至该纹理。
RID get_velocity_texture ( )
目前没有这个方法的描述。请帮我们贡献一个!