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

Side by Side Diff: chrome/browser/android/vr_shell/ui_scene.h

Issue 2749703007: Add menu mode plumbing for WebVR mode. (Closed)
Patch Set: Rename JS WebVR rendering functions for clarity. Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/ui_scene.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 12 matching lines...) Expand all
23 struct Transform; 23 struct Transform;
24 24
25 class UiScene { 25 class UiScene {
26 public: 26 public:
27 enum Command { 27 enum Command {
28 ADD_ELEMENT, 28 ADD_ELEMENT,
29 UPDATE_ELEMENT, 29 UPDATE_ELEMENT,
30 REMOVE_ELEMENT, 30 REMOVE_ELEMENT,
31 ADD_ANIMATION, 31 ADD_ANIMATION,
32 REMOVE_ANIMATION, 32 REMOVE_ANIMATION,
33 UPDATE_BACKGROUND, 33 CONFIGURE_SCENE,
34 }; 34 };
35 35
36 UiScene(); 36 UiScene();
37 virtual ~UiScene(); 37 virtual ~UiScene();
38 38
39 void AddUiElement(std::unique_ptr<ContentRectangle> element); 39 void AddUiElement(std::unique_ptr<ContentRectangle> element);
40 40
41 // Add a UI element according to a dictionary passed from the UI HTML. 41 // Add a UI element according to a dictionary passed from the UI HTML.
42 void AddUiElementFromDict(const base::DictionaryValue& dict); 42 void AddUiElementFromDict(const base::DictionaryValue& dict);
43 43
44 // Update an existing element with new properties. 44 // Update an existing element with new properties.
45 void UpdateUiElementFromDict(const base::DictionaryValue& dict); 45 void UpdateUiElementFromDict(const base::DictionaryValue& dict);
46 46
47 void RemoveUiElement(int element_id); 47 void RemoveUiElement(int element_id);
48 48
49 // Add an animation to the scene, on element |element_id|. 49 // Add an animation to the scene, on element |element_id|.
50 void AddAnimation(int element_id, std::unique_ptr<Animation> animation); 50 void AddAnimation(int element_id, std::unique_ptr<Animation> animation);
51 51
52 // Add an animation according to a dictionary passed from the UI HTML. 52 // Add an animation according to a dictionary passed from the UI HTML.
53 void AddAnimationFromDict(const base::DictionaryValue& dict, 53 void AddAnimationFromDict(const base::DictionaryValue& dict,
54 int64_t time_in_micro); 54 int64_t time_in_micro);
55 55
56 // Remove |animation_id| from element |element_id|. 56 // Remove |animation_id| from element |element_id|.
57 void RemoveAnimation(int element_id, int animation_id); 57 void RemoveAnimation(int element_id, int animation_id);
58 58
59 void UpdateBackgroundFromDict(const base::DictionaryValue& dict);
60
61 // Update the positions of all elements in the scene, according to active 59 // Update the positions of all elements in the scene, according to active
62 // animations and time. The units of time are arbitrary, but must match the 60 // animations and time. The units of time are arbitrary, but must match the
63 // unit used in animations. 61 // unit used in animations.
64 void UpdateTransforms(int64_t time_in_micro); 62 void UpdateTransforms(int64_t time_in_micro);
65 63
66 // Handle a batch of commands passed from the UI HTML. 64 // Handle a batch of commands passed from the UI HTML.
67 void HandleCommands(std::unique_ptr<base::ListValue> commands, 65 void HandleCommands(std::unique_ptr<base::ListValue> commands,
68 int64_t time_in_micro); 66 int64_t time_in_micro);
69 67
70 const std::vector<std::unique_ptr<ContentRectangle>>& GetUiElements() const; 68 const std::vector<std::unique_ptr<ContentRectangle>>& GetUiElements() const;
71 69
72 ContentRectangle* GetUiElementById(int element_id); 70 ContentRectangle* GetUiElementById(int element_id);
73 71
74 const Colorf& GetBackgroundColor(); 72 const Colorf& GetBackgroundColor() const;
75 float GetBackgroundDistance(); 73 float GetBackgroundDistance() const;
74 bool GetWebVrRenderingEnabled() const;
76 75
77 private: 76 private:
78 void ApplyRecursiveTransforms(const ContentRectangle& element, 77 void ApplyRecursiveTransforms(const ContentRectangle& element,
79 Transform* transform, 78 Transform* transform,
80 float* opacity, 79 float* opacity,
81 bool* lock_to_fov); 80 bool* lock_to_fov);
82 void ApplyDictToElement(const base::DictionaryValue& dict, 81 void ApplyDictToElement(const base::DictionaryValue& dict,
83 ContentRectangle* element); 82 ContentRectangle* element);
84 83
85 std::vector<std::unique_ptr<ContentRectangle>> ui_elements_; 84 std::vector<std::unique_ptr<ContentRectangle>> ui_elements_;
86 ContentRectangle* content_element_ = nullptr; 85 ContentRectangle* content_element_ = nullptr;
87 Colorf background_color_ = {0.1f, 0.1f, 0.1f, 1.0f}; 86 Colorf background_color_ = {0.1f, 0.1f, 0.1f, 1.0f};
88 float background_distance_ = 10.0f; 87 float background_distance_ = 10.0f;
88 bool webvr_rendering_enabled_ = true;
89 89
90 DISALLOW_COPY_AND_ASSIGN(UiScene); 90 DISALLOW_COPY_AND_ASSIGN(UiScene);
91 }; 91 };
92 92
93 } // namespace vr_shell 93 } // namespace vr_shell
94 94
95 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ 95 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/ui_scene.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698