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_ELEMENTS_UI_ELEMENT_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ |
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/android/vr_shell/ui_elements/ui_element_debug_id.h" |
13 #include "device/vr/vr_types.h" | 14 #include "device/vr/vr_types.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class TimeTicks; | 17 class TimeTicks; |
17 } | 18 } |
18 | 19 |
19 namespace vr_shell { | 20 namespace vr_shell { |
20 | 21 |
21 class Animation; | 22 class Animation; |
22 class VrShellRenderer; | 23 class VrShellRenderer; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 return inheritable_transform_; | 225 return inheritable_transform_; |
225 } | 226 } |
226 void set_inheritable_transform(const Transform& transform) { | 227 void set_inheritable_transform(const Transform& transform) { |
227 inheritable_transform_ = transform; | 228 inheritable_transform_ = transform; |
228 } | 229 } |
229 | 230 |
230 // A flag usable during transformation calculates to avoid duplicate work. | 231 // A flag usable during transformation calculates to avoid duplicate work. |
231 bool dirty() const { return dirty_; } | 232 bool dirty() const { return dirty_; } |
232 void set_dirty(bool dirty) { dirty_ = dirty; } | 233 void set_dirty(bool dirty) { dirty_ = dirty; } |
233 | 234 |
| 235 // A flag usable during transformation calculates to avoid duplicate work. |
| 236 UiElementDebugId debug_id() const { return debug_id_; } |
| 237 void set_debug_id(UiElementDebugId debug_id) { debug_id_ = debug_id; } |
| 238 |
234 // By default, sets an element to be visible or not. This may be overridden to | 239 // By default, sets an element to be visible or not. This may be overridden to |
235 // allow finer control of element visibility. | 240 // allow finer control of element visibility. |
236 virtual void SetEnabled(bool enabled); | 241 virtual void SetEnabled(bool enabled); |
237 | 242 |
238 private: | 243 private: |
239 // Valid IDs are non-negative. | 244 // Valid IDs are non-negative. |
240 int id_ = -1; | 245 int id_ = -1; |
241 | 246 |
242 // If a non-negative parent ID is specified, applicable transformations | 247 // If a non-negative parent ID is specified, applicable transformations |
243 // are applied relative to the parent, rather than absolutely. | 248 // are applied relative to the parent, rather than absolutely. |
244 int parent_id_ = -1; | 249 int parent_id_ = -1; |
245 | 250 |
246 // If true, this object will be visible. | 251 // If true, this object will be visible. |
247 bool visible_ = true; | 252 bool visible_ = false; |
248 | 253 |
249 // If false, the reticle will not hit the element, even if visible. | 254 // If false, the reticle will not hit the element, even if visible. |
250 bool hit_testable_ = true; | 255 bool hit_testable_ = true; |
251 | 256 |
252 // If true, transformations will be applied relative to the field of view, | 257 // If true, transformations will be applied relative to the field of view, |
253 // rather than the world. | 258 // rather than the world. |
254 bool lock_to_fov_ = false; | 259 bool lock_to_fov_ = false; |
255 | 260 |
256 // The computed lock to the FoV, incorporating lock of parent objects. | 261 // The computed lock to the FoV, incorporating lock of parent objects. |
257 bool computed_lock_to_fov_ = false; | 262 bool computed_lock_to_fov_ = false; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 int gridline_count_ = 1; | 297 int gridline_count_ = 1; |
293 | 298 |
294 int draw_phase_ = 1; | 299 int draw_phase_ = 1; |
295 | 300 |
296 // This transform can be used by children to derive position of its parent. | 301 // This transform can be used by children to derive position of its parent. |
297 Transform inheritable_transform_; | 302 Transform inheritable_transform_; |
298 | 303 |
299 // A flag usable during transformation calculates to avoid duplicate work. | 304 // A flag usable during transformation calculates to avoid duplicate work. |
300 bool dirty_ = false; | 305 bool dirty_ = false; |
301 | 306 |
| 307 // An identifier used for testing and debugging, in lieu of a string. |
| 308 UiElementDebugId debug_id_ = UiElementDebugId::kNone; |
| 309 |
302 Transform transform_; | 310 Transform transform_; |
303 | 311 |
304 DISALLOW_COPY_AND_ASSIGN(UiElement); | 312 DISALLOW_COPY_AND_ASSIGN(UiElement); |
305 }; | 313 }; |
306 | 314 |
307 } // namespace vr_shell | 315 } // namespace vr_shell |
308 | 316 |
309 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ | 317 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ |
OLD | NEW |