| OLD | NEW |
| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/android/vr_shell/vr_math.h" | 12 #include "chrome/browser/android/vr_shell/vr_math.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class DictionaryValue; | 15 class DictionaryValue; |
| 16 class ListValue; | 16 class ListValue; |
| 17 class TimeTicks; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace vr_shell { | 20 namespace vr_shell { |
| 20 | 21 |
| 21 class Animation; | 22 class Animation; |
| 22 struct ContentRectangle; | 23 struct ContentRectangle; |
| 23 | 24 |
| 24 class UiScene { | 25 class UiScene { |
| 25 public: | 26 public: |
| 26 enum Command { | 27 enum Command { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 // Update an existing element with new properties. | 44 // Update an existing element with new properties. |
| 44 void UpdateUiElementFromDict(const base::DictionaryValue& dict); | 45 void UpdateUiElementFromDict(const base::DictionaryValue& dict); |
| 45 | 46 |
| 46 void RemoveUiElement(int element_id); | 47 void RemoveUiElement(int element_id); |
| 47 | 48 |
| 48 // Add an animation to the scene, on element |element_id|. | 49 // Add an animation to the scene, on element |element_id|. |
| 49 void AddAnimation(int element_id, std::unique_ptr<Animation> animation); | 50 void AddAnimation(int element_id, std::unique_ptr<Animation> animation); |
| 50 | 51 |
| 51 // 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. |
| 52 void AddAnimationFromDict(const base::DictionaryValue& dict, | 53 void AddAnimationFromDict(const base::DictionaryValue& dict, |
| 53 int64_t time_in_micro); | 54 const base::TimeTicks& current_time); |
| 54 | 55 |
| 55 // Remove |animation_id| from element |element_id|. | 56 // Remove |animation_id| from element |element_id|. |
| 56 void RemoveAnimation(int element_id, int animation_id); | 57 void RemoveAnimation(int element_id, int animation_id); |
| 57 | 58 |
| 58 // 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 |
| 59 // 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 |
| 60 // unit used in animations. | 61 // unit used in animations. |
| 61 void UpdateTransforms(int64_t time_in_micro); | 62 void UpdateTransforms(const base::TimeTicks& current_time); |
| 62 | 63 |
| 63 // Handle a batch of commands passed from the UI HTML. | 64 // Handle a batch of commands passed from the UI HTML. |
| 64 void HandleCommands(std::unique_ptr<base::ListValue> commands, | 65 void HandleCommands(std::unique_ptr<base::ListValue> commands, |
| 65 int64_t time_in_micro); | 66 const base::TimeTicks& current_time); |
| 66 | 67 |
| 67 const std::vector<std::unique_ptr<ContentRectangle>>& GetUiElements() const; | 68 const std::vector<std::unique_ptr<ContentRectangle>>& GetUiElements() const; |
| 68 | 69 |
| 69 ContentRectangle* GetUiElementById(int element_id); | 70 ContentRectangle* GetUiElementById(int element_id); |
| 70 | 71 |
| 71 std::vector<const ContentRectangle*> GetWorldElements() const; | 72 std::vector<const ContentRectangle*> GetWorldElements() const; |
| 72 std::vector<const ContentRectangle*> GetHeadLockedElements() const; | 73 std::vector<const ContentRectangle*> GetHeadLockedElements() const; |
| 73 bool HasVisibleHeadLockedElements() const; | 74 bool HasVisibleHeadLockedElements() const; |
| 74 | 75 |
| 75 const Colorf& GetBackgroundColor() const; | 76 const Colorf& GetBackgroundColor() const; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 86 Colorf background_color_ = {0.1f, 0.1f, 0.1f, 1.0f}; | 87 Colorf background_color_ = {0.1f, 0.1f, 0.1f, 1.0f}; |
| 87 float background_distance_ = 10.0f; | 88 float background_distance_ = 10.0f; |
| 88 bool webvr_rendering_enabled_ = true; | 89 bool webvr_rendering_enabled_ = true; |
| 89 | 90 |
| 90 DISALLOW_COPY_AND_ASSIGN(UiScene); | 91 DISALLOW_COPY_AND_ASSIGN(UiScene); |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 } // namespace vr_shell | 94 } // namespace vr_shell |
| 94 | 95 |
| 95 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ | 96 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ |
| OLD | NEW |