Merge pull request #98831 from dsnopek/openxr-gdextension-pre-post-draw-viewport

OpenXR: Allow GDExtensions to implement `_on_pre_draw_viewport()` and `_on_post_draw_viewport()`
This commit is contained in:
Thaddeus Crews 2024-11-05 18:36:12 -06:00
commit 1559645112
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
3 changed files with 29 additions and 0 deletions

View File

@ -90,6 +90,21 @@
Called right after the main swapchains are (re)created.
</description>
</method>
<method name="_on_post_draw_viewport" qualifiers="virtual">
<return type="void" />
<param index="0" name="viewport" type="RID" />
<description>
Called right after the given viewport is rendered.
[b]Note:[/b] The draw commands might only be queued at this point, not executed.
</description>
</method>
<method name="_on_pre_draw_viewport" qualifiers="virtual">
<return type="void" />
<param index="0" name="viewport" type="RID" />
<description>
Called right before the given viewport is rendered.
</description>
</method>
<method name="_on_pre_render" qualifiers="virtual">
<return type="void" />
<description>

View File

@ -51,6 +51,8 @@ void OpenXRExtensionWrapperExtension::_bind_methods() {
GDVIRTUAL_BIND(_on_process);
GDVIRTUAL_BIND(_on_pre_render);
GDVIRTUAL_BIND(_on_main_swapchains_created);
GDVIRTUAL_BIND(_on_pre_draw_viewport, "viewport");
GDVIRTUAL_BIND(_on_post_draw_viewport, "viewport");
GDVIRTUAL_BIND(_on_session_destroyed);
GDVIRTUAL_BIND(_on_state_idle);
GDVIRTUAL_BIND(_on_state_ready);
@ -208,6 +210,14 @@ void OpenXRExtensionWrapperExtension::on_session_destroyed() {
GDVIRTUAL_CALL(_on_session_destroyed);
}
void OpenXRExtensionWrapperExtension::on_pre_draw_viewport(RID p_render_target) {
GDVIRTUAL_CALL(_on_pre_draw_viewport, p_render_target);
}
void OpenXRExtensionWrapperExtension::on_post_draw_viewport(RID p_render_target) {
GDVIRTUAL_CALL(_on_post_draw_viewport, p_render_target);
}
void OpenXRExtensionWrapperExtension::on_state_idle() {
GDVIRTUAL_CALL(_on_state_idle);
}

View File

@ -88,6 +88,8 @@ public:
virtual void on_pre_render() override;
virtual void on_main_swapchains_created() override;
virtual void on_session_destroyed() override;
virtual void on_pre_draw_viewport(RID p_render_target) override;
virtual void on_post_draw_viewport(RID p_render_target) override;
GDVIRTUAL0(_on_register_metadata);
GDVIRTUAL0(_on_before_instance_created);
@ -98,6 +100,8 @@ public:
GDVIRTUAL0(_on_pre_render);
GDVIRTUAL0(_on_main_swapchains_created);
GDVIRTUAL0(_on_session_destroyed);
GDVIRTUAL1(_on_pre_draw_viewport, RID);
GDVIRTUAL1(_on_post_draw_viewport, RID);
virtual void on_state_idle() override;
virtual void on_state_ready() override;