Fix size issue for ARVR managed viewport

This commit is contained in:
Bastiaan Olij 2021-12-19 14:51:10 +11:00
parent e937963007
commit 4e4de3430e

View file

@ -288,6 +288,17 @@ void VisualServerViewport::draw_viewports() {
ERR_CONTINUE(!vp->render_target.is_valid()); ERR_CONTINUE(!vp->render_target.is_valid());
if (vp->use_arvr) {
// In ARVR mode it is our interface that controls our size
if (arvr_interface.is_valid()) {
// override our size, make sure it matches our required size
vp->size = arvr_interface->get_render_targetsize();
} else {
// reset this, we can't render the output without a valid interface (this will likely be so when we're in the editor)
vp->size = Vector2(0, 0);
}
}
bool visible = vp->viewport_to_screen_rect != Rect2() || vp->update_mode == VS::VIEWPORT_UPDATE_ALWAYS || vp->update_mode == VS::VIEWPORT_UPDATE_ONCE || (vp->update_mode == VS::VIEWPORT_UPDATE_WHEN_VISIBLE && VSG::storage->render_target_was_used(vp->render_target)); bool visible = vp->viewport_to_screen_rect != Rect2() || vp->update_mode == VS::VIEWPORT_UPDATE_ALWAYS || vp->update_mode == VS::VIEWPORT_UPDATE_ONCE || (vp->update_mode == VS::VIEWPORT_UPDATE_WHEN_VISIBLE && VSG::storage->render_target_was_used(vp->render_target));
visible = visible && vp->size.x > 1 && vp->size.y > 1; visible = visible && vp->size.x > 1 && vp->size.y > 1;
@ -298,8 +309,6 @@ void VisualServerViewport::draw_viewports() {
VSG::storage->render_target_clear_used(vp->render_target); VSG::storage->render_target_clear_used(vp->render_target);
if (vp->use_arvr && arvr_interface.is_valid()) { if (vp->use_arvr && arvr_interface.is_valid()) {
// override our size, make sure it matches our required size
vp->size = arvr_interface->get_render_targetsize();
VSG::storage->render_target_set_size(vp->render_target, vp->size.x, vp->size.y); VSG::storage->render_target_set_size(vp->render_target, vp->size.x, vp->size.y);
// render mono or left eye first // render mono or left eye first