@@ -8,13 +8,14 @@ FBluEyeSettings::FBluEyeSettings()
8
8
{
9
9
FrameRate = 60 .f ;
10
10
11
- Width = 1280 ;
12
- Height = 720 ;
11
+ ViewSize. X = 1280 ;
12
+ ViewSize. Y = 720 ;
13
13
14
14
bIsTransparent = false ;
15
15
bEnableWebGL = true ;
16
16
bAudioMuted = false ;
17
17
bAutoPlayEnabled = true ;
18
+ bDebugLogTick = false ;
18
19
}
19
20
20
21
UBluEye::UBluEye (const class FObjectInitializer & PCIP)
@@ -41,7 +42,7 @@ void UBluEye::Init()
41
42
}
42
43
}
43
44
44
- if (Settings.Width <= 0 || Settings.Height <= 0 )
45
+ if (Settings.ViewSize . X <= 0 || Settings.ViewSize . Y <= 0 )
45
46
{
46
47
UE_LOG (LogBlu, Log, TEXT (" Can't initialize when Width or Height are <= 0" ));
47
48
return ;
@@ -53,8 +54,8 @@ void UBluEye::Init()
53
54
// BrowserSettings.web_security = STATE_DISABLED;
54
55
// BrowserSettings.fullscreen_enabled = true;
55
56
56
- Info.width = Settings.Width ;
57
- Info.height = Settings.Height ;
57
+ Info.width = (int32) Settings.ViewSize . X ;
58
+ Info.height = (int32) Settings.ViewSize . Y ;
58
59
59
60
// Set transparant option
60
61
Info.SetAsWindowless (0 ); // bIsTransparent
@@ -72,7 +73,7 @@ void UBluEye::Init()
72
73
// NB: this setting will change it globally for all new instances
73
74
BluManager::AutoPlay = Settings.bAutoPlayEnabled ;
74
75
75
- Renderer = new RenderHandler (Settings.Width , Settings.Height , this );
76
+ Renderer = new RenderHandler (Settings.ViewSize . X , Settings.ViewSize . Y , this );
76
77
ClientHandler = new BrowserClient (Renderer);
77
78
Browser = CefBrowserHost::CreateBrowserSync (
78
79
Info,
@@ -112,7 +113,7 @@ void UBluEye::ResetTexture()
112
113
113
114
114
115
// init the new Texture2D
115
- Texture = UTexture2D::CreateTransient (Settings.Width , Settings.Height , PF_B8G8R8A8);
116
+ Texture = UTexture2D::CreateTransient (Settings.ViewSize . X , Settings.ViewSize . Y , PF_B8G8R8A8);
116
117
Texture->AddToRoot ();
117
118
Texture->UpdateResource ();
118
119
@@ -163,11 +164,11 @@ void UBluEye::TextureUpdate(const void *buffer, FUpdateTextureRegion2D *updateRe
163
164
RegionData->Texture2DResource = (FTextureResource*)Texture->Resource ;
164
165
RegionData->NumRegions = regionCount;
165
166
RegionData->SrcBpp = 4 ;
166
- RegionData->SrcPitch = Settings.Width * 4 ;
167
+ RegionData->SrcPitch = int32 ( Settings.ViewSize . X ) * 4 ;
167
168
RegionData->Regions = updateRegions;
168
169
169
170
// We need to copy this memory or it might get uninitialized
170
- RegionData->SrcData .SetNumUninitialized (RegionData->SrcPitch * Settings.Height );
171
+ RegionData->SrcData .SetNumUninitialized (RegionData->SrcPitch * int32 ( Settings.ViewSize . Y ) );
171
172
FPlatformMemory::Memcpy (RegionData->SrcData .GetData (), buffer, RegionData->SrcData .Num ());
172
173
173
174
ENQUEUE_RENDER_COMMAND (UpdateBLUICommand)(
@@ -329,16 +330,16 @@ UTexture2D* UBluEye::ResizeBrowser(const int32 NewWidth, const int32 NewHeight)
329
330
bEnabled = false ;
330
331
331
332
// Set our new Width and Height
332
- Settings.Width = NewWidth;
333
- Settings.Height = NewHeight;
333
+ Settings.ViewSize . X = NewWidth;
334
+ Settings.ViewSize . Y = NewHeight;
334
335
335
336
// Update our render handler
336
337
Renderer->Width = NewWidth;
337
338
Renderer->Height = NewHeight;
338
339
339
340
bValidTexture = false ;
340
341
341
- Texture = UTexture2D::CreateTransient (Settings.Width , Settings.Height , PF_B8G8R8A8);
342
+ Texture = UTexture2D::CreateTransient (Settings.ViewSize . X , Settings.ViewSize . Y , PF_B8G8R8A8);
342
343
Texture->AddToRoot ();
343
344
Texture->UpdateResource ();
344
345
@@ -363,16 +364,16 @@ UTexture2D* UBluEye::CropWindow(const int32 Y, const int32 X, const int32 NewWid
363
364
364
365
365
366
// Set our new Width and Height
366
- Settings.Width = NewWidth;
367
- Settings.Height = NewHeight;
367
+ Settings.ViewSize . X = NewWidth;
368
+ Settings.ViewSize . Y = NewHeight;
368
369
369
370
// Update our render handler
370
371
Renderer->Width = NewWidth;
371
372
Renderer->Height = NewHeight;
372
373
373
374
bValidTexture = false ;
374
375
375
- Texture = UTexture2D::CreateTransient (Settings.Width , Settings.Height , PF_B8G8R8A8);
376
+ Texture = UTexture2D::CreateTransient (Settings.ViewSize . X , Settings.ViewSize . Y , PF_B8G8R8A8);
376
377
Texture->AddToRoot ();
377
378
Texture->UpdateResource ();
378
379
@@ -395,8 +396,8 @@ UBluEye* UBluEye::SetProperties(const int32 SetWidth,
395
396
const FName& SetTextureParameterName,
396
397
UMaterialInterface* SetBaseMaterial)
397
398
{
398
- Settings.Width = SetWidth;
399
- Settings.Height = SetHeight;
399
+ Settings.ViewSize . X = SetWidth;
400
+ Settings.ViewSize . Y = SetHeight;
400
401
401
402
bEnabled = SetEnabled;
402
403
@@ -626,11 +627,14 @@ void UBluEye::SpawnTickEventLoopIfNeeded()
626
627
{
627
628
if (!EventLoopData.DelegateHandle .IsValid ())
628
629
{
629
- EventLoopData.DelegateHandle = FTicker::GetCoreTicker ().AddTicker (FTickerDelegate::CreateLambda ([](float DeltaTime)
630
+ EventLoopData.DelegateHandle = FTicker::GetCoreTicker ().AddTicker (FTickerDelegate::CreateLambda ([& ](float DeltaTime)
630
631
{
631
632
if (EventLoopData.bShouldTickEventLoop )
632
633
{
633
- // UE_LOG(LogTemp, Log, TEXT("Delta: %1.2f"), DeltaTime);
634
+ if (Settings.bDebugLogTick )
635
+ {
636
+ UE_LOG (LogTemp, Log, TEXT (" Delta: %1.2f" ), DeltaTime);
637
+ }
634
638
BluManager::DoBluMessageLoop ();
635
639
}
636
640
@@ -645,7 +649,7 @@ UTexture2D* UBluEye::GetTexture() const
645
649
{
646
650
if (!Texture)
647
651
{
648
- return UTexture2D::CreateTransient (Settings.Width , Settings.Height , PF_B8G8R8A8);
652
+ return UTexture2D::CreateTransient (Settings.ViewSize . X , Settings.ViewSize . Y , PF_B8G8R8A8);
649
653
}
650
654
651
655
return Texture;
0 commit comments