| 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 32efa09a4e6ab84ebb23c085b7020add7e804e47..e8a62ad89d2e8117d898443d11a75404e96663fe 100644
|
| --- a/chrome/browser/android/vr_shell/ui_scene_manager.cc
|
| +++ b/chrome/browser/android/vr_shell/ui_scene_manager.cc
|
| @@ -57,18 +57,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;
|
| +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;
|
|
|
| @@ -101,6 +115,7 @@ UiSceneManager::~UiSceneManager() {}
|
| void UiSceneManager::CreateScreenDimmer() {
|
| std::unique_ptr<UiElement> element;
|
| element = base::MakeUnique<ScreenDimmer>();
|
| + element->set_debug_id(kScreenDimmer);
|
| element->set_id(AllocateId());
|
| element->set_fill(vr_shell::Fill::NONE);
|
| element->set_visible(false);
|
| @@ -145,6 +160,7 @@ void UiSceneManager::CreateSecurityWarnings() {
|
| scene_->AddUiElement(std::move(element));
|
|
|
| element = base::MakeUnique<ExitWarning>(1024);
|
| + element->set_debug_id(kExitWarning);
|
| element->set_id(AllocateId());
|
| element->set_fill(vr_shell::Fill::NONE);
|
| element->set_size({kExitWarningWidth, kExitWarningHeight, 1});
|
| @@ -163,6 +179,7 @@ void UiSceneManager::CreateSystemIndicators() {
|
| // TODO(acondor): Make constants for sizes and positions once the UX for the
|
| // indicators is defined.
|
| element = base::MakeUnique<AudioCaptureIndicator>(512);
|
| + element->set_debug_id(kAudioCaptureIndicator);
|
| element->set_id(AllocateId());
|
| element->set_translation({-0.3, 0.8, -kContentDistance + 0.1});
|
| element->set_size({0.5, 0, 1});
|
| @@ -171,6 +188,7 @@ void UiSceneManager::CreateSystemIndicators() {
|
| scene_->AddUiElement(std::move(element));
|
|
|
| element = base::MakeUnique<VideoCaptureIndicator>(512);
|
| + element->set_debug_id(kVideoCaptureIndicator);
|
| element->set_id(AllocateId());
|
| element->set_translation({0.3, 0.8, -kContentDistance + 0.1});
|
| element->set_size({0.5, 0, 1});
|
| @@ -179,6 +197,7 @@ void UiSceneManager::CreateSystemIndicators() {
|
| scene_->AddUiElement(std::move(element));
|
|
|
| element = base::MakeUnique<ScreenCaptureIndicator>(512);
|
| + element->set_debug_id(kScreenCaptureIndicator);
|
| element->set_id(AllocateId());
|
| element->set_translation({0.0, 0.65, -kContentDistance + 0.1});
|
| element->set_size({0.4, 0, 1});
|
| @@ -191,6 +210,7 @@ void UiSceneManager::CreateContentQuad() {
|
| std::unique_ptr<UiElement> element;
|
|
|
| element = base::MakeUnique<UiElement>();
|
| + element->set_debug_id(kContentQuad);
|
| element->set_id(AllocateId());
|
| element->set_fill(vr_shell::Fill::CONTENT);
|
| element->set_size({kContentWidth, kContentHeight, 1});
|
| @@ -203,6 +223,7 @@ void UiSceneManager::CreateContentQuad() {
|
| // Place an invisible but hittable plane behind the content quad, to keep the
|
| // reticle roughly planar with the content if near content.
|
| element = base::MakeUnique<UiElement>();
|
| + element->set_debug_id(kBackplane);
|
| element->set_id(AllocateId());
|
| element->set_fill(vr_shell::Fill::NONE);
|
| element->set_size({kBackplaneSize, kBackplaneSize, 1.0});
|
| @@ -221,6 +242,7 @@ void UiSceneManager::CreateBackground() {
|
|
|
| // Floor.
|
| element = base::MakeUnique<UiElement>();
|
| + element->set_debug_id(kFloor);
|
| element->set_id(AllocateId());
|
| element->set_size({kSceneSize, kSceneSize, 1.0});
|
| element->set_translation({0.0, -kSceneHeight / 2, 0.0});
|
| @@ -229,11 +251,13 @@ 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.
|
| element = base::MakeUnique<UiElement>();
|
| + element->set_debug_id(kCeiling);
|
| element->set_id(AllocateId());
|
| element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT);
|
| element->set_size({kSceneSize, kSceneSize, 1.0});
|
| @@ -243,11 +267,13 @@ 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.
|
| element = base::MakeUnique<UiElement>();
|
| + element->set_debug_id(kFloorGrid);
|
| element->set_id(AllocateId());
|
| element->set_fill(vr_shell::Fill::GRID_GRADIENT);
|
| element->set_size({kSceneSize, kSceneSize, 1.0});
|
| @@ -260,7 +286,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);
|
| @@ -269,6 +296,7 @@ void UiSceneManager::CreateBackground() {
|
| void UiSceneManager::CreateUrlBar() {
|
| // TODO(cjgrant): Incorporate final size and position.
|
| auto url_bar = base::MakeUnique<UrlBar>(512);
|
| + url_bar->set_debug_id(kUrlBar);
|
| url_bar->set_id(AllocateId());
|
| url_bar->set_translation({0, kUrlBarVerticalOffset, -kUrlBarDistance});
|
| url_bar->set_size({kUrlBarWidth, kUrlBarHeight, 1});
|
| @@ -279,6 +307,7 @@ void UiSceneManager::CreateUrlBar() {
|
| scene_->AddUiElement(std::move(url_bar));
|
|
|
| auto indicator = base::MakeUnique<LoadingIndicator>(256);
|
| + indicator->set_debug_id(kLoadingIndicator);
|
| indicator->set_id(AllocateId());
|
| indicator->set_translation({0, 0, kLoadingIndicatorOffset});
|
| indicator->set_size({kLoadingIndicatorWidth, kLoadingIndicatorHeight, 1});
|
| @@ -334,22 +363,37 @@ void UiSceneManager::ConfigureScene() {
|
| // Update content quad parameters depending on fullscreen.
|
| // TODO(http://crbug.com/642937): Animate fullscreen transitions.
|
| if (fullscreen_) {
|
| - scene_->SetBackgroundColor(kFullscreenBackgroundColor);
|
| main_content_->set_translation(
|
| {0, kFullscreenVerticalOffset, -kFullscreenDistance});
|
| main_content_->set_size({kFullscreenWidth, kFullscreenHeight, 1});
|
| +
|
| + ConfigureBackgroundColor(kFullscreenCenterColor, kFullscreenHorizonColor);
|
| } 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});
|
| +
|
| + ConfigureBackgroundColor(kBackgroundCenterColor, kBackgroundHorizonColor);
|
| }
|
|
|
| scene_->SetBackgroundDistance(main_content_->translation().z() *
|
| -kBackgroundDistanceMultiplier);
|
| }
|
|
|
| +void UiSceneManager::ConfigureBackgroundColor(vr::Colorf center_color,
|
| + vr::Colorf horizon_color) {
|
| + scene_->SetBackgroundColor(horizon_color);
|
| + floor_->set_edge_color(horizon_color);
|
| + floor_->set_center_color(center_color);
|
| + ceiling_->set_edge_color(horizon_color);
|
| + ceiling_->set_center_color(center_color);
|
| + floor_grid_->set_center_color(horizon_color);
|
| + vr::Colorf edge_color = horizon_color;
|
| + edge_color.a = 0.0;
|
| + floor_grid_->set_edge_color(edge_color);
|
| +}
|
| +
|
| void UiSceneManager::SetAudioCapturingIndicator(bool enabled) {
|
| audio_capture_indicator_->set_visible(enabled);
|
| }
|
|
|