Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: chrome/browser/android/vr_shell/ui_scene_manager.cc

Issue 2887773008: Update fullscreen ux, make floor and ceiling visible. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/ui_scene_manager.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager.cc b/chrome/browser/android/vr_shell/ui_scene_manager.cc
index 430e8e1274e97cf54d17b64dade843af747937dd..9585f9887148bc9b4e7738d191c8c0d66795b619 100644
--- a/chrome/browser/android/vr_shell/ui_scene_manager.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_manager.cc
@@ -48,18 +48,32 @@ static constexpr float kLoadingIndicatorHeight = 0.008 * kUrlBarDistance;
static constexpr float kLoadingIndicatorOffset =
-0.016 * kUrlBarDistance - kLoadingIndicatorHeight / 2;
-static constexpr float kFullscreenWidth = 2.88;
-static constexpr float kFullscreenHeight = 1.62;
-static constexpr float kFullscreenDistance = 3;
-static constexpr float kFullscreenVerticalOffset = -0.26;
-static constexpr vr::Colorf kFullscreenBackgroundColor = {0.1, 0.1, 0.1, 1.0};
-
static constexpr float kSceneSize = 25.0;
static constexpr float kSceneHeight = 4.0;
static constexpr int kFloorGridlineCount = 40;
static constexpr vr::Colorf kBackgroundHorizonColor = {0.57, 0.57, 0.57, 1.0};
static constexpr vr::Colorf kBackgroundCenterColor = {0.48, 0.48, 0.48, 1.0};
+static constexpr float kFullscreenWidthDms = 1.138;
cjgrant 2017/05/18 16:07:16 We're implying Dms elsewhere (ie. lateral meters a
amp 2017/05/18 16:15:33 The only reason I added them here was to calculate
+static constexpr float kFullscreenHeightDms = 0.64;
+static constexpr float kFullscreenVerticalOffsetDms = 0.1;
+// Fullscreen distance calculated as value needed to make the content quad
+// extend down to the floor (with small pullback used to prevent actual
+// intersection). Note this assumes the vertical offset will always be offest
+// below the origin (ie negative).
+static constexpr float kFullscreenDistance =
+ (kSceneHeight / 2.0) /
+ ((kFullscreenVerticalOffsetDms + (kFullscreenHeightDms / 2.0)) + 0.01);
+
+static constexpr float kFullscreenHeight =
+ kFullscreenHeightDms * kFullscreenDistance;
+static constexpr float kFullscreenWidth =
+ kFullscreenWidthDms * kFullscreenDistance;
+static constexpr float kFullscreenVerticalOffset =
+ -kFullscreenVerticalOffsetDms * kFullscreenDistance;
+static constexpr vr::Colorf kFullscreenHorizonColor = {0.1, 0.1, 0.1, 1.0};
+static constexpr vr::Colorf kFullscreenCenterColor = {0.2, 0.2, 0.2, 1.0};
+
// Tiny distance to offset textures that should appear in the same plane.
static constexpr float kTextureOffset = 0.01;
@@ -184,7 +198,8 @@ void UiSceneManager::CreateBackground() {
element->set_edge_color(kBackgroundHorizonColor);
element->set_center_color(kBackgroundCenterColor);
element->set_draw_phase(0);
- control_elements_.push_back(element.get());
+ floor_ = element.get();
+ content_elements_.push_back(element.get());
scene_->AddUiElement(std::move(element));
// Ceiling.
@@ -198,7 +213,8 @@ void UiSceneManager::CreateBackground() {
element->set_edge_color(kBackgroundHorizonColor);
element->set_center_color(kBackgroundCenterColor);
element->set_draw_phase(0);
- control_elements_.push_back(element.get());
+ ceiling_ = element.get();
+ content_elements_.push_back(element.get());
scene_->AddUiElement(std::move(element));
// Floor grid.
@@ -215,7 +231,8 @@ void UiSceneManager::CreateBackground() {
element->set_edge_color(edge_color);
element->set_gridline_count(kFloorGridlineCount);
element->set_draw_phase(0);
- control_elements_.push_back(element.get());
+ floor_grid_ = element.get();
+ content_elements_.push_back(element.get());
scene_->AddUiElement(std::move(element));
scene_->SetBackgroundColor(kBackgroundHorizonColor);
@@ -284,16 +301,34 @@ void UiSceneManager::ConfigureScene() {
// Update content quad parameters depending on fullscreen.
// TODO(http://crbug.com/642937): Animate fullscreen transitions.
if (fullscreen_) {
- scene_->SetBackgroundColor(kFullscreenBackgroundColor);
+ scene_->SetBackgroundColor(kFullscreenHorizonColor);
main_content_->set_translation(
{0, kFullscreenVerticalOffset, -kFullscreenDistance});
main_content_->set_size({kFullscreenWidth, kFullscreenHeight, 1});
+
+ floor_->set_edge_color(kFullscreenHorizonColor);
+ floor_->set_center_color(kFullscreenCenterColor);
+ ceiling_->set_edge_color(kFullscreenHorizonColor);
+ ceiling_->set_center_color(kFullscreenCenterColor);
+ floor_grid_->set_center_color(kFullscreenHorizonColor);
+ vr::Colorf edge_color = kFullscreenHorizonColor;
+ edge_color.a = 0.0;
+ floor_grid_->set_edge_color(edge_color);
} else {
scene_->SetBackgroundColor(kBackgroundHorizonColor);
// Note that main_content_ is already visible in this case.
main_content_->set_translation(
{0, kContentVerticalOffset, -kContentDistance});
main_content_->set_size({kContentWidth, kContentHeight, 1});
+
+ floor_->set_edge_color(kBackgroundHorizonColor);
+ floor_->set_center_color(kBackgroundCenterColor);
+ ceiling_->set_edge_color(kBackgroundHorizonColor);
+ ceiling_->set_center_color(kBackgroundCenterColor);
+ floor_grid_->set_center_color(kBackgroundHorizonColor);
+ vr::Colorf edge_color = kBackgroundHorizonColor;
+ edge_color.a = 0.0;
+ floor_grid_->set_edge_color(edge_color);
}
scene_->SetBackgroundDistance(main_content_->translation().z() *

Powered by Google App Engine
This is Rietveld 408576698