summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-07-07 16:31:06 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-07-15 14:37:21 +0200
commit3d8acc7a54d8c2c261c3ce3c1c1022f4641985de (patch)
treee9a00103fd36bef4783ec4a90a9da3ff7699b9d5 /modules
parent6ddaebc0910d7a145b0fb1ffe4f6cdb1cc011f59 (diff)
[HTML5] Fix build (with module_webxr_enabled=no).
The XR API changed a bit, and it's not just a rename, though probably an easy update for someone who is qualified :).
Diffstat (limited to 'modules')
-rw-r--r--modules/webrtc/webrtc_peer_connection_js.cpp5
-rw-r--r--modules/webxr/webxr_interface_js.cpp8
-rw-r--r--modules/webxr/webxr_interface_js.h2
3 files changed, 7 insertions, 8 deletions
diff --git a/modules/webrtc/webrtc_peer_connection_js.cpp b/modules/webrtc/webrtc_peer_connection_js.cpp
index 8879f7d6ec..2b63e76358 100644
--- a/modules/webrtc/webrtc_peer_connection_js.cpp
+++ b/modules/webrtc/webrtc_peer_connection_js.cpp
@@ -34,7 +34,6 @@
#include "webrtc_data_channel_js.h"
-#include "core/io/json.h"
#include "emscripten.h"
void WebRTCPeerConnectionJS::_on_ice_candidate(void *p_obj, const char *p_mid_name, int p_mline_idx, const char *p_candidate) {
@@ -100,7 +99,7 @@ Error WebRTCPeerConnectionJS::initialize(Dictionary p_config) {
}
_conn_state = STATE_NEW;
- String config = JSON::print(p_config);
+ String config = Variant(p_config).to_json_string();
_js_id = godot_js_rtc_pc_create(config.utf8().get_data(), this, &_on_connection_state_changed, &_on_ice_candidate, &_on_data_channel);
return _js_id ? OK : FAILED;
}
@@ -108,7 +107,7 @@ Error WebRTCPeerConnectionJS::initialize(Dictionary p_config) {
Ref<WebRTCDataChannel> WebRTCPeerConnectionJS::create_data_channel(String p_channel, Dictionary p_channel_config) {
ERR_FAIL_COND_V(_conn_state != STATE_NEW, nullptr);
- String config = JSON::print(p_channel_config);
+ String config = Variant(p_channel_config).to_json_string();
int id = godot_js_rtc_pc_datachannel_create(_js_id, p_channel.utf8().get_data(), config.utf8().get_data());
ERR_FAIL_COND_V(id == 0, nullptr);
return memnew(WebRTCDataChannelJS(id));
diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp
index 2eab0cdb07..01cc05aa0b 100644
--- a/modules/webxr/webxr_interface_js.cpp
+++ b/modules/webxr/webxr_interface_js.cpp
@@ -202,8 +202,8 @@ int WebXRInterfaceJS::get_capabilities() const {
return XRInterface::XR_STEREO | XRInterface::XR_MONO;
};
-bool WebXRInterfaceJS::is_stereo() {
- return godot_webxr_get_view_count() == 2;
+uint32_t WebXRInterfaceJS::get_view_count() {
+ return godot_webxr_get_view_count();
};
bool WebXRInterfaceJS::is_initialized() const {
@@ -425,7 +425,7 @@ void WebXRInterfaceJS::_update_tracker(int p_controller_id) {
int *buttons = godot_webxr_get_controller_buttons(p_controller_id);
if (buttons) {
for (int i = 0; i < buttons[0]; i++) {
- input->joy_button(p_controller_id + 100, i, *((float *)buttons + (i + 1)));
+ input->joy_button(p_controller_id + 100, (JoyButton)i, *((float *)buttons + (i + 1)));
}
free(buttons);
}
@@ -436,7 +436,7 @@ void WebXRInterfaceJS::_update_tracker(int p_controller_id) {
Input::JoyAxisValue joy_axis;
joy_axis.min = -1;
joy_axis.value = *((float *)axes + (i + 1));
- input->joy_axis(p_controller_id + 100, i, joy_axis);
+ input->joy_axis(p_controller_id + 100, (JoyAxis)i, joy_axis);
}
free(axes);
}
diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h
index 723ab952cd..3b5509adeb 100644
--- a/modules/webxr/webxr_interface_js.h
+++ b/modules/webxr/webxr_interface_js.h
@@ -83,7 +83,7 @@ public:
virtual void uninitialize() override;
virtual Size2 get_render_targetsize() override;
- virtual bool is_stereo() override;
+ 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;
virtual CameraMatrix get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) override;