Merge pull request #45444 from dsnopek/webxr-master-mono
Support mono devices in WebXR
This commit is contained in:
commit
9d3a9b3e7d
3 changed files with 12 additions and 3 deletions
|
@ -61,6 +61,7 @@ extern void godot_webxr_initialize(
|
||||||
GodotWebXRSimpleEventCallback p_on_simple_event);
|
GodotWebXRSimpleEventCallback p_on_simple_event);
|
||||||
extern void godot_webxr_uninitialize();
|
extern void godot_webxr_uninitialize();
|
||||||
|
|
||||||
|
extern int godot_webxr_get_view_count();
|
||||||
extern int *godot_webxr_get_render_targetsize();
|
extern int *godot_webxr_get_render_targetsize();
|
||||||
extern float *godot_webxr_get_transform_for_eye(int p_eye);
|
extern float *godot_webxr_get_transform_for_eye(int p_eye);
|
||||||
extern float *godot_webxr_get_projection_for_eye(int p_eye);
|
extern float *godot_webxr_get_projection_for_eye(int p_eye);
|
||||||
|
|
|
@ -394,6 +394,15 @@ const GodotWebXR = {
|
||||||
GodotWebXR.pauseResumeMainLoop();
|
GodotWebXR.pauseResumeMainLoop();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
godot_webxr_get_view_count__proxy: 'sync',
|
||||||
|
godot_webxr_get_view_count__sig: 'i',
|
||||||
|
godot_webxr_get_view_count: function () {
|
||||||
|
if (!GodotWebXR.session || !GodotWebXR.pose) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return GodotWebXR.pose.views.length;
|
||||||
|
},
|
||||||
|
|
||||||
godot_webxr_get_render_targetsize__proxy: 'sync',
|
godot_webxr_get_render_targetsize__proxy: 'sync',
|
||||||
godot_webxr_get_render_targetsize__sig: 'i',
|
godot_webxr_get_render_targetsize__sig: 'i',
|
||||||
godot_webxr_get_render_targetsize: function () {
|
godot_webxr_get_render_targetsize: function () {
|
||||||
|
|
|
@ -197,12 +197,11 @@ StringName WebXRInterfaceJS::get_name() const {
|
||||||
};
|
};
|
||||||
|
|
||||||
int WebXRInterfaceJS::get_capabilities() const {
|
int WebXRInterfaceJS::get_capabilities() const {
|
||||||
return XRInterface::XR_STEREO;
|
return XRInterface::XR_STEREO | XRInterface::XR_MONO;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool WebXRInterfaceJS::is_stereo() {
|
bool WebXRInterfaceJS::is_stereo() {
|
||||||
// @todo WebXR can be mono! So, how do we know? Count the views in the frame?
|
return godot_webxr_get_view_count() == 2;
|
||||||
return true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool WebXRInterfaceJS::is_initialized() const {
|
bool WebXRInterfaceJS::is_initialized() const {
|
||||||
|
|
Loading…
Reference in a new issue