Skip to content

Commit 12ac2f9

Browse files
Add LinuxArm64 Support (#8)
1 parent e3f10a6 commit 12ac2f9

File tree

14 files changed

+211
-17
lines changed

14 files changed

+211
-17
lines changed

Content/Assets/WebTexture_M.uasset

10.4 KB
Binary file not shown.

Content/Assets/WebTexture_T.uasset

2.69 KB
Binary file not shown.

Content/Assets/WebTexture_TM.uasset

10.4 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Additionally, you need to add `bCompileCEF3 = true;` to your build target
4646
| Platform | x64 | arm64 |
4747
|----------|:---:|:-----:|
4848
| Windows |||
49-
| Linux || |
49+
| Linux || |
5050
| Mac |||
5151
| IOS |||
5252
| TVOS |||

Scripts/BuildPlugin.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
CD /D ..
3+
ue4 package -NoHostPlatform -TargetPlatforms=Win64+Android+Linux+LinuxArm64

Scripts/build-plugin.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
ue4 package -NoHostPlatform -TargetPlatforms=IOS+Mac+TVOS+VisionOS
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:83a2d7b221328c40550d9b20c5c08ff3a380885e3716977123288276a4b922df
3+
size 93387736
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) 2024 Thirdweb. All Rights Reserved.
2+
3+
#include "ThirdwebAssetManager.h"
4+
5+
#if WITH_EDITOR || PLATFORM_ANDROID || PLATFORM_IOS
6+
#include "WebBrowserTexture.h"
7+
8+
#include "Materials/Material.h"
9+
#endif
10+
11+
UThirdwebAssetManager::UThirdwebAssetManager()
12+
{
13+
DefaultMaterial = FString(TEXT("/Thirdweb/Assets/WebTexture_M.WebTexture_M"));
14+
DefaultTranslucentMaterial = FString(TEXT("/Thirdweb/Assets/WebTexture_TM.WebTexture_TM"));
15+
16+
#if WITH_EDITOR || PLATFORM_ANDROID || PLATFORM_IOS
17+
// Add a hard reference to UWebBrowserTexture, without this the WebBrowserTexture DLL never gets loaded on Windows.
18+
UWebBrowserTexture::StaticClass();
19+
#endif
20+
}
21+
22+
void UThirdwebAssetManager::LoadDefaultMaterials()
23+
{
24+
DefaultMaterial.LoadSynchronous();
25+
DefaultTranslucentMaterial.LoadSynchronous();
26+
}
27+
28+
UMaterial* UThirdwebAssetManager::GetDefaultMaterial()
29+
{
30+
return DefaultMaterial.Get();
31+
}
32+
33+
UMaterial* UThirdwebAssetManager::GetDefaultTranslucentMaterial()
34+
{
35+
return DefaultTranslucentMaterial.Get();
36+
}

Source/Thirdweb/Private/ThirdwebModule.cpp

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
11
// Copyright (c) 2024 Thirdweb. All Rights Reserved.
22

3-
#include "Modules/ModuleManager.h"
3+
#include "ThirdwebModule.h"
4+
5+
#include "IWebBrowserSingleton.h"
6+
#include "ThirdwebAssetManager.h"
7+
#include "WebBrowserModule.h"
8+
9+
#include "Materials/Material.h"
10+
11+
class FThirdwebModule : public IThirdwebModule
12+
{
13+
public:
14+
virtual void StartupModule() override
15+
{
16+
if (ThirdwebAssetManager == nullptr)
17+
{
18+
ThirdwebAssetManager = NewObject<UThirdwebAssetManager>((UObject*)GetTransientPackage(), NAME_None, RF_Transient | RF_Public);
19+
ThirdwebAssetManager->LoadDefaultMaterials();
20+
21+
IWebBrowserModule::Get(); // force the module to load
22+
if (IWebBrowserModule::IsAvailable() && IWebBrowserModule::Get().IsWebModuleAvailable())
23+
{
24+
IWebBrowserSingleton* WebBrowserSingleton = IWebBrowserModule::Get().GetSingleton();
25+
if (WebBrowserSingleton)
26+
{
27+
WebBrowserSingleton->SetDefaultMaterial(ThirdwebAssetManager->GetDefaultMaterial());
28+
WebBrowserSingleton->SetDefaultTranslucentMaterial(ThirdwebAssetManager->GetDefaultTranslucentMaterial());
29+
}
30+
}
31+
}
32+
}
33+
34+
virtual void ShutdownModule() override
35+
{
36+
}
37+
38+
private:
39+
UThirdwebAssetManager* ThirdwebAssetManager = nullptr;
40+
};
41+
42+
IMPLEMENT_MODULE(FThirdwebModule, Thirdweb);
443

5-
IMPLEMENT_MODULE(FDefaultModuleImpl, Thirdweb)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) 2024 Thirdweb. All Rights Reserved.
2+
3+
#pragma once
4+
5+
#include "Materials/Material.h"
6+
7+
#include "UObject/SoftObjectPtr.h"
8+
9+
#include "ThirdwebAssetManager.generated.h"
10+
11+
class UMaterial;
12+
/**
13+
* @class UThirdwebAssetManager
14+
* @brief Manages and handles loading, unloading, and accessing game assets.
15+
*
16+
* The UThirdwebAssetManager class is responsible for the efficient management
17+
* of game assets such as textures, models, sound files, and other resources.
18+
* It provides functions to load and unload assets, handles asset reference
19+
* counting, and ensures that assets are loaded only once. This helps in
20+
* optimizing game performance by minimizing redundant loading and memory usage.
21+
*/
22+
UCLASS()
23+
class THIRDWEB_API UThirdwebAssetManager : public UObject
24+
{
25+
GENERATED_BODY()
26+
public:
27+
UThirdwebAssetManager();
28+
29+
void LoadDefaultMaterials();
30+
31+
UMaterial* GetDefaultMaterial();
32+
UMaterial* GetDefaultTranslucentMaterial();
33+
34+
protected:
35+
UPROPERTY()
36+
TSoftObjectPtr<UMaterial> DefaultMaterial;
37+
TSoftObjectPtr<UMaterial> DefaultTranslucentMaterial;
38+
};

0 commit comments

Comments
 (0)