2023-01-05 13:25:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*  mobile_vr_interface.h                                                 */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                         This file is part of:                          */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                             GODOT ENGINE                               */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                        https://godotengine.org                         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Permission is hereby granted, free of charge, to any person obtaining  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* a copy of this software and associated documentation files (the        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* "Software"), to deal in the Software without restriction, including    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* without limitation the rights to use, copy, modify, merge, publish,    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* distribute, sublicense, and/or sell copies of the Software, and to     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* permit persons to whom the Software is furnished to do so, subject to  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* the following conditions:                                              */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* The above copyright notice and this permission notice shall be         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* included in all copies or substantial portions of the Software.        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
									
										
										
										
											2018-01-05 00:50:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# ifndef MOBILE_VR_INTERFACE_H 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define MOBILE_VR_INTERFACE_H 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-09 00:47:36 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "servers/xr/xr_interface.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "servers/xr/xr_positional_tracker.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									The  mobile  interface  is  a  native  VR  interface  that  can  be  used  on  Android  and  iOS  phones . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									It  contains  a  basic  implementation  supporting  3 DOF  tracking  if  a  gyroscope  and  accelerometer  are 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									present  and  sets  up  the  proper  projection  matrices  based  on  the  values  provided . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									We ' re  planning  to  eventually  do  separate  interfaces  towards  mobile  SDKs  that  have  far  more  capabilities  and 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									do  not  rely  on  the  user  providing  most  of  these  settings  ( though  enhancing  this  with  auto  detection  features 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									based  on  the  device  we ' re  running  on  would  be  cool ) .  I ' m  mostly  adding  this  as  an  example  or  base  plate  for 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									more  advanced  interfaces . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-09 00:47:36 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class  MobileVRInterface  :  public  XRInterface  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									GDCLASS ( MobileVRInterface ,  XRInterface ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								private :  
						 
					
						
							
								
									
										
										
										
											2021-02-08 10:57:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  initialized  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-23 15:23:16 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									XRInterface : : TrackingStatus  tracking_state ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 19:21:06 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									XRPose : : TrackingConfidence  tracking_confidence  =  XRPose : : XR_TRACKING_CONFIDENCE_NONE ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-08 10:57:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Just set some defaults for these. At some point we need to look at adding a lookup table for common device + headset combos and/or support reading cardboard QR codes
 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									double  eye_height  =  1.85 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-08 10:57:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uint64_t  last_ticks  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									double  intraocular_dist  =  6.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  display_width  =  14.5 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  display_to_lens  =  4.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  oversample  =  1.5 ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-02 16:25:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Rect2  offset_rect  =  Rect2 ( 0 ,  0 ,  1 ,  1 ) ;  // Full screen rect.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									double  k1  =  0.215 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  k2  =  0.215 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  aspect  =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-29 16:05:11 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// at a minimum we need a tracker for our head
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < XRPositionalTracker >  head ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Transform3D  head_transform ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									/*
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										logic  for  processing  our  sensor  data ,  this  was  originally  in  our  positional  tracker  logic  but  I  think 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										that  doesn ' t  make  sense  in  hindsight .  It  only  makes  marginally  more  sense  to  park  it  here  for  now , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										this  probably  deserves  an  object  of  its  own 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector3  scale_magneto ( const  Vector3  & p_magnetometer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Basis  combine_acc_mag ( const  Vector3  & p_grav ,  const  Vector3  & p_magneto ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-08 10:57:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  mag_count  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  has_gyro  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  sensor_first  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Vector3  last_accerometer_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector3  last_magnetometer_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector3  mag_current_min ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector3  mag_current_max ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector3  mag_next_min ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector3  mag_next_max ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									///@TODO a few support functions for trackers, most are math related and should likely be moved elsewhere
 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-15 16:45:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  floor_decimals ( const  float  p_value ,  const  float  p_decimals )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-19 19:41:36 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  power_of_10  =  pow ( 10.0f ,  p_decimals ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  floor ( p_value  *  power_of_10 )  /  power_of_10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-15 16:45:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector3  floor_decimals ( const  Vector3  & p_vector ,  const  float  p_decimals )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  Vector3 ( floor_decimals ( p_vector . x ,  p_decimals ) ,  floor_decimals ( p_vector . y ,  p_decimals ) ,  floor_decimals ( p_vector . z ,  p_decimals ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-15 16:45:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector3  low_pass ( const  Vector3  & p_vector ,  const  Vector3  & p_last_vector ,  const  float  p_factor )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  p_vector  +  ( p_factor  *  ( p_last_vector  -  p_vector ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-15 16:45:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector3  scrub ( const  Vector3  & p_vector ,  const  Vector3  & p_last_vector ,  const  float  p_decimals ,  const  float  p_factor )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  low_pass ( floor_decimals ( p_vector ,  p_decimals ) ,  p_last_vector ,  p_factor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  set_position_from_sensors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								protected :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  void  _bind_methods ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_eye_height ( const  double  p_eye_height ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  get_eye_height ( )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-10 00:14:10 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_iod ( const  double  p_iod ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  get_iod ( )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_display_width ( const  double  p_display_width ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  get_display_width ( )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-02 16:25:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_offset_rect ( const  Rect2  & p_offset_rect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Rect2  get_offset_rect ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_display_to_lens ( const  double  p_display_to_lens ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  get_display_to_lens ( )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_oversample ( const  double  p_oversample ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  get_oversample ( )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_k1 ( const  double  p_k1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  get_k1 ( )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 14:32:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_k2 ( const  double  p_k2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  get_k2 ( )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-10 11:34:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  StringName  get_name ( )  const  override ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-23 15:23:16 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  uint32_t  get_capabilities ( )  const  override ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									virtual  TrackingStatus  get_tracking_status ( )  const  override ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-10 11:34:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  bool  is_initialized ( )  const  override ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									virtual  bool  initialize ( )  override ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									virtual  void  uninitialize ( )  override ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-13 12:26:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  Dictionary  get_system_info ( )  override ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-27 21:51:30 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  bool  supports_play_area_mode ( XRInterface : : PlayAreaMode  p_mode )  override ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									virtual  XRInterface : : PlayAreaMode  get_play_area_mode ( )  const  override ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									virtual  bool  set_play_area_mode ( XRInterface : : PlayAreaMode  p_mode )  override ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-23 15:23:16 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  Size2  get_render_target_size ( )  override ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-07 23:19:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  uint32_t  get_view_count ( )  override ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									virtual  Transform3D  get_camera_transform ( )  override ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									virtual  Transform3D  get_transform_for_view ( uint32_t  p_view ,  const  Transform3D  & p_cam_transform )  override ; 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  Projection  get_projection_for_view ( uint32_t  p_view ,  double  p_aspect ,  double  p_z_near ,  double  p_z_far )  override ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-26 12:25:20 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  Vector < BlitToScreen >  post_draw_viewport ( RID  p_render_target ,  const  Rect2  & p_screen_rect )  override ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-10 11:34:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  void  process ( )  override ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-28 22:15:21 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MobileVRInterface ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									~ MobileVRInterface ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-04 20:26:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif  // MOBILE_VR_INTERFACE_H