From 1b76f391ebca26e9b177f1162e8e124a81ae8b1e Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Mon, 25 Jan 2021 11:19:09 -0800 Subject: [PATCH 01/14] fix native input usage for uwp --- .../windows/BabylonReactNative/EngineView.cpp | 63 ++++++++++++++----- .../windows/BabylonReactNative/EngineView.h | 15 +++-- .../windows/BabylonReactNative/pch.h | 1 + 3 files changed, 56 insertions(+), 23 deletions(-) diff --git a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp index d499e416f..b20f095a8 100644 --- a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp +++ b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp @@ -2,17 +2,38 @@ #include "EngineView.h" #include "EngineView.g.cpp" +using namespace winrt::Windows::Foundation; +using namespace winrt::Windows::System::Threading; +using namespace winrt::Windows::UI::Core; using namespace winrt::Windows::UI::Xaml; using namespace winrt::Windows::UI::Xaml::Input; using namespace winrt::Windows::UI::Xaml::Media; using namespace winrt::Windows::UI::Xaml::Controls; namespace winrt::BabylonReactNative::implementation { - EngineView::EngineView() { + EngineView::EngineView() { + _revokerData.SizeChangedRevoker = SizeChanged(winrt::auto_revoke, { this, &EngineView::OnSizeChanged }); - _revokerData.PointerPressedRevoker = PointerPressed(winrt::auto_revoke, { this, &EngineView::OnPointerPressed }); - _revokerData.PointerMovedRevoker = PointerMoved(winrt::auto_revoke, { this, &EngineView::OnPointerMoved }); - _revokerData.PointerReleasedRevoker = PointerReleased(winrt::auto_revoke, { this, &EngineView::OnPointerReleased }); + + WorkItemHandler workItemHandler([weakThis{ this->get_weak() }](IAsyncAction const& /* action */) + { + if (auto trueThis = weakThis.get()) + { + auto deviceTypes = static_cast( + static_cast(Windows::UI::Core::CoreInputDeviceTypes::Mouse) | + static_cast(Windows::UI::Core::CoreInputDeviceTypes::Touch) | + static_cast(Windows::UI::Core::CoreInputDeviceTypes::Pen)); + auto coreInput = trueThis->CreateCoreIndependentInputSource(deviceTypes); + + trueThis->_revokerData.PointerPressedRevoker = coreInput.PointerPressed(winrt::auto_revoke, { trueThis.get(), &EngineView::OnPointerPressed }); + trueThis->_revokerData.PointerMovedRevoker = coreInput.PointerMoved(winrt::auto_revoke, { trueThis.get(), &EngineView::OnPointerMoved }); + trueThis->_revokerData.PointerReleasedRevoker = coreInput.PointerReleased(winrt::auto_revoke, { trueThis.get(), &EngineView::OnPointerReleased }); + + coreInput.Dispatcher().ProcessEvents(Windows::UI::Core::CoreProcessEventsOption::ProcessUntilQuit); + } + }); + + _inputLoopWorker = ThreadPool::RunAsync(workItemHandler, WorkItemPriority::High, WorkItemOptions::TimeSliced); _revokerData.RenderingRevoker = CompositionTarget::Rendering(winrt::auto_revoke, [weakThis{ this->get_weak() }](auto const&, auto const&) { @@ -35,32 +56,40 @@ namespace winrt::BabylonReactNative::implementation { Babylon::UpdateView(windowPtr, _width, _height, windowTypePtr); } - void EngineView::OnPointerPressed(IInspectable const& /*sender*/, PointerRoutedEventArgs const& args) + void EngineView::OnPointerPressed(IInspectable const& /*sender*/, PointerEventArgs const& args) { - const auto pointerId = args.Pointer().PointerId(); + const auto point = args.CurrentPoint(); + const auto pointerId = point.PointerId(); + _pressedPointers.insert(pointerId); + const auto buttonId = 0; // Update as needed - const auto point = args.GetCurrentPoint(*this); const auto position = point.Position(); const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); Babylon::SetPointerButtonState(pointerId, buttonId, true, x, y); } - void EngineView::OnPointerMoved(IInspectable const& /*sender*/, PointerRoutedEventArgs const& args) + void EngineView::OnPointerMoved(IInspectable const& /*sender*/, PointerEventArgs const& args) { - const auto pointerId = args.Pointer().PointerId(); - const auto point = args.GetCurrentPoint(*this); - const auto position = point.Position(); - const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); - const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); - Babylon::SetPointerPosition(pointerId, x, y); + const auto point = args.CurrentPoint(); + const auto pointerId = point.PointerId(); + + if (_pressedPointers.count(pointerId) > 0) + { + const auto position = point.Position(); + const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); + const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); + Babylon::SetPointerPosition(pointerId, x, y); + } } - void EngineView::OnPointerReleased(IInspectable const& /*sender*/, PointerRoutedEventArgs const& args) + void EngineView::OnPointerReleased(IInspectable const& /*sender*/, PointerEventArgs const& args) { - const auto pointerId = args.Pointer().PointerId(); + const auto point = args.CurrentPoint(); + const auto pointerId = point.PointerId(); + _pressedPointers.erase(pointerId); + const auto buttonId = 0; // Update as needed - const auto point = args.GetCurrentPoint(*this); const auto position = point.Position(); const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); diff --git a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.h b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.h index 6f4a2a8cb..c93abfac1 100644 --- a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.h +++ b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.h @@ -1,5 +1,6 @@ #pragma once #include "EngineView.g.h" +#include namespace winrt::BabylonReactNative::implementation { struct EngineView : EngineViewT @@ -9,20 +10,22 @@ namespace winrt::BabylonReactNative::implementation { private: void OnSizeChanged(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::SizeChangedEventArgs const& args); - void OnPointerPressed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::PointerRoutedEventArgs const& args); - void OnPointerMoved(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::PointerRoutedEventArgs const& args); - void OnPointerReleased(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::PointerRoutedEventArgs const& args); + void OnPointerPressed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Core::PointerEventArgs const& args); + void OnPointerMoved(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Core::PointerEventArgs const& args); + void OnPointerReleased(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Core::PointerEventArgs const& args); void OnRendering(); size_t _width{ 1 }; size_t _height{ 1 }; + winrt::Windows::Foundation::IAsyncAction _inputLoopWorker{}; + std::unordered_set _pressedPointers{}; struct RevokerData { winrt::Windows::UI::Xaml::FrameworkElement::SizeChanged_revoker SizeChangedRevoker{}; - winrt::Windows::UI::Xaml::FrameworkElement::PointerPressed_revoker PointerPressedRevoker{}; - winrt::Windows::UI::Xaml::FrameworkElement::PointerMoved_revoker PointerMovedRevoker{}; - winrt::Windows::UI::Xaml::FrameworkElement::PointerReleased_revoker PointerReleasedRevoker{}; + winrt::Windows::UI::Core::CoreIndependentInputSource::PointerPressed_revoker PointerPressedRevoker{}; + winrt::Windows::UI::Core::CoreIndependentInputSource::PointerMoved_revoker PointerMovedRevoker{}; + winrt::Windows::UI::Core::CoreIndependentInputSource::PointerReleased_revoker PointerReleasedRevoker{}; winrt::Windows::UI::Xaml::Media::CompositionTarget::Rendering_revoker RenderingRevoker{}; }; RevokerData _revokerData{}; diff --git a/Modules/@babylonjs/react-native/windows/BabylonReactNative/pch.h b/Modules/@babylonjs/react-native/windows/BabylonReactNative/pch.h index 731f30feb..25a5f69f1 100644 --- a/Modules/@babylonjs/react-native/windows/BabylonReactNative/pch.h +++ b/Modules/@babylonjs/react-native/windows/BabylonReactNative/pch.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include From e72ccc65ec01656da9c061043b14dd4614027def Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Mon, 25 Jan 2021 14:48:54 -0800 Subject: [PATCH 02/14] branch ready for native input --- .gitmodules | 2 +- .../react-native/shared/BabylonNative.cpp | 21 +++++++++++-------- .../react-native/shared/BabylonNative.h | 4 ++-- .../react-native/submodules/BabylonNative | 2 +- .../windows/BabylonReactNative/EngineView.cpp | 12 +++++++---- .../windows/BabylonReactNative/pch.h | 1 + 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6383857a2..fabc4f0a7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Core/react-native-babylon/submodules/BabylonNative"] path = Modules/@babylonjs/react-native/submodules/BabylonNative - url = https://github.com/BabylonJS/BabylonNative.git + url = https://github.com/chrisfromwork/BabylonNative.git diff --git a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp index ed46642b9..4b2257da7 100644 --- a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp +++ b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp @@ -12,6 +12,7 @@ namespace Babylon { + using namespace Babylon::Plugins; using namespace facebook; namespace @@ -136,21 +137,23 @@ namespace Babylon }); } - void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y) + void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y, bool isMouse) { + const auto deviceType = isMouse ? NativeInput::DeviceType::Mouse : NativeInput::DeviceType::Touch; if (isDown) { - m_nativeInput->PointerDown(pointerId, buttonId, x, y); + m_nativeInput->PointerDown(pointerId, buttonId, x, y, deviceType); } else { - m_nativeInput->PointerUp(pointerId, buttonId, x, y); + m_nativeInput->PointerUp(pointerId, buttonId, x, y, deviceType); } } - void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y) + void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y, bool isMouse) { - m_nativeInput->PointerMove(pointerId, x, y); + const auto deviceType = isMouse ? NativeInput::DeviceType::Mouse : NativeInput::DeviceType::Touch; + m_nativeInput->PointerMove(pointerId, x, y, deviceType); } jsi::Value get(jsi::Runtime& runtime, const jsi::PropNameID& prop) override @@ -255,19 +258,19 @@ namespace Babylon } } - void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y) + void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y, bool isMouse) { if (auto nativeModule{ g_nativeModule.lock() }) { - nativeModule->SetPointerButtonState(pointerId, buttonId, isDown, x, y); + nativeModule->SetPointerButtonState(pointerId, buttonId, isDown, x, y, isMouse); } } - void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y) + void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y, bool isMouse) { if (auto nativeModule{ g_nativeModule.lock() }) { - nativeModule->SetPointerPosition(pointerId, x, y); + nativeModule->SetPointerPosition(pointerId, x, y, isMouse); } } } diff --git a/Modules/@babylonjs/react-native/shared/BabylonNative.h b/Modules/@babylonjs/react-native/shared/BabylonNative.h index 88d348c63..953aff2da 100644 --- a/Modules/@babylonjs/react-native/shared/BabylonNative.h +++ b/Modules/@babylonjs/react-native/shared/BabylonNative.h @@ -10,6 +10,6 @@ namespace Babylon void Deinitialize(); void UpdateView(void* windowPtr, size_t width, size_t height, void* windowTypePtr = nullptr); void RenderView(); - void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y); - void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y); + void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y, bool isMouse = false); + void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y, bool isMouse = false); } diff --git a/Modules/@babylonjs/react-native/submodules/BabylonNative b/Modules/@babylonjs/react-native/submodules/BabylonNative index 4fb4abede..344b34d7a 160000 --- a/Modules/@babylonjs/react-native/submodules/BabylonNative +++ b/Modules/@babylonjs/react-native/submodules/BabylonNative @@ -1 +1 @@ -Subproject commit 4fb4abede658640965ff61c84cdbee098cdd0089 +Subproject commit 344b34d7abd939a0142a5506b59e050c2d82c57b diff --git a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp index b20f095a8..68b859576 100644 --- a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp +++ b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp @@ -2,6 +2,7 @@ #include "EngineView.h" #include "EngineView.g.cpp" +using namespace winrt::Windows::Devices::Input; using namespace winrt::Windows::Foundation; using namespace winrt::Windows::System::Threading; using namespace winrt::Windows::UI::Core; @@ -11,7 +12,7 @@ using namespace winrt::Windows::UI::Xaml::Media; using namespace winrt::Windows::UI::Xaml::Controls; namespace winrt::BabylonReactNative::implementation { - EngineView::EngineView() { + EngineView::EngineView() { _revokerData.SizeChangedRevoker = SizeChanged(winrt::auto_revoke, { this, &EngineView::OnSizeChanged }); @@ -64,9 +65,10 @@ namespace winrt::BabylonReactNative::implementation { const auto buttonId = 0; // Update as needed const auto position = point.Position(); + const bool isMouse = point.PointerDevice().PointerDeviceType() == PointerDeviceType::Mouse; const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); - Babylon::SetPointerButtonState(pointerId, buttonId, true, x, y); + Babylon::SetPointerButtonState(pointerId, buttonId, true, x, y, isMouse); } void EngineView::OnPointerMoved(IInspectable const& /*sender*/, PointerEventArgs const& args) @@ -77,9 +79,10 @@ namespace winrt::BabylonReactNative::implementation { if (_pressedPointers.count(pointerId) > 0) { const auto position = point.Position(); + const bool isMouse = point.PointerDevice().PointerDeviceType() == PointerDeviceType::Mouse; const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); - Babylon::SetPointerPosition(pointerId, x, y); + Babylon::SetPointerPosition(pointerId, x, y, isMouse); } } @@ -91,9 +94,10 @@ namespace winrt::BabylonReactNative::implementation { const auto buttonId = 0; // Update as needed const auto position = point.Position(); + const bool isMouse = point.PointerDevice().PointerDeviceType() == PointerDeviceType::Mouse; const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); - Babylon::SetPointerButtonState(pointerId, buttonId, false, x, y); + Babylon::SetPointerButtonState(pointerId, buttonId, false, x, y, isMouse); } void EngineView::OnRendering() diff --git a/Modules/@babylonjs/react-native/windows/BabylonReactNative/pch.h b/Modules/@babylonjs/react-native/windows/BabylonReactNative/pch.h index 25a5f69f1..37999c7d0 100644 --- a/Modules/@babylonjs/react-native/windows/BabylonReactNative/pch.h +++ b/Modules/@babylonjs/react-native/windows/BabylonReactNative/pch.h @@ -3,6 +3,7 @@ #define NOMINMAX #include +#include #include #include #include From 347037858a159a58510fc69db116722317760c15 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Mon, 25 Jan 2021 16:01:44 -0800 Subject: [PATCH 03/14] get app working with mouse input events --- .gitmodules | 2 +- Apps/Playground/App.tsx | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index fabc4f0a7..6383857a2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Core/react-native-babylon/submodules/BabylonNative"] path = Modules/@babylonjs/react-native/submodules/BabylonNative - url = https://github.com/chrisfromwork/BabylonNative.git + url = https://github.com/BabylonJS/BabylonNative.git diff --git a/Apps/Playground/App.tsx b/Apps/Playground/App.tsx index 11a340d1a..16539ed14 100644 --- a/Apps/Playground/App.tsx +++ b/Apps/Playground/App.tsx @@ -50,6 +50,15 @@ const EngineScreen: FunctionComponent = (props: ViewProps) => { } } }) + } else if (device.deviceType === DeviceType.Mouse) { + const mouse: DeviceSource = deviceSourceManager.getDeviceSource(device.deviceType, device.deviceSlot)!; + mouse.onInputChangedObservable.add(mouseEvent => { + if (mouseEvent.inputIndex === PointerInput.Horizontal) { + if (mouseEvent.currentState && mouseEvent.previousState) { + rootNode.rotate(Vector3.Down(), (mouseEvent.currentState - mouseEvent.previousState) * 0.005); + } + } + }); } }) From e54f263fd7bed2f0a72af3e6bb140a5d21156141 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Mon, 25 Jan 2021 16:02:13 -0800 Subject: [PATCH 04/14] move to different submodule commits --- Modules/@babylonjs/react-native/submodules/BabylonNative | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/@babylonjs/react-native/submodules/BabylonNative b/Modules/@babylonjs/react-native/submodules/BabylonNative index 344b34d7a..074495f59 160000 --- a/Modules/@babylonjs/react-native/submodules/BabylonNative +++ b/Modules/@babylonjs/react-native/submodules/BabylonNative @@ -1 +1 @@ -Subproject commit 344b34d7abd939a0142a5506b59e050c2d82c57b +Subproject commit 074495f591e365db5d89a8642b7e2fbd4b630a79 From 08f13142be8c6ceb3c88e4431c8484f5e02f67f1 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Tue, 26 Jan 2021 10:54:06 -0800 Subject: [PATCH 05/14] avoid exposing device type --- Modules/@babylonjs/react-native/shared/BabylonNative.cpp | 8 +++----- Modules/@babylonjs/react-native/submodules/BabylonNative | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp index 4b2257da7..437d50fdb 100644 --- a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp +++ b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp @@ -139,21 +139,19 @@ namespace Babylon void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y, bool isMouse) { - const auto deviceType = isMouse ? NativeInput::DeviceType::Mouse : NativeInput::DeviceType::Touch; if (isDown) { - m_nativeInput->PointerDown(pointerId, buttonId, x, y, deviceType); + m_nativeInput->PointerDown(pointerId, buttonId, x, y, isMouse); } else { - m_nativeInput->PointerUp(pointerId, buttonId, x, y, deviceType); + m_nativeInput->PointerUp(pointerId, buttonId, x, y, isMouse); } } void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y, bool isMouse) { - const auto deviceType = isMouse ? NativeInput::DeviceType::Mouse : NativeInput::DeviceType::Touch; - m_nativeInput->PointerMove(pointerId, x, y, deviceType); + m_nativeInput->PointerMove(pointerId, x, y, isMouse); } jsi::Value get(jsi::Runtime& runtime, const jsi::PropNameID& prop) override diff --git a/Modules/@babylonjs/react-native/submodules/BabylonNative b/Modules/@babylonjs/react-native/submodules/BabylonNative index 074495f59..fb915e295 160000 --- a/Modules/@babylonjs/react-native/submodules/BabylonNative +++ b/Modules/@babylonjs/react-native/submodules/BabylonNative @@ -1 +1 @@ -Subproject commit 074495f591e365db5d89a8642b7e2fbd4b630a79 +Subproject commit fb915e29549b3260b79cc860427119c35099b795 From a3cb801f1b6bc6772a8b9aeb467a510a25535f51 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Wed, 27 Jan 2021 09:28:10 -0800 Subject: [PATCH 06/14] update content to reflect BabylonNative pr --- Apps/Playground/App.tsx | 8 +- .../src/main/cpp/BabylonNativeInterop.cpp | 4 +- .../react-native/ios/BabylonNativeInterop.mm | 6 +- .../react-native/shared/BabylonNative.cpp | 65 ++++++++++--- .../react-native/shared/BabylonNative.h | 6 +- .../react-native/submodules/BabylonNative | 2 +- .../windows/BabylonReactNative/EngineView.cpp | 97 +++++++++++++++---- .../windows/BabylonReactNative/EngineView.h | 3 +- 8 files changed, 143 insertions(+), 48 deletions(-) diff --git a/Apps/Playground/App.tsx b/Apps/Playground/App.tsx index 16539ed14..d852264f0 100644 --- a/Apps/Playground/App.tsx +++ b/Apps/Playground/App.tsx @@ -53,10 +53,10 @@ const EngineScreen: FunctionComponent = (props: ViewProps) => { } else if (device.deviceType === DeviceType.Mouse) { const mouse: DeviceSource = deviceSourceManager.getDeviceSource(device.deviceType, device.deviceSlot)!; mouse.onInputChangedObservable.add(mouseEvent => { - if (mouseEvent.inputIndex === PointerInput.Horizontal) { - if (mouseEvent.currentState && mouseEvent.previousState) { - rootNode.rotate(Vector3.Down(), (mouseEvent.currentState - mouseEvent.previousState) * 0.005); - } + if (mouse.getInput(PointerInput.LeftClick) && + mouseEvent.inputIndex === PointerInput.Horizontal && + mouseEvent.currentState && mouseEvent.previousState) { + rootNode.rotate(Vector3.Down(), (mouseEvent.currentState - mouseEvent.previousState) * 0.005); } }); } diff --git a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp index 182f6f004..3868c9c65 100644 --- a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp +++ b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp @@ -79,10 +79,10 @@ extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInter extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_00024BabylonNative_setPointerButtonState(JNIEnv* env, jclass obj, jint pointerId, jint buttonId, jboolean isDown, jint x, jint y) { - Babylon::SetPointerButtonState(static_cast(pointerId), static_cast(buttonId), isDown, static_cast(x), static_cast(y)); + Babylon::SetTouchButtonState(static_cast(pointerId), static_cast(buttonId), isDown, static_cast(x), static_cast(y)); } extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_00024BabylonNative_setPointerPosition(JNIEnv* env, jclass obj, jint pointerId, jint x, jint y) { - Babylon::SetPointerPosition(static_cast(pointerId), static_cast(x), static_cast(y)); + Babylon::SetTouchPosition(static_cast(pointerId), static_cast(x), static_cast(y)); } diff --git a/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm b/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm index 9b0afe1c0..687ae471d 100644 --- a/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm +++ b/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm @@ -79,13 +79,13 @@ + (void)reportTouchEvent:(MTKView*)mtkView touches:(NSSet*)touches eve } else { [activeTouches replaceObjectAtIndex:pointerId withObject:touch]; } - Babylon::SetPointerButtonState(static_cast(pointerId), 0, true, x, y); + Babylon::SetTouchButtonState(static_cast(pointerId), 0, true, x, y); break; } case UITouchPhaseMoved: { NSUInteger pointerId = [activeTouches indexOfObject:touch]; - Babylon::SetPointerPosition(static_cast(pointerId), x, y); + Babylon::SetTouchPosition(static_cast(pointerId), x, y); break; } @@ -93,7 +93,7 @@ + (void)reportTouchEvent:(MTKView*)mtkView touches:(NSSet*)touches eve case UITouchPhaseCancelled: { NSUInteger pointerId = [activeTouches indexOfObject:touch]; [activeTouches replaceObjectAtIndex:pointerId withObject:[NSNull null]]; - Babylon::SetPointerButtonState(static_cast(pointerId), 0, false, x, y); + Babylon::SetTouchButtonState(static_cast(pointerId), 0, false, x, y); break; } diff --git a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp index 437d50fdb..29f10bc8d 100644 --- a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp +++ b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp @@ -17,7 +17,7 @@ namespace Babylon namespace { - Dispatcher g_inlineDispatcher{[](const std::function& func) { func(); }}; + Dispatcher g_inlineDispatcher{ [](const std::function& func) { func(); } }; } class ReactNativeModule : public jsi::HostObject @@ -34,13 +34,13 @@ namespace Babylon ( jsiRuntime, jsi::Function::createFromHostFunction(jsiRuntime, jsi::PropNameID::forAscii(jsiRuntime, "executor"), 0, [this](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t) -> jsi::Value + { + m_resolveInitPromise = [&rt, resolve{ std::make_shared(rt, args[0]) }]() { - m_resolveInitPromise = [&rt, resolve{ std::make_shared(rt, args[0]) }]() - { - resolve->asObject(rt).asFunction(rt).call(rt); - }; - return {}; - }) + resolve->asObject(rt).asFunction(rt).call(rt); + }; + return {}; + }) ); // Initialize Babylon Native core components @@ -137,21 +137,38 @@ namespace Babylon }); } - void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y, bool isMouse) + void SetMouseButtonState(uint32_t buttonId, bool isDown, uint32_t x, uint32_t y) { if (isDown) { - m_nativeInput->PointerDown(pointerId, buttonId, x, y, isMouse); + m_nativeInput->MouseDown(buttonId, x, y); } else { - m_nativeInput->PointerUp(pointerId, buttonId, x, y, isMouse); + m_nativeInput->MouseUp(buttonId, x, y); } } - void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y, bool isMouse) + void SetMousePosition(uint32_t x, uint32_t y) { - m_nativeInput->PointerMove(pointerId, x, y, isMouse); + m_nativeInput->MouseMove(x, y); + } + + void SetTouchButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y) + { + if (isDown) + { + m_nativeInput->TouchDown(pointerId, buttonId, x, y); + } + else + { + m_nativeInput->TouchUp(pointerId, buttonId, x, y); + } + } + + void SetTouchPosition(uint32_t pointerId, uint32_t x, uint32_t y) + { + m_nativeInput->TouchMove(pointerId, x, y); } jsi::Value get(jsi::Runtime& runtime, const jsi::PropNameID& prop) override @@ -256,19 +273,35 @@ namespace Babylon } } - void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y, bool isMouse) + void SetMouseButtonState(uint32_t buttonId, bool isDown, uint32_t x, uint32_t y) + { + if (auto nativeModule{ g_nativeModule.lock() }) + { + nativeModule->SetMouseButtonState(buttonId, isDown, x, y); + } + } + + void SetMousePosition(uint32_t x, uint32_t y) + { + if (auto nativeModule{ g_nativeModule.lock() }) + { + nativeModule->SetMousePosition(x, y); + } + } + + void SetTouchButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y) { if (auto nativeModule{ g_nativeModule.lock() }) { - nativeModule->SetPointerButtonState(pointerId, buttonId, isDown, x, y, isMouse); + nativeModule->SetTouchButtonState(pointerId, buttonId, isDown, x, y); } } - void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y, bool isMouse) + void SetTouchPosition(uint32_t pointerId, uint32_t x, uint32_t y) { if (auto nativeModule{ g_nativeModule.lock() }) { - nativeModule->SetPointerPosition(pointerId, x, y, isMouse); + nativeModule->SetTouchPosition(pointerId, x, y); } } } diff --git a/Modules/@babylonjs/react-native/shared/BabylonNative.h b/Modules/@babylonjs/react-native/shared/BabylonNative.h index 953aff2da..b59c66000 100644 --- a/Modules/@babylonjs/react-native/shared/BabylonNative.h +++ b/Modules/@babylonjs/react-native/shared/BabylonNative.h @@ -10,6 +10,8 @@ namespace Babylon void Deinitialize(); void UpdateView(void* windowPtr, size_t width, size_t height, void* windowTypePtr = nullptr); void RenderView(); - void SetPointerButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y, bool isMouse = false); - void SetPointerPosition(uint32_t pointerId, uint32_t x, uint32_t y, bool isMouse = false); + void SetMouseButtonState(uint32_t buttonId, bool isDown, uint32_t x, uint32_t y); + void SetMousePosition(uint32_t x, uint32_t y); + void SetTouchButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y); + void SetTouchPosition(uint32_t pointerId, uint32_t x, uint32_t y); } diff --git a/Modules/@babylonjs/react-native/submodules/BabylonNative b/Modules/@babylonjs/react-native/submodules/BabylonNative index fb915e295..b73e25194 160000 --- a/Modules/@babylonjs/react-native/submodules/BabylonNative +++ b/Modules/@babylonjs/react-native/submodules/BabylonNative @@ -1 +1 @@ -Subproject commit fb915e29549b3260b79cc860427119c35099b795 +Subproject commit b73e251943b34109c812fe95648b8267691f289d diff --git a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp index 68b859576..0f1c93196 100644 --- a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp +++ b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp @@ -6,12 +6,20 @@ using namespace winrt::Windows::Devices::Input; using namespace winrt::Windows::Foundation; using namespace winrt::Windows::System::Threading; using namespace winrt::Windows::UI::Core; +using namespace winrt::Windows::UI::Input; using namespace winrt::Windows::UI::Xaml; using namespace winrt::Windows::UI::Xaml::Input; using namespace winrt::Windows::UI::Xaml::Media; using namespace winrt::Windows::UI::Xaml::Controls; namespace winrt::BabylonReactNative::implementation { + namespace { + constexpr uint32_t LEFT_MOUSE_BUTTON_ID = 0; + constexpr uint32_t MIDDLE_MOUSE_BUTTON_ID = 1; + constexpr uint32_t RIGHT_MOUSE_BUTTON_ID = 2; + constexpr uint32_t TOUCH_BUTTON_ID = 0; + } + EngineView::EngineView() { _revokerData.SizeChangedRevoker = SizeChanged(winrt::auto_revoke, { this, &EngineView::OnSizeChanged }); @@ -60,44 +68,95 @@ namespace winrt::BabylonReactNative::implementation { void EngineView::OnPointerPressed(IInspectable const& /*sender*/, PointerEventArgs const& args) { const auto point = args.CurrentPoint(); - const auto pointerId = point.PointerId(); - _pressedPointers.insert(pointerId); - - const auto buttonId = 0; // Update as needed + const auto properties = point.Properties(); + const auto deviceType = point.PointerDevice().PointerDeviceType(); const auto position = point.Position(); - const bool isMouse = point.PointerDevice().PointerDeviceType() == PointerDeviceType::Mouse; const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); - Babylon::SetPointerButtonState(pointerId, buttonId, true, x, y, isMouse); + + if (deviceType == PointerDeviceType::Mouse) + { + if (properties.IsLeftButtonPressed()) + { + _pressedMouseButtons.insert(LEFT_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(LEFT_MOUSE_BUTTON_ID, true, x, y); + } + + if (properties.IsMiddleButtonPressed()) + { + _pressedMouseButtons.insert(MIDDLE_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(MIDDLE_MOUSE_BUTTON_ID, true, x, y); + } + + if (properties.IsRightButtonPressed()) + { + _pressedMouseButtons.insert(RIGHT_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(RIGHT_MOUSE_BUTTON_ID, true, x, y); + } + } + else + { + const auto pointerId = point.PointerId(); + Babylon::SetTouchButtonState(pointerId, TOUCH_BUTTON_ID, true, x, y); + } } void EngineView::OnPointerMoved(IInspectable const& /*sender*/, PointerEventArgs const& args) { const auto point = args.CurrentPoint(); - const auto pointerId = point.PointerId(); + const auto deviceType = point.PointerDevice().PointerDeviceType(); + const auto position = point.Position(); + const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); + const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); - if (_pressedPointers.count(pointerId) > 0) + if (deviceType == PointerDeviceType::Mouse) + { + Babylon::SetMousePosition(x, y); + } + else { - const auto position = point.Position(); - const bool isMouse = point.PointerDevice().PointerDeviceType() == PointerDeviceType::Mouse; - const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); - const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); - Babylon::SetPointerPosition(pointerId, x, y, isMouse); + const auto pointerId = point.PointerId(); + Babylon::SetTouchPosition(pointerId, x, y); } } void EngineView::OnPointerReleased(IInspectable const& /*sender*/, PointerEventArgs const& args) { const auto point = args.CurrentPoint(); - const auto pointerId = point.PointerId(); - _pressedPointers.erase(pointerId); - - const auto buttonId = 0; // Update as needed + const auto properties = point.Properties(); + const auto deviceType = point.PointerDevice().PointerDeviceType(); const auto position = point.Position(); - const bool isMouse = point.PointerDevice().PointerDeviceType() == PointerDeviceType::Mouse; const uint32_t x = position.X < 0 ? 0 : static_cast(position.X); const uint32_t y = position.Y < 0 ? 0 : static_cast(position.Y); - Babylon::SetPointerButtonState(pointerId, buttonId, false, x, y, isMouse); + + if (point.PointerDevice().PointerDeviceType() == PointerDeviceType::Mouse) + { + if (!properties.IsLeftButtonPressed() && + _pressedMouseButtons.find(LEFT_MOUSE_BUTTON_ID) != _pressedMouseButtons.end()) + { + _pressedMouseButtons.erase(LEFT_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(LEFT_MOUSE_BUTTON_ID, false, x, y); + } + + if (!properties.IsMiddleButtonPressed() && + _pressedMouseButtons.find(MIDDLE_MOUSE_BUTTON_ID) != _pressedMouseButtons.end()) + { + _pressedMouseButtons.erase(MIDDLE_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(MIDDLE_MOUSE_BUTTON_ID, false, x, y); + } + + if (!properties.IsRightButtonPressed() && + _pressedMouseButtons.find(RIGHT_MOUSE_BUTTON_ID) != _pressedMouseButtons.end()) + { + _pressedMouseButtons.erase(RIGHT_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(RIGHT_MOUSE_BUTTON_ID, false, x, y); + } + } + else + { + const auto pointerId = point.PointerId(); + Babylon::SetTouchButtonState(pointerId, TOUCH_BUTTON_ID, false, x, y); + } } void EngineView::OnRendering() diff --git a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.h b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.h index c93abfac1..062618b24 100644 --- a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.h +++ b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.h @@ -14,11 +14,12 @@ namespace winrt::BabylonReactNative::implementation { void OnPointerMoved(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Core::PointerEventArgs const& args); void OnPointerReleased(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Core::PointerEventArgs const& args); void OnRendering(); + uint32_t GetButtonId(winrt::Windows::Devices::Input::PointerDeviceType deviceType, winrt::Windows::UI::Input::PointerPointProperties properties); size_t _width{ 1 }; size_t _height{ 1 }; winrt::Windows::Foundation::IAsyncAction _inputLoopWorker{}; - std::unordered_set _pressedPointers{}; + std::unordered_set _pressedMouseButtons{}; struct RevokerData { From 574e9e8f67460a19727220f44f5fb9aa5598e8f9 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Mon, 1 Feb 2021 10:36:12 -0800 Subject: [PATCH 07/14] work with babylon native changes --- .../react-native/shared/BabylonNative.cpp | 26 +++++++----- .../react-native/shared/BabylonNative.h | 6 ++- .../react-native/submodules/BabylonNative | 2 +- .../windows/BabylonReactNative/EngineView.cpp | 41 ++++++++----------- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp index 29f10bc8d..e28d89b22 100644 --- a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp +++ b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp @@ -20,6 +20,10 @@ namespace Babylon Dispatcher g_inlineDispatcher{ [](const std::function& func) { func(); } }; } + const uint32_t LEFT_MOUSE_BUTTON_ID{ NativeInput::LEFT_MOUSE_BUTTON_ID }; + const uint32_t MIDDLE_MOUSE_BUTTON_ID{ NativeInput::MIDDLE_MOUSE_BUTTON_ID }; + const uint32_t RIGHT_MOUSE_BUTTON_ID{ NativeInput::RIGHT_MOUSE_BUTTON_ID }; + class ReactNativeModule : public jsi::HostObject { public: @@ -34,13 +38,13 @@ namespace Babylon ( jsiRuntime, jsi::Function::createFromHostFunction(jsiRuntime, jsi::PropNameID::forAscii(jsiRuntime, "executor"), 0, [this](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t) -> jsi::Value - { - m_resolveInitPromise = [&rt, resolve{ std::make_shared(rt, args[0]) }]() { - resolve->asObject(rt).asFunction(rt).call(rt); - }; - return {}; - }) + m_resolveInitPromise = [&rt, resolve{ std::make_shared(rt, args[0]) }]() + { + resolve->asObject(rt).asFunction(rt).call(rt); + }; + return {}; + }) ); // Initialize Babylon Native core components @@ -154,15 +158,15 @@ namespace Babylon m_nativeInput->MouseMove(x, y); } - void SetTouchButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y) + void SetTouchButtonState(uint32_t pointerId, bool isDown, uint32_t x, uint32_t y) { if (isDown) { - m_nativeInput->TouchDown(pointerId, buttonId, x, y); + m_nativeInput->TouchDown(pointerId, x, y); } else { - m_nativeInput->TouchUp(pointerId, buttonId, x, y); + m_nativeInput->TouchUp(pointerId, x, y); } } @@ -289,11 +293,11 @@ namespace Babylon } } - void SetTouchButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y) + void SetTouchButtonState(uint32_t pointerId, bool isDown, uint32_t x, uint32_t y) { if (auto nativeModule{ g_nativeModule.lock() }) { - nativeModule->SetTouchButtonState(pointerId, buttonId, isDown, x, y); + nativeModule->SetTouchButtonState(pointerId, isDown, x, y); } } diff --git a/Modules/@babylonjs/react-native/shared/BabylonNative.h b/Modules/@babylonjs/react-native/shared/BabylonNative.h index b59c66000..6a3679d2b 100644 --- a/Modules/@babylonjs/react-native/shared/BabylonNative.h +++ b/Modules/@babylonjs/react-native/shared/BabylonNative.h @@ -12,6 +12,10 @@ namespace Babylon void RenderView(); void SetMouseButtonState(uint32_t buttonId, bool isDown, uint32_t x, uint32_t y); void SetMousePosition(uint32_t x, uint32_t y); - void SetTouchButtonState(uint32_t pointerId, uint32_t buttonId, bool isDown, uint32_t x, uint32_t y); + void SetTouchButtonState(uint32_t pointerId, bool isDown, uint32_t x, uint32_t y); void SetTouchPosition(uint32_t pointerId, uint32_t x, uint32_t y); + + extern const uint32_t LEFT_MOUSE_BUTTON_ID; + extern const uint32_t MIDDLE_MOUSE_BUTTON_ID; + extern const uint32_t RIGHT_MOUSE_BUTTON_ID; } diff --git a/Modules/@babylonjs/react-native/submodules/BabylonNative b/Modules/@babylonjs/react-native/submodules/BabylonNative index b73e25194..d0db1de6a 160000 --- a/Modules/@babylonjs/react-native/submodules/BabylonNative +++ b/Modules/@babylonjs/react-native/submodules/BabylonNative @@ -1 +1 @@ -Subproject commit b73e251943b34109c812fe95648b8267691f289d +Subproject commit d0db1de6a923a92da89ec7268833f2a38b84bc05 diff --git a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp index 0f1c93196..7fafc308b 100644 --- a/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp +++ b/Modules/@babylonjs/react-native/windows/BabylonReactNative/EngineView.cpp @@ -13,13 +13,6 @@ using namespace winrt::Windows::UI::Xaml::Media; using namespace winrt::Windows::UI::Xaml::Controls; namespace winrt::BabylonReactNative::implementation { - namespace { - constexpr uint32_t LEFT_MOUSE_BUTTON_ID = 0; - constexpr uint32_t MIDDLE_MOUSE_BUTTON_ID = 1; - constexpr uint32_t RIGHT_MOUSE_BUTTON_ID = 2; - constexpr uint32_t TOUCH_BUTTON_ID = 0; - } - EngineView::EngineView() { _revokerData.SizeChangedRevoker = SizeChanged(winrt::auto_revoke, { this, &EngineView::OnSizeChanged }); @@ -78,26 +71,26 @@ namespace winrt::BabylonReactNative::implementation { { if (properties.IsLeftButtonPressed()) { - _pressedMouseButtons.insert(LEFT_MOUSE_BUTTON_ID); - Babylon::SetMouseButtonState(LEFT_MOUSE_BUTTON_ID, true, x, y); + _pressedMouseButtons.insert(Babylon::LEFT_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(Babylon::LEFT_MOUSE_BUTTON_ID, true, x, y); } if (properties.IsMiddleButtonPressed()) { - _pressedMouseButtons.insert(MIDDLE_MOUSE_BUTTON_ID); - Babylon::SetMouseButtonState(MIDDLE_MOUSE_BUTTON_ID, true, x, y); + _pressedMouseButtons.insert(Babylon::MIDDLE_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(Babylon::MIDDLE_MOUSE_BUTTON_ID, true, x, y); } if (properties.IsRightButtonPressed()) { - _pressedMouseButtons.insert(RIGHT_MOUSE_BUTTON_ID); - Babylon::SetMouseButtonState(RIGHT_MOUSE_BUTTON_ID, true, x, y); + _pressedMouseButtons.insert(Babylon::RIGHT_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(Babylon::RIGHT_MOUSE_BUTTON_ID, true, x, y); } } else { const auto pointerId = point.PointerId(); - Babylon::SetTouchButtonState(pointerId, TOUCH_BUTTON_ID, true, x, y); + Babylon::SetTouchButtonState(pointerId, true, x, y); } } @@ -132,30 +125,30 @@ namespace winrt::BabylonReactNative::implementation { if (point.PointerDevice().PointerDeviceType() == PointerDeviceType::Mouse) { if (!properties.IsLeftButtonPressed() && - _pressedMouseButtons.find(LEFT_MOUSE_BUTTON_ID) != _pressedMouseButtons.end()) + _pressedMouseButtons.find(Babylon::LEFT_MOUSE_BUTTON_ID) != _pressedMouseButtons.end()) { - _pressedMouseButtons.erase(LEFT_MOUSE_BUTTON_ID); - Babylon::SetMouseButtonState(LEFT_MOUSE_BUTTON_ID, false, x, y); + _pressedMouseButtons.erase(Babylon::LEFT_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(Babylon::LEFT_MOUSE_BUTTON_ID, false, x, y); } if (!properties.IsMiddleButtonPressed() && - _pressedMouseButtons.find(MIDDLE_MOUSE_BUTTON_ID) != _pressedMouseButtons.end()) + _pressedMouseButtons.find(Babylon::MIDDLE_MOUSE_BUTTON_ID) != _pressedMouseButtons.end()) { - _pressedMouseButtons.erase(MIDDLE_MOUSE_BUTTON_ID); - Babylon::SetMouseButtonState(MIDDLE_MOUSE_BUTTON_ID, false, x, y); + _pressedMouseButtons.erase(Babylon::MIDDLE_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(Babylon::MIDDLE_MOUSE_BUTTON_ID, false, x, y); } if (!properties.IsRightButtonPressed() && - _pressedMouseButtons.find(RIGHT_MOUSE_BUTTON_ID) != _pressedMouseButtons.end()) + _pressedMouseButtons.find(Babylon::RIGHT_MOUSE_BUTTON_ID) != _pressedMouseButtons.end()) { - _pressedMouseButtons.erase(RIGHT_MOUSE_BUTTON_ID); - Babylon::SetMouseButtonState(RIGHT_MOUSE_BUTTON_ID, false, x, y); + _pressedMouseButtons.erase(Babylon::RIGHT_MOUSE_BUTTON_ID); + Babylon::SetMouseButtonState(Babylon::RIGHT_MOUSE_BUTTON_ID, false, x, y); } } else { const auto pointerId = point.PointerId(); - Babylon::SetTouchButtonState(pointerId, TOUCH_BUTTON_ID, false, x, y); + Babylon::SetTouchButtonState(pointerId, false, x, y); } } From 88c0cf5dac16fd410a0aea3861b3676feed92d0f Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Mon, 1 Feb 2021 11:31:21 -0800 Subject: [PATCH 08/14] move to correct commit --- Modules/@babylonjs/react-native/submodules/BabylonNative | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/@babylonjs/react-native/submodules/BabylonNative b/Modules/@babylonjs/react-native/submodules/BabylonNative index d0db1de6a..7f4f8562f 160000 --- a/Modules/@babylonjs/react-native/submodules/BabylonNative +++ b/Modules/@babylonjs/react-native/submodules/BabylonNative @@ -1 +1 @@ -Subproject commit d0db1de6a923a92da89ec7268833f2a38b84bc05 +Subproject commit 7f4f8562fbb1a35984cbe6e371054aa3049a857e From 388438602ea2e30d2a609fd2c39cd55043ec4f98 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Mon, 1 Feb 2021 15:18:25 -0800 Subject: [PATCH 09/14] update package references and validate uwp build --- Apps/PackageTest/0.63.1/package-lock.json | 8 +++---- Apps/PackageTest/0.63.1/package.json | 2 +- .../PackageTest/0.64.0-rc.0/package-lock.json | 21 +++++++++++++----- Apps/PackageTest/0.64.0-rc.0/package.json | 2 +- Apps/Playground/package-lock.json | 22 +++++++++---------- Apps/Playground/package.json | 4 ++-- Modules/@babylonjs/react-native/package.json | 2 +- 7 files changed, 36 insertions(+), 25 deletions(-) diff --git a/Apps/PackageTest/0.63.1/package-lock.json b/Apps/PackageTest/0.63.1/package-lock.json index 9b916086a..cb7a8adc9 100644 --- a/Apps/PackageTest/0.63.1/package-lock.json +++ b/Apps/PackageTest/0.63.1/package-lock.json @@ -908,16 +908,16 @@ } }, "@babylonjs/core": { - "version": "5.0.0-alpha.6", - "resolved": "https://registry.npmjs.org/@babylonjs/core/-/core-5.0.0-alpha.6.tgz", - "integrity": "sha512-7Tg/MByT6nUHpV5TjVj1xHsmnbrk1hGMk/jKCui6bydR6YaGrkE0yoLAmJXX5ALGXhhKLIDj+qg3QHWVFsi1lA==", + "version": "5.0.0-alpha.9", + "resolved": "https://registry.npmjs.org/@babylonjs/core/-/core-5.0.0-alpha.9.tgz", + "integrity": "sha512-1xoYaq0CfJiKGLlsEAazK0oPR0DOzw1sl2JY3paeVi+Rh6muoHoKKgWAv+Pobq6rnQM1fQpj8uKbijtEeTLciw==", "requires": { "tslib": ">=1.10.0" } }, "@babylonjs/react-native": { "version": "file:../../../Package/Assembled/babylonjs-react-native-0.0.1.tgz", - "integrity": "sha512-eEjmBIRqheKSsMU58Ql0ZKack9FhA6Ac48yq2Y8MAQ5RlbWUzWWI2RRb6jjGkMr1huwdSRGWL2gsRMuEcghRww==", + "integrity": "sha512-jfKsyXhqdBg6UV3RhJRrbEmK3yyB4y/JZUidA97yLMEJYQsvuzZhGYEYanbvM/tflelxhxIR76XlMvUHmL2qug==", "requires": { "base-64": "^0.1.0", "semver": "^7.3.2" diff --git a/Apps/PackageTest/0.63.1/package.json b/Apps/PackageTest/0.63.1/package.json index 3f50f6c7e..8d8c0f032 100644 --- a/Apps/PackageTest/0.63.1/package.json +++ b/Apps/PackageTest/0.63.1/package.json @@ -10,7 +10,7 @@ "lint": "eslint . --ext .js,.jsx,.ts,.tsx" }, "dependencies": { - "@babylonjs/core": "^5.0.0-alpha.6", + "@babylonjs/core": "^5.0.0-alpha.9", "@babylonjs/react-native": "file:../../../Package/Assembled/babylonjs-react-native-0.0.1.tgz", "react": "16.13.1", "react-native": "0.63.1", diff --git a/Apps/PackageTest/0.64.0-rc.0/package-lock.json b/Apps/PackageTest/0.64.0-rc.0/package-lock.json index 2caadac60..fbc8cee86 100644 --- a/Apps/PackageTest/0.64.0-rc.0/package-lock.json +++ b/Apps/PackageTest/0.64.0-rc.0/package-lock.json @@ -912,18 +912,29 @@ } }, "@babylonjs/core": { - "version": "5.0.0-alpha.6", - "resolved": "https://registry.npmjs.org/@babylonjs/core/-/core-5.0.0-alpha.6.tgz", - "integrity": "sha512-7Tg/MByT6nUHpV5TjVj1xHsmnbrk1hGMk/jKCui6bydR6YaGrkE0yoLAmJXX5ALGXhhKLIDj+qg3QHWVFsi1lA==", + "version": "5.0.0-alpha.9", + "resolved": "https://registry.npmjs.org/@babylonjs/core/-/core-5.0.0-alpha.9.tgz", + "integrity": "sha512-1xoYaq0CfJiKGLlsEAazK0oPR0DOzw1sl2JY3paeVi+Rh6muoHoKKgWAv+Pobq6rnQM1fQpj8uKbijtEeTLciw==", "requires": { "tslib": ">=1.10.0" } }, "@babylonjs/react-native": { "version": "file:../../../Package/Assembled/babylonjs-react-native-0.0.1.tgz", - "integrity": "sha512-2iGNoOZz4gcuhPj8mdeOWV8DgXIC2W0Hn+m+APhmakC1FXic8i15dHobVLiY4jKR72uTqJ6oxz3da2B5KuTw2Q==", + "integrity": "sha512-jfKsyXhqdBg6UV3RhJRrbEmK3yyB4y/JZUidA97yLMEJYQsvuzZhGYEYanbvM/tflelxhxIR76XlMvUHmL2qug==", "requires": { - "base-64": "^0.1.0" + "base-64": "^0.1.0", + "semver": "^7.3.2" + }, + "dependencies": { + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "@bcoe/v8-coverage": { diff --git a/Apps/PackageTest/0.64.0-rc.0/package.json b/Apps/PackageTest/0.64.0-rc.0/package.json index a85cbf6aa..f052f3e13 100644 --- a/Apps/PackageTest/0.64.0-rc.0/package.json +++ b/Apps/PackageTest/0.64.0-rc.0/package.json @@ -12,7 +12,7 @@ "lint": "eslint . --ext .js,.jsx,.ts,.tsx" }, "dependencies": { - "@babylonjs/core": "^5.0.0-alpha.6", + "@babylonjs/core": "^5.0.0-alpha.9", "@babylonjs/react-native": "file:../../../Package/Assembled/babylonjs-react-native-0.0.1.tgz", "react": "^17.0.1", "react-native": "^0.64.0-rc.0", diff --git a/Apps/Playground/package-lock.json b/Apps/Playground/package-lock.json index 64f86406d..61d594fdf 100644 --- a/Apps/Playground/package-lock.json +++ b/Apps/Playground/package-lock.json @@ -889,20 +889,20 @@ } }, "@babylonjs/core": { - "version": "5.0.0-alpha.6", - "resolved": "https://registry.npmjs.org/@babylonjs/core/-/core-5.0.0-alpha.6.tgz", - "integrity": "sha512-7Tg/MByT6nUHpV5TjVj1xHsmnbrk1hGMk/jKCui6bydR6YaGrkE0yoLAmJXX5ALGXhhKLIDj+qg3QHWVFsi1lA==", + "version": "5.0.0-alpha.9", + "resolved": "https://registry.npmjs.org/@babylonjs/core/-/core-5.0.0-alpha.9.tgz", + "integrity": "sha512-1xoYaq0CfJiKGLlsEAazK0oPR0DOzw1sl2JY3paeVi+Rh6muoHoKKgWAv+Pobq6rnQM1fQpj8uKbijtEeTLciw==", "requires": { "tslib": ">=1.10.0" } }, "@babylonjs/loaders": { - "version": "5.0.0-alpha.6", - "resolved": "https://registry.npmjs.org/@babylonjs/loaders/-/loaders-5.0.0-alpha.6.tgz", - "integrity": "sha512-mnUkcA2a4Mdo484q7ckw+QxPYM8mfMaZjfSyt4YjwUxXRdOvbQUPyk/ZojrQjXajEFdzpxhqEU5Iu5CZr01w1A==", + "version": "5.0.0-alpha.9", + "resolved": "https://registry.npmjs.org/@babylonjs/loaders/-/loaders-5.0.0-alpha.9.tgz", + "integrity": "sha512-HS7xCGQ07qtPvEMHOQV4sEFffpsUFTCF84YL4DQJFGsD3sdAsPFQeX9zwyd5pT+ABCPtj3Wh7dxwH09FQJLJqA==", "requires": { - "@babylonjs/core": "5.0.0-alpha.6", - "babylonjs-gltf2interface": "5.0.0-alpha.6", + "@babylonjs/core": "5.0.0-alpha.9", + "babylonjs-gltf2interface": "5.0.0-alpha.9", "tslib": ">=1.10.0" } }, @@ -4170,9 +4170,9 @@ } }, "babylonjs-gltf2interface": { - "version": "5.0.0-alpha.6", - "resolved": "https://registry.npmjs.org/babylonjs-gltf2interface/-/babylonjs-gltf2interface-5.0.0-alpha.6.tgz", - "integrity": "sha512-rlsNUn+/anLusgeYwgiRmgo2KtTDA8HmaXTbaAesUHp4lSQfmCmWyl1SpTdGgBeBeG2ZVD9mOrSVamBc+L7YyA==" + "version": "5.0.0-alpha.9", + "resolved": "https://registry.npmjs.org/babylonjs-gltf2interface/-/babylonjs-gltf2interface-5.0.0-alpha.9.tgz", + "integrity": "sha512-DtHrkuq/SAgB/xzaXo/pI63axfoSmuxPV1GJF/b7rqjCoxGGAe4ws50zbacviYIoerny6zBRu1krUiOtiCcsgw==" }, "balanced-match": { "version": "1.0.0", diff --git a/Apps/Playground/package.json b/Apps/Playground/package.json index 6ff827ce7..52d410c02 100644 --- a/Apps/Playground/package.json +++ b/Apps/Playground/package.json @@ -12,8 +12,8 @@ "lint": "eslint . --ext .js,.jsx,.ts,.tsx" }, "dependencies": { - "@babylonjs/core": "^5.0.0-alpha.6", - "@babylonjs/loaders": "^5.0.0-alpha.6", + "@babylonjs/core": "^5.0.0-alpha.9", + "@babylonjs/loaders": "^5.0.0-alpha.9", "@babylonjs/react-native": "file:../../Modules/@babylonjs/react-native", "@react-native-community/slider": "4.0.0-rc.2", "logkitty": "^0.7.1", diff --git a/Modules/@babylonjs/react-native/package.json b/Modules/@babylonjs/react-native/package.json index f27ff76aa..6258c549a 100644 --- a/Modules/@babylonjs/react-native/package.json +++ b/Modules/@babylonjs/react-native/package.json @@ -28,7 +28,7 @@ "semver": "^7.3.2" }, "peerDependencies": { - "@babylonjs/core": "^5.0.0-alpha.6", + "@babylonjs/core": "^5.0.0-alpha.9", "react": "^16.13.1", "react-native": "^0.63.1", "react-native-permissions": "^2.1.4", From 7b445b5570cfce5ab2fc1b9ee850904befa56ff5 Mon Sep 17 00:00:00 2001 From: "C. M. Barth" Date: Mon, 1 Feb 2021 15:23:01 -0800 Subject: [PATCH 10/14] Update Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm Co-authored-by: Ryan Tremblay --- Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm b/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm index 687ae471d..05f5a73a7 100644 --- a/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm +++ b/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm @@ -79,7 +79,7 @@ + (void)reportTouchEvent:(MTKView*)mtkView touches:(NSSet*)touches eve } else { [activeTouches replaceObjectAtIndex:pointerId withObject:touch]; } - Babylon::SetTouchButtonState(static_cast(pointerId), 0, true, x, y); + Babylon::SetTouchButtonState(static_cast(pointerId), true, x, y); break; } From b8bfb9360a7cac9b88e505067e91acbcdcf333f5 Mon Sep 17 00:00:00 2001 From: "C. M. Barth" Date: Mon, 1 Feb 2021 15:23:11 -0800 Subject: [PATCH 11/14] Update Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm Co-authored-by: Ryan Tremblay --- Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm b/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm index 05f5a73a7..a34863c74 100644 --- a/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm +++ b/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm @@ -93,7 +93,7 @@ + (void)reportTouchEvent:(MTKView*)mtkView touches:(NSSet*)touches eve case UITouchPhaseCancelled: { NSUInteger pointerId = [activeTouches indexOfObject:touch]; [activeTouches replaceObjectAtIndex:pointerId withObject:[NSNull null]]; - Babylon::SetTouchButtonState(static_cast(pointerId), 0, false, x, y); + Babylon::SetTouchButtonState(static_cast(pointerId), false, x, y); break; } From 5ef3cfaa0e9c11c95af4cbecb039a019e036ed29 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Mon, 1 Feb 2021 16:18:44 -0800 Subject: [PATCH 12/14] address review comments --- Apps/Playground/App.tsx | 25 ++++++++++--------- .../src/main/cpp/BabylonNativeInterop.cpp | 6 ++--- .../BabylonNativeInterop.java | 8 +++--- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Apps/Playground/App.tsx b/Apps/Playground/App.tsx index 2a043b603..e5b38959f 100644 --- a/Apps/Playground/App.tsx +++ b/Apps/Playground/App.tsx @@ -9,7 +9,7 @@ import React, { useState, FunctionComponent, useEffect, useCallback } from 'reac import { SafeAreaView, StatusBar, Button, View, Text, ViewProps, Image } from 'react-native'; import { EngineView, useEngine, EngineViewCallbacks } from '@babylonjs/react-native'; -import { Scene, Vector3, ArcRotateCamera, Camera, WebXRSessionManager, SceneLoader, TransformNode, DeviceSourceManager, DeviceType, DeviceSource, PointerInput, WebXRTrackingState } from '@babylonjs/core'; +import { Scene, Vector3, ArcRotateCamera, Camera, WebXRSessionManager, SceneLoader, TransformNode, DeviceSourceManager, DeviceType, DeviceSource, PointerInput, WebXRTrackingState, Nullable } from '@babylonjs/core'; import '@babylonjs/loaders'; import Slider from '@react-native-community/slider'; @@ -40,27 +40,28 @@ const EngineScreen: FunctionComponent = (props: ViewProps) => { setRootNode(rootNode); const deviceSourceManager = new DeviceSourceManager(engine); + const handlePointerInput = (inputIndex: PointerInput, previousState: Nullable, currentState: Nullable) => { + if (inputIndex === PointerInput.Horizontal && + currentState && previousState) { + rootNode.rotate(Vector3.Down(), (currentState - previousState) * 0.005); + }; + }; + deviceSourceManager.onDeviceConnectedObservable.add(device => { if (device.deviceType === DeviceType.Touch) { const touch: DeviceSource = deviceSourceManager.getDeviceSource(device.deviceType, device.deviceSlot)!; touch.onInputChangedObservable.add(touchEvent => { - if (touchEvent.inputIndex === PointerInput.Horizontal) { - if (touchEvent.currentState && touchEvent.previousState) { - rootNode.rotate(Vector3.Down(), (touchEvent.currentState - touchEvent.previousState) * 0.005); - } - } - }) + handlePointerInput(touchEvent.inputIndex, touchEvent.previousState, touchEvent.currentState); + }); } else if (device.deviceType === DeviceType.Mouse) { const mouse: DeviceSource = deviceSourceManager.getDeviceSource(device.deviceType, device.deviceSlot)!; mouse.onInputChangedObservable.add(mouseEvent => { - if (mouse.getInput(PointerInput.LeftClick) && - mouseEvent.inputIndex === PointerInput.Horizontal && - mouseEvent.currentState && mouseEvent.previousState) { - rootNode.rotate(Vector3.Down(), (mouseEvent.currentState - mouseEvent.previousState) * 0.005); + if (mouse.getInput(PointerInput.LeftClick)) { + handlePointerInput(mouseEvent.inputIndex, mouseEvent.previousState, mouseEvent.currentState); } }); } - }) + }); const transformContainer = new TransformNode("Transform Container", scene); transformContainer.parent = rootNode; diff --git a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp index 3868c9c65..f261f1307 100644 --- a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp +++ b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp @@ -77,12 +77,12 @@ extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInter Babylon::UpdateView(windowPtr, width, height); } -extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_00024BabylonNative_setPointerButtonState(JNIEnv* env, jclass obj, jint pointerId, jint buttonId, jboolean isDown, jint x, jint y) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_00024BabylonNative_setTouchButtonState(JNIEnv* env, jclass obj, jint pointerId, jboolean isDown, jint x, jint y) { - Babylon::SetTouchButtonState(static_cast(pointerId), static_cast(buttonId), isDown, static_cast(x), static_cast(y)); + Babylon::SetTouchButtonState(static_cast(pointerId), isDown, static_cast(x), static_cast(y)); } -extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_00024BabylonNative_setPointerPosition(JNIEnv* env, jclass obj, jint pointerId, jint x, jint y) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_00024BabylonNative_setTouchPosition(JNIEnv* env, jclass obj, jint pointerId, jint x, jint y) { Babylon::SetTouchPosition(static_cast(pointerId), static_cast(x), static_cast(y)); } diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonNativeInterop.java b/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonNativeInterop.java index 319bc9fb1..f3139cb00 100644 --- a/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonNativeInterop.java +++ b/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonNativeInterop.java @@ -24,8 +24,8 @@ private static class BabylonNative { public static native void pause(); public static native void resume(); public static native void updateView(Surface surface); - public static native void setPointerButtonState(int pointerId, int buttonId, boolean isDown, int x, int y); - public static native void setPointerPosition(int pointerId, int x, int y); + public static native void setTouchButtonState(int pointerId, boolean isDown, int x, int y); + public static native void setTouchPosition(int pointerId, int x, int y); } private static LifecycleEventListener lifeCycleEventListener; @@ -98,13 +98,13 @@ public static void reportMotionEvent(MotionEvent motionEvent) { int pointerId = motionEvent.getPointerId(pointerIndex); int x = (int)motionEvent.getX(pointerIndex); int y = (int)motionEvent.getY(pointerIndex); - BabylonNative.setPointerButtonState(pointerId, 0, isPointerDown, x, y); + BabylonNative.setTouchButtonState(pointerId, isPointerDown, x, y); } else if (isPointerMove) { for (int pointerIndex = 0; pointerIndex < motionEvent.getPointerCount(); pointerIndex++) { int pointerId = motionEvent.getPointerId(pointerIndex); int x = (int)motionEvent.getX(pointerIndex); int y = (int)motionEvent.getY(pointerIndex); - BabylonNative.setPointerPosition(pointerId, x, y); + BabylonNative.setTouchPosition(pointerId, x, y); } } } From 46aa75c2e1ea1e7cc537906961087376521e7629 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Tue, 2 Feb 2021 09:20:10 -0800 Subject: [PATCH 13/14] try fix pr ci --- .gitmodules | 2 +- Modules/@babylonjs/react-native/submodules/BabylonNative | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6383857a2..fabc4f0a7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Core/react-native-babylon/submodules/BabylonNative"] path = Modules/@babylonjs/react-native/submodules/BabylonNative - url = https://github.com/BabylonJS/BabylonNative.git + url = https://github.com/chrisfromwork/BabylonNative.git diff --git a/Modules/@babylonjs/react-native/submodules/BabylonNative b/Modules/@babylonjs/react-native/submodules/BabylonNative index 7f4f8562f..ce530ddfe 160000 --- a/Modules/@babylonjs/react-native/submodules/BabylonNative +++ b/Modules/@babylonjs/react-native/submodules/BabylonNative @@ -1 +1 @@ -Subproject commit 7f4f8562fbb1a35984cbe6e371054aa3049a857e +Subproject commit ce530ddfe237d13195891d32b0e45f22395ec1a1 From 41fe637aca68aeb941522db7515598470bc32c03 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Tue, 2 Feb 2021 09:50:08 -0800 Subject: [PATCH 14/14] move to master backslash fix --- .gitmodules | 2 +- Modules/@babylonjs/react-native/submodules/BabylonNative | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index fabc4f0a7..6383857a2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Core/react-native-babylon/submodules/BabylonNative"] path = Modules/@babylonjs/react-native/submodules/BabylonNative - url = https://github.com/chrisfromwork/BabylonNative.git + url = https://github.com/BabylonJS/BabylonNative.git diff --git a/Modules/@babylonjs/react-native/submodules/BabylonNative b/Modules/@babylonjs/react-native/submodules/BabylonNative index ce530ddfe..b4f81771a 160000 --- a/Modules/@babylonjs/react-native/submodules/BabylonNative +++ b/Modules/@babylonjs/react-native/submodules/BabylonNative @@ -1 +1 @@ -Subproject commit ce530ddfe237d13195891d32b0e45f22395ec1a1 +Subproject commit b4f81771abb2722c3c18731a59b31c18298fcd40