Skip to content

Commit ef7ba06

Browse files
Drigaxryantrem
andauthored
Update graphics contract, Update to latest version of BabylonNative (#191)
* update UWP engineView to use modified graphics contract * update react-native-windows, react-native BabylonNative graphics contract * Update BabylonNative to latest commit, remove void* from BabylonNative UpdateView contract * update UWP engineView to use modified graphics contract * update react-native-windows, react-native BabylonNative graphics contract * Update BabylonNative to latest commit, remove void* from BabylonNative UpdateView contract * remove WindowType from BabylonNative.h for now * continue reverting to void*, use reinterpret_cast * Change openxr_loaderd library name, add static lib build target * Use objc++ compilation for re react-native-ios * update BabylonNative to incorporate contract changes, remove GraphicsPlatform.h include * Update Modules/@babylonjs/react-native/shared/BabylonNative.cpp Co-authored-by: Ryan Tremblay <[email protected]> Co-authored-by: Ryan Tremblay <[email protected]>
1 parent f5d17e7 commit ef7ba06

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

Modules/@babylonjs/react-native-windows/windows/BabylonReactNative/EngineView.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ namespace winrt::BabylonReactNative::implementation {
5353
_width = static_cast<size_t>(size.Width);
5454
_height = static_cast<size_t>(size.Height);
5555

56-
// Use windowTypePtr == 2 for xaml swap chain panels
57-
auto windowTypePtr = reinterpret_cast<void*>(2);
5856
auto windowPtr = get_abi(static_cast<winrt::Windows::UI::Xaml::Controls::SwapChainPanel>(*this));
59-
Babylon::UpdateView(windowPtr, _width, _height, windowTypePtr);
57+
Babylon::UpdateView(windowPtr, _width, _height);
6058
}
6159

6260
void EngineView::OnPointerPressed(IInspectable const& /*sender*/, PointerEventArgs const& args)

Modules/@babylonjs/react-native-windows/windows/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ set(CMAKE_CXX_STANDARD 17)
1212
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1313

1414
set(BABYLON_REACT_NATIVE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../react-native")
15+
set(BABYLON_NATIVE_WINDOWS_STORE_USE_SWAPCHAINPANEL 1)
16+
1517
include(${BABYLON_REACT_NATIVE_DIR}/shared/CMakeLists.txt)
1618

1719
set(BABYLON_NATIVE_DIR "${BABYLON_REACT_NATIVE_DIR}/submodules/BabylonNative")

Modules/@babylonjs/react-native/ios/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/../shared/CMakeLists.txt)
44

55
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
66
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++")
78

89
# configure Babylon Native to use JSI
910
set(NAPI_JAVASCRIPT_ENGINE "JSI" CACHE STRING "The JavaScript engine to power N-API")

Modules/@babylonjs/react-native/shared/BabylonNative.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,20 @@ namespace Babylon
6161
Napi::Detach(m_env);
6262
}
6363

64-
void UpdateView(void* windowPtr, void* windowTypePtr, size_t width, size_t height)
64+
void UpdateView(void* windowPtr, size_t width, size_t height)
6565
{
66+
GraphicsConfiguration graphicsConfig{};
67+
graphicsConfig.WindowPtr = reinterpret_cast<WindowType>(windowPtr);
68+
graphicsConfig.Width = width;
69+
graphicsConfig.Height = height;
70+
6671
if (!g_graphics)
6772
{
68-
g_graphics = Graphics::CreateGraphics(windowPtr, windowTypePtr, width, height);
73+
g_graphics = Graphics::CreateGraphics(graphicsConfig);
6974
}
7075
else
7176
{
72-
g_graphics->UpdateWindow(windowPtr, windowTypePtr);
77+
g_graphics->UpdateWindow(graphicsConfig);
7378
g_graphics->UpdateSize(width, height);
7479
}
7580

@@ -222,11 +227,11 @@ namespace Babylon
222227
g_nativeModule.reset();
223228
}
224229

225-
void UpdateView(void* windowPtr, size_t width, size_t height, void* windowTypePtr)
230+
void UpdateView(void* windowPtr, size_t width, size_t height)
226231
{
227232
if (auto nativeModule{ g_nativeModule.lock() })
228233
{
229-
nativeModule->UpdateView(windowPtr, windowTypePtr, width, height);
234+
nativeModule->UpdateView(windowPtr, width, height);
230235
}
231236
else
232237
{

Modules/@babylonjs/react-native/shared/BabylonNative.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Babylon
88

99
void Initialize(facebook::jsi::Runtime& jsiRuntime, Dispatcher jsDispatcher);
1010
void Deinitialize();
11-
void UpdateView(void* windowPtr, size_t width, size_t height, void* windowTypePtr = nullptr);
11+
void UpdateView(void* windowPtr, size_t width, size_t height);
1212
void RenderView();
1313
void ResetView();
1414
void SetMouseButtonState(uint32_t buttonId, bool isDown, uint32_t x, uint32_t y);
Submodule BabylonNative updated 61 files

0 commit comments

Comments
 (0)