Skip to content

Commit e14805a

Browse files
cvanMortimerGoro
authored andcommitted
environments: add Winter and Underwater; update Meadow; rename Island -> Offworld (for issue Igalia#1037) (Igalia#1038)
* environments: add Winter and Underwater; update Meadow; rename Island -> Offworld * temporarily hide "Meadow" environment until new polished assets are ready * revert whitespace change in BrowserWorld * Fix underwater environment * Add support for different env sizes * Fallback to default is meadow was selected * Change order and default
1 parent dc3efee commit e14805a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+74
-18
lines changed

README.md

+2-1

app/src/common/shared/org/mozilla/vrbrowser/browser/SettingsStore.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ SettingsStore getInstance(final @NonNull Context aContext) {
5252
public final static int MAX_WINDOW_HEIGHT_DEFAULT = 1200;
5353
public final static int POINTER_COLOR_DEFAULT_DEFAULT = Color.parseColor("#FFFFFF");
5454
public final static int SCROLL_DIRECTION_DEFAULT = 0;
55-
public final static String ENV_DEFAULT = "cave";
55+
public final static String ENV_DEFAULT = "offworld";
5656
public final static float BROWSER_WORLD_WIDTH_DEFAULT = 4.0f;
5757
public final static float BROWSER_WORLD_HEIGHT_DEFAULT = 2.25f;
5858
public final static int MSAA_DEFAULT_LEVEL = 1;
@@ -287,8 +287,12 @@ public void setMaxWindowHeight(int aMaxWindowHeight) {
287287
}
288288

289289
public String getEnvironment() {
290-
return mPrefs.getString(
291-
mContext.getString(R.string.settings_key_env), ENV_DEFAULT);
290+
String env = mPrefs.getString(mContext.getString(R.string.settings_key_env), ENV_DEFAULT);
291+
// Remove when the meadow is ready
292+
if (env.equalsIgnoreCase("meadow")) {
293+
env = ENV_DEFAULT;
294+
}
295+
return env;
292296
}
293297

294298
public void setEnvironment(String aEnv) {
-23.7 KB
Binary file not shown.
-23.7 KB
Binary file not shown.
-23.7 KB
Binary file not shown.
-23.7 KB
Binary file not shown.
-23.7 KB
Binary file not shown.
-23.7 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
488 KB
Binary file not shown.
488 KB
Binary file not shown.
488 KB
Binary file not shown.
488 KB
Binary file not shown.
488 KB
Binary file not shown.
488 KB
Binary file not shown.

app/src/main/cpp/BrowserWorld.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -1128,16 +1128,26 @@ BrowserWorld::CreateSkyBox(const std::string& aBasePath, const std::string& aExt
11281128
ASSERT_ON_RENDER_THREAD();
11291129
const bool empty = aBasePath == "cubemap/void";
11301130
const std::string extension = aExtension.empty() ? ".ktx" : aExtension;
1131+
const GLenum glFormat = extension == ".ktx" ? GL_COMPRESSED_RGB8_ETC2 : GL_RGB8;
1132+
float size = 1024;
1133+
if (aBasePath == "cubemap/underwater" || aBasePath == "cubemap/winter") {
1134+
size = 1000;
1135+
}
11311136
if (m.skybox && empty) {
11321137
m.skybox->SetVisible(false);
11331138
return;
11341139
} else if (m.skybox) {
11351140
m.skybox->SetVisible(true);
1141+
if (m.skybox->GetLayer() && m.skybox->GetLayer()->GetWidth() != size) {
1142+
VRLayerCubePtr oldLayer = m.skybox->GetLayer();
1143+
VRLayerCubePtr newLayer = m.device->CreateLayerCube(size, size, glFormat);
1144+
m.skybox->SetLayer(newLayer);
1145+
m.device->DeleteLayer(oldLayer);
1146+
}
11361147
m.skybox->Load(m.loader, aBasePath, extension);
11371148
return;
11381149
} else if (!empty) {
1139-
GLenum glFormat = extension == ".ktx" ? GL_COMPRESSED_RGB8_ETC2 : GL_RGB8;
1140-
VRLayerCubePtr layer = m.device->CreateLayerCube(1024, 1024, glFormat);
1150+
VRLayerCubePtr layer = m.device->CreateLayerCube(size, size, glFormat);
11411151
m.skybox = Skybox::Create(m.create, layer);
11421152
m.rootOpaqueParent->AddNode(m.skybox->GetRoot());
11431153
m.skybox->Load(m.loader, aBasePath, extension);

app/src/main/cpp/Skybox.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,32 @@ Skybox::Load(const vrb::ModelLoaderAndroidPtr& aLoader, const std::string& aBase
181181
}
182182
}
183183

184+
VRLayerCubePtr
185+
Skybox::GetLayer() const {
186+
return m.layer;
187+
}
188+
189+
void
190+
Skybox::SetLayer(const VRLayerCubePtr& aLayer) {
191+
m.basePath = "";
192+
m.layerTextureHandle = 0;
193+
if (m.root->GetNodeCount() > 0) {
194+
vrb::NodePtr layerNode = m.root->GetNode(0);
195+
m.root->RemoveNode(*layerNode);
196+
}
197+
m.layer = aLayer;
198+
m.layer->SetTintColor(m.tintColor);
199+
vrb::CreationContextPtr create = m.context.lock();
200+
m.root->AddNode(VRLayerNode::Create(create, m.layer));
201+
m.layer->SetSurfaceChangedDelegate([=](const VRLayer& aLayer, VRLayer::SurfaceChange aChange, const std::function<void()>& aCallback) {
202+
m.layerTextureHandle = m.layer->GetTextureHandle();
203+
m.LoadLayer();
204+
if (aCallback) {
205+
aCallback();
206+
}
207+
});
208+
}
209+
184210
void
185211
Skybox::SetVisible(bool aVisible) {
186212
m.root->ToggleAll(aVisible);

app/src/main/cpp/Skybox.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class Skybox {
2222
static std::string ValidateCustomSkyboxAndFindFileExtension(const std::string& aBasePath);
2323
static SkyboxPtr Create(vrb::CreationContextPtr aContext, const VRLayerCubePtr& aLayer = nullptr);
2424
void Load(const vrb::ModelLoaderAndroidPtr& aLoader, const std::string& aBasePath, const std::string& aExtension);
25+
VRLayerCubePtr GetLayer() const;
26+
void SetLayer(const VRLayerCubePtr& aLayer);
2527
void SetVisible(bool aVisible);
2628
void SetTransform(const vrb::Matrix& aTransform);
2729
void SetTintColor(const vrb::Color& aTintColor);
-77.1 KB
-73.5 KB
34.1 KB

app/src/main/res/values/options_values.xml

+10-7
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,26 @@
33
<!-- Environments Options -->
44
<string-array name="developer_options_environments" translatable="false">
55
<item>@string/developer_options_env_void</item>
6-
<item>@string/developer_options_env_island</item>
76
<item>@string/developer_options_env_cave</item>
8-
<item>@string/developer_options_env_meadow</item>
7+
<item>@string/developer_options_env_offworld</item>
8+
<item>@string/developer_options_env_underwater</item>
9+
<item>@string/developer_options_env_winter</item>
910
</string-array>
1011

1112
<string-array name="developer_options_environments_values" translatable="false">
1213
<item>void</item>
13-
<item>island</item>
14+
<item>offworld</item>
15+
<item>underwater</item>
16+
<item>winter</item>
1417
<item>cave</item>
15-
<item>meadow</item>
1618
</string-array>
1719

1820
<array name="developer_options_environments_images" translatable="false">
1921
<item>@color/black</item>
20-
<item>@drawable/environment_island</item>
2122
<item>@drawable/environment_cave</item>
22-
<item>@drawable/environment_meadow</item>
23+
<item>@drawable/environment_offworld</item>
24+
<item>@drawable/environment_underwater</item>
25+
<item>@drawable/environment_winter</item>
2326
</array>
2427

2528
<!-- Pointer Options -->
@@ -87,4 +90,4 @@
8790
<item>ko-KR</item>
8891
<item>it-IT</item>
8992
</string-array>
90-
</resources>
93+
</resources>

app/src/main/res/values/strings.xml

+11-5
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
<!-- This string is used in place of the 'settings_version' string (e.g., `version 1.1`) when the user is running
156156
a developer-build version of the app. -->
157157
<string name="settings_version_developer">Developer Build</string>
158-
158+
159159
<!-- This string is the title of a dialog box shown to the user when a settings
160160
change requires the application to restart. -->
161161
<string name="restart_dialog_restart">Restart Required</string>
@@ -279,15 +279,21 @@
279279
The 'Void' environment is an empty space that surrounds the user in empty, black space. -->
280280
<string name="developer_options_env_void">Void</string>
281281

282-
<!-- This string labels the radio button that selects the 'Cave' environment. -->
283-
<string name="developer_options_env_island">Island</string>
282+
<!-- This string labels the radio button that selects the 'Offworld' environment. -->
283+
<string name="developer_options_env_offworld">Offworld</string>
284284

285-
<!-- This string labels the radio button that selects the 'Cave' environment. -->
286-
<string name="developer_options_env_cave">Cave</string>
285+
<!-- This string labels the radio button that selects the 'Underwater' environment. -->
286+
<string name="developer_options_env_underwater">Underwater</string>
287+
288+
<!-- This string labels the radio button that selects the 'Winter' environment. -->
289+
<string name="developer_options_env_winter">Winter</string>
287290

288291
<!-- This string labels the radio button that selects the 'Meadow' environment. -->
289292
<string name="developer_options_env_meadow">Meadow</string>
290293

294+
<!-- This string labels the radio button that selects the 'Cave' environment. -->
295+
<string name="developer_options_env_cave">Cave</string>
296+
291297
<!-- This string describes the radio buttons used to select the pointer color. -->
292298
<string name="developer_options_pointer_color">Pointer Color</string>
293299

tools/compressor/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
"readdirp": "^2.2.1",
2121
"sharp": "^0.21.1",
2222
"tmp": "0.0.33"
23+
},
24+
"scripts": {
25+
"build": "npm run compress",
26+
"compress": "gulp compress"
2327
}
2428
}

0 commit comments

Comments
 (0)