Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Submodule BabylonNative updated 49 files
+5 −0 Apps/Playground/Android/app/build.gradle
+1 −1 Apps/Playground/Android/build.gradle
+1 −1 Apps/Playground/Android/gradle/wrapper/gradle-wrapper.properties
+25 −0 Apps/Playground/Scripts/experience.js
+5 −2 Apps/ValidationTests/Scripts/config.json
+43 −42 Apps/package-lock.json
+4 −4 Apps/package.json
+2 −0 Core/Graphics/Include/Platform/Android/Babylon/Graphics/Platform.h
+2 −0 Core/Graphics/Include/Platform/UWP/CoreWindow/Babylon/Graphics/Platform.h
+2 −0 Core/Graphics/Include/Platform/UWP/SwapChainPanel/Babylon/Graphics/Platform.h
+2 −0 Core/Graphics/Include/Platform/Unix/Babylon/Graphics/Platform.h
+2 −0 Core/Graphics/Include/Platform/Win32/Babylon/Graphics/Platform.h
+2 −0 Core/Graphics/Include/Platform/iOS/Babylon/Graphics/Platform.h
+2 −0 Core/Graphics/Include/Platform/macOS/Babylon/Graphics/Platform.h
+4 −2 Core/Graphics/Include/Shared/Babylon/Graphics/Device.h
+8 −2 Core/Graphics/InternalInclude/Babylon/Graphics/DeviceContext.h
+1 −1 Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h
+36 −10 Core/Graphics/InternalInclude/Babylon/Graphics/Texture.h
+2 −1 Core/Graphics/InternalInclude/Babylon/Graphics/continuation_scheduler.h
+6 −0 Core/Graphics/Source/Device.cpp
+2 −2 Core/Graphics/Source/DeviceContext.cpp
+11 −2 Core/Graphics/Source/DeviceImpl.cpp
+2 −1 Core/Graphics/Source/DeviceImpl.h
+111 −6 Core/Graphics/Source/Texture.cpp
+1 −1 Core/JsRuntime/Include/Babylon/JsRuntime.h
+26 −3 Dependencies/AndroidExtensions/Include/AndroidExtensions/JavaWrappers.h
+167 −38 Dependencies/AndroidExtensions/Source/JavaWrappers.cpp
+1 −1 Dependencies/bgfx.cmake
+4 −2 Plugins/ChromeDevTools/Include/Babylon/Plugins/ChromeDevTools.h
+3 −2 Plugins/ExternalTexture/Source/ExternalTexture_Shared.h
+4 −2 Plugins/NativeCamera/Include/Babylon/Plugins/NativeCamera.h
+7 −2 Plugins/NativeCamera/Source/Android/NativeCameraImpl.cpp
+3 −2 Plugins/NativeCamera/Source/Android/NativeCameraImpl.h
+2 −1 Plugins/NativeCamera/Source/Apple/NativeCameraImpl.h
+7 −2 Plugins/NativeCamera/Source/Apple/NativeCameraImpl.mm
+2 −2 Plugins/NativeCamera/Source/NativeCamera.cpp
+6 −2 Plugins/NativeCamera/Source/NativeVideo.cpp
+2 −2 Plugins/NativeCamera/Source/NativeVideo.h
+3 −0 Plugins/NativeEngine/Source/IndexBuffer.h
+0 −2 Plugins/NativeEngine/Source/NativeDataStream.h
+197 −103 Plugins/NativeEngine/Source/NativeEngine.cpp
+1 −0 Plugins/NativeEngine/Source/NativeEngine.h
+4 −0 Plugins/NativeEngine/Source/VertexArray.h
+5 −0 Plugins/NativeEngine/Source/VertexBuffer.h
+3 −1 Plugins/NativeInput/Include/Babylon/Plugins/NativeInput.h
+5 −1 Plugins/NativeXr/Include/Babylon/Plugins/NativeXr.h
+5 −1 Polyfills/Canvas/Include/Babylon/Polyfills/Canvas.h
+11 −18 Polyfills/Canvas/Source/Canvas.cpp
+3 −3 Polyfills/Canvas/Source/Canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ namespace winrt::BabylonReactNative::implementation {
if (propertyName == "isTransparent")
{
bool isTransparent = propertyValue.AsBoolean();
this->CompositeMode(isTransparent ? ElementCompositeMode::MinBlend : ElementCompositeMode::Inherit);
BabylonNative::UpdateAlphaPremultiplied(isTransparent);
} else if (propertyName == "antiAliasing")
{
auto value = propertyValue.AsUInt8();
Expand Down
23 changes: 23 additions & 0 deletions Modules/@babylonjs/react-native/shared/BabylonNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ namespace BabylonNative
g_graphics->UpdateSize(width, height);
}
g_graphics->UpdateMSAA(mMSAAValue);
g_graphics->UpdateAlphaPremultiplied(mAlphaPremultiplied);

g_graphics->EnableRendering();
m_isRenderingEnabled = true;
Expand Down Expand Up @@ -117,6 +118,15 @@ namespace BabylonNative
}
}

void UpdateAlphaPremultiplied(bool enabled)
{
mAlphaPremultiplied = enabled;
if (g_graphics)
{
g_graphics->UpdateAlphaPremultiplied(enabled);
}
}

void RenderView()
{
// If rendering has not been explicitly enabled, or has been explicitly disabled, then don't try to render.
Expand Down Expand Up @@ -236,6 +246,7 @@ namespace BabylonNative

std::shared_ptr<bool> m_isXRActive{};
uint8_t mMSAAValue{};
bool mAlphaPremultiplied{};
};

namespace
Expand Down Expand Up @@ -284,6 +295,18 @@ namespace BabylonNative
}
}

void UpdateAlphaPremultiplied(bool enabled)
{
if (auto nativeModule{ g_nativeModule.lock() })
{
nativeModule->UpdateAlphaPremultiplied(enabled);
}
else
{
throw std::runtime_error{ "UpdateAlphaPremultiplied must not be called before Initialize." };
}
}

void RenderView()
{
if (auto nativeModule{ g_nativeModule.lock() })
Expand Down
1 change: 1 addition & 0 deletions Modules/@babylonjs/react-native/shared/BabylonNative.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace BabylonNative

void UpdateView(WindowType window, size_t width, size_t height);
void UpdateMSAA(uint8_t value);
void UpdateAlphaPremultiplied(bool enabled);

void RenderView();
void ResetView();
Expand Down