-
Notifications
You must be signed in to change notification settings - Fork 215
/
BrowserWorld.h
95 lines (86 loc) · 3.03 KB
/
BrowserWorld.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BROWSERWORLD_H
#define BROWSERWORLD_H
#include "vrb/Forward.h"
#include "vrb/MacroUtils.h"
#include "DeviceDelegate.h"
#include <jni.h>
#include <memory>
namespace crow {
class BrowserWorld;
typedef std::shared_ptr<BrowserWorld> BrowserWorldPtr;
typedef std::weak_ptr<BrowserWorld> BrowserWorldWeakPtr;
class WidgetPlacement;
typedef std::shared_ptr<WidgetPlacement> WidgetPlacementPtr;
class Widget;
typedef std::shared_ptr<Widget> WidgetPtr;
class BrowserWorld {
public:
static BrowserWorld& Instance();
static void Destroy();
vrb::RenderContextPtr& GetRenderContext();
void RegisterDeviceDelegate(DeviceDelegatePtr aDelegate);
void Pause();
void Resume();
bool IsPaused() const;
void InitializeJava(JNIEnv* aEnv, jobject& aActivity, jobject& aAssetManager);
void InitializeGL();
void ShutdownJava();
void ShutdownGL();
void Draw(){
StartFrame();
Draw(device::Eye::Left);
Draw(device::Eye::Right);
EndFrame();
}
void StartFrame();
void Draw(device::Eye aEye);
void EndFrame();
void SetTemporaryFilePath(const std::string& aPath);
void UpdateEnvironment();
void UpdatePointerColor();
void SetSurfaceTexture(const std::string& aName, jobject& aSurface);
void AddWidget(int32_t aHandle, const WidgetPlacementPtr& placement);
void UpdateWidget(int32_t aHandle, const WidgetPlacementPtr& aPlacement);
void UpdateWidgetRecursive(int32_t aHandle, const WidgetPlacementPtr& aPlacement);
void RemoveWidget(int32_t aHandle);
void StartWidgetResize(int32_t aHandle, const vrb::Vector& aMaxSize, const vrb::Vector& aMinSize);
void FinishWidgetResize(int32_t aHandle);
void StartWidgetMove(int32_t aHandle, const int32_t aMoveBehavour);
void FinishWidgetMove();
void UpdateVisibleWidgets();
void LayoutWidget(int32_t aHandle);
void SetBrightness(const float aBrightness);
void ExitImmersive();
void ShowVRVideo(const int aWindowHandle, const int aVideoProjection);
void HideVRVideo();
void SetControllersVisible(const bool aVisible);
void ResetUIYaw();
void SetCylinderDensity(const float aDensity);
void SetIsServo(const bool aIsServo);
void SetCPULevel(const device::CPULevel aLevel);
JNIEnv* GetJNIEnv() const;
protected:
struct State;
static BrowserWorldPtr Create();
BrowserWorld(State& aState);
~BrowserWorld() = default;
void TickWorld();
void TickImmersive();
void TickSplashAnimation();
void TickLoadingAnimation();
void DrawWorld(device::Eye aEye);
void DrawImmersive(device::Eye aEye);
void DrawLoadingAnimation(device::Eye aEye);
void DrawSplashAnimation(device::Eye aEye);
void CreateSkyBox(const std::string& aBasePath, const std::string& aExtension);
private:
State& m;
BrowserWorld() = delete;
VRB_NO_DEFAULTS(BrowserWorld)
};
} // namespace crow
#endif // BROWSERWORLD_H