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

Side by Side Diff: chrome/browser/android/vr_shell/ui_scene_manager.cc

Issue 2915143002: VR: Soften the floor grid (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" 5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" 9 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h"
10 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" 10 #include "chrome/browser/android/vr_shell/textures/ui_texture.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 void UiSceneManager::CreateBackground() { 223 void UiSceneManager::CreateBackground() {
224 std::unique_ptr<UiElement> element; 224 std::unique_ptr<UiElement> element;
225 225
226 // Floor. 226 // Floor.
227 element = base::MakeUnique<UiElement>(); 227 element = base::MakeUnique<UiElement>();
228 element->set_debug_id(kFloor); 228 element->set_debug_id(kFloor);
229 element->set_id(AllocateId()); 229 element->set_id(AllocateId());
230 element->set_size({kSceneSize, kSceneSize, 1.0}); 230 element->set_size({kSceneSize, kSceneSize, 1.0});
231 element->set_translation({0.0, -kSceneHeight / 2, 0.0}); 231 element->set_translation({0.0, -kSceneHeight / 2, 0.0});
232 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2.0}); 232 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2.0});
233 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT); 233 element->set_fill(vr_shell::Fill::GRID_GRADIENT);
234 element->set_draw_phase(0); 234 element->set_draw_phase(0);
235 element->set_gridline_count(kFloorGridlineCount);
235 floor_ = element.get(); 236 floor_ = element.get();
236 content_elements_.push_back(element.get()); 237 content_elements_.push_back(element.get());
237 scene_->AddUiElement(std::move(element)); 238 scene_->AddUiElement(std::move(element));
238 239
239 // Ceiling. 240 // Ceiling.
240 element = base::MakeUnique<UiElement>(); 241 element = base::MakeUnique<UiElement>();
241 element->set_debug_id(kCeiling); 242 element->set_debug_id(kCeiling);
242 element->set_id(AllocateId()); 243 element->set_id(AllocateId());
243 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT);
244 element->set_size({kSceneSize, kSceneSize, 1.0}); 244 element->set_size({kSceneSize, kSceneSize, 1.0});
245 element->set_translation({0.0, kSceneHeight / 2, 0.0}); 245 element->set_translation({0.0, kSceneHeight / 2, 0.0});
246 element->set_rotation({1.0, 0.0, 0.0, M_PI / 2}); 246 element->set_rotation({1.0, 0.0, 0.0, M_PI / 2});
247 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT); 247 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT);
248 element->set_draw_phase(0); 248 element->set_draw_phase(0);
249 ceiling_ = element.get(); 249 ceiling_ = element.get();
250 content_elements_.push_back(element.get()); 250 content_elements_.push_back(element.get());
251 scene_->AddUiElement(std::move(element)); 251 scene_->AddUiElement(std::move(element));
252 252
253 // Floor grid.
254 element = base::MakeUnique<UiElement>();
255 element->set_debug_id(kFloorGrid);
256 element->set_id(AllocateId());
257 element->set_size({kSceneSize, kSceneSize, 1.0});
258 element->set_translation({0.0, -kSceneHeight / 2 + kTextureOffset, 0.0});
259 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2});
260 element->set_fill(vr_shell::Fill::GRID_GRADIENT);
261 element->set_gridline_count(kFloorGridlineCount);
262 element->set_draw_phase(0);
263 floor_grid_ = element.get();
264 content_elements_.push_back(element.get());
265 scene_->AddUiElement(std::move(element));
266
267 UpdateBackgroundColor(); 253 UpdateBackgroundColor();
268 } 254 }
269 255
270 void UiSceneManager::CreateUrlBar() { 256 void UiSceneManager::CreateUrlBar() {
271 // TODO(cjgrant): Incorporate final size and position. 257 // TODO(cjgrant): Incorporate final size and position.
272 auto url_bar = base::MakeUnique<UrlBar>( 258 auto url_bar = base::MakeUnique<UrlBar>(
273 512, 259 512,
274 base::Bind(&UiSceneManager::OnUnsupportedMode, base::Unretained(this))); 260 base::Bind(&UiSceneManager::OnUnsupportedMode, base::Unretained(this)));
275 url_bar->set_debug_id(kUrlBar); 261 url_bar->set_debug_id(kUrlBar);
276 url_bar->set_id(AllocateId()); 262 url_bar->set_id(AllocateId());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 UpdateBackgroundColor(); 341 UpdateBackgroundColor();
356 } 342 }
357 343
358 void UiSceneManager::UpdateBackgroundColor() { 344 void UiSceneManager::UpdateBackgroundColor() {
359 // TODO(vollick): it would be nice if ceiling, floor and the grid were 345 // TODO(vollick): it would be nice if ceiling, floor and the grid were
360 // UiElement subclasses and could respond to the OnSetMode signal. 346 // UiElement subclasses and could respond to the OnSetMode signal.
361 ceiling_->set_center_color(color_scheme().ceiling); 347 ceiling_->set_center_color(color_scheme().ceiling);
362 ceiling_->set_edge_color(color_scheme().horizon); 348 ceiling_->set_edge_color(color_scheme().horizon);
363 floor_->set_center_color(color_scheme().floor); 349 floor_->set_center_color(color_scheme().floor);
364 floor_->set_edge_color(color_scheme().horizon); 350 floor_->set_edge_color(color_scheme().horizon);
365 floor_grid_->set_center_color(color_scheme().floor_grid); 351 floor_->set_grid_color(color_scheme().floor_grid);
366 SkColor floor_grid_edge_color = SkColorSetA(color_scheme().floor_grid, 0);
367 floor_grid_->set_edge_color(floor_grid_edge_color);
368 } 352 }
369 353
370 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) { 354 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) {
371 audio_capture_indicator_->set_visible(enabled); 355 audio_capture_indicator_->set_visible(enabled);
372 } 356 }
373 357
374 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) { 358 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) {
375 video_capture_indicator_->set_visible(enabled); 359 video_capture_indicator_->set_visible(enabled);
376 } 360 }
377 361
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 if (fullscreen_) 458 if (fullscreen_)
475 return ColorScheme::kModeFullscreen; 459 return ColorScheme::kModeFullscreen;
476 return ColorScheme::kModeNormal; 460 return ColorScheme::kModeNormal;
477 } 461 }
478 462
479 const ColorScheme& UiSceneManager::color_scheme() const { 463 const ColorScheme& UiSceneManager::color_scheme() const {
480 return ColorScheme::GetColorScheme(mode()); 464 return ColorScheme::GetColorScheme(mode());
481 } 465 }
482 466
483 } // namespace vr_shell 467 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698