Skip to content

Commit

Permalink
Merge pull request #98831 from dsnopek/openxr-gdextension-pre-post-dr…
Browse files Browse the repository at this point in the history
…aw-viewport

OpenXR: Allow GDExtensions to implement `_on_pre_draw_viewport()` and `_on_post_draw_viewport()`
  • Loading branch information
Repiteo committed Nov 6, 2024
2 parents 0976c6a + c72eb04 commit 1559645
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions modules/openxr/doc_classes/OpenXRExtensionWrapperExtension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
10 changes: 10 additions & 0 deletions modules/openxr/extensions/openxr_extension_wrapper_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class OpenXRExtensionWrapperExtension : public Object, public OpenXRExtensionWra
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);
Expand All @@ -98,6 +100,8 @@ class OpenXRExtensionWrapperExtension : public Object, public OpenXRExtensionWra
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;
Expand Down

0 comments on commit 1559645

Please sign in to comment.