diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-06-13 15:36:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-13 15:36:55 +0200 |
commit | 4ebf248e1bd12c9faf7c2d19fdef3b41b9766aee (patch) | |
tree | 18e4791551104e9e6a7ae2ff5d7cdb1f921d266b /servers/xr/xr_interface.h | |
parent | ef7974f3d9d51865aac83bfdd2876f39061b87fa (diff) | |
parent | 15c1a7636164567fd0d324003fe8848f8247f0a6 (diff) |
Merge pull request #48207 from BastiaanOlij/multiview_stereoscopic
Add stereoscopic rendering through multiview
Diffstat (limited to 'servers/xr/xr_interface.h')
-rw-r--r-- | servers/xr/xr_interface.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/servers/xr/xr_interface.h b/servers/xr/xr_interface.h index bf026ed773..6031bd7003 100644 --- a/servers/xr/xr_interface.h +++ b/servers/xr/xr_interface.h @@ -35,6 +35,9 @@ #include "core/os/thread_safe.h" #include "servers/xr_server.h" +// forward declaration +struct BlitToScreen; + /** @author Bastiaan Olij <mux213@gmail.com> @@ -105,17 +108,22 @@ public: /** rendering and internal **/ virtual Size2 get_render_targetsize() = 0; /* returns the recommended render target size per eye for this device */ - virtual bool is_stereo() = 0; /* returns true if this interface requires stereo rendering (for VR HMDs) or mono rendering (for mobile AR) */ - virtual Transform3D get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) = 0; /* get each eyes camera transform, also implement EYE_MONO */ - virtual CameraMatrix get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) = 0; /* get each eyes projection matrix */ - virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye); /* if applicable return external texture to render to */ - virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) = 0; /* output the left or right eye */ + virtual uint32_t get_view_count() = 0; /* returns the view count we need (1 is monoscopic, 2 is stereoscopic but can be more) */ + virtual Transform3D get_camera_transform() = 0; /* returns the position of our camera for updating our camera node. For monoscopic this is equal to the views transform, for stereoscopic this should be an average */ + virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) = 0; /* get each views transform */ + virtual CameraMatrix get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) = 0; /* get each view projection matrix */ + + virtual Vector<BlitToScreen> commit_views(RID p_render_target, const Rect2 &p_screen_rect) = 0; /* commit rendered views to the XR interface */ virtual void process() = 0; virtual void notification(int p_what) = 0; XRInterface(); ~XRInterface(); + + // deprecated + virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye); /* if applicable return external texture to render to */ + virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) = 0; /* output the left or right eye */ }; VARIANT_ENUM_CAST(XRInterface::Capabilities); |