| 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_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 XLEFT, | 21 XLEFT, |
| 22 XRIGHT | 22 XRIGHT |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 enum YAnchoring { | 25 enum YAnchoring { |
| 26 YNONE = 0, | 26 YNONE = 0, |
| 27 YTOP, | 27 YTOP, |
| 28 YBOTTOM | 28 YBOTTOM |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 enum Fill { |
| 32 NONE = 0, |
| 33 // The element is filled with part of the HTML UI as specified by the copy |
| 34 // rect. |
| 35 SPRITE = 1, |
| 36 // The element is filled with a radial gradient as specified by the edge and |
| 37 // center color. |
| 38 OPAQUE_GRADIENT = 2, |
| 39 // Same as OPAQUE_GRADIENT but the element is drawn as a grid. |
| 40 GRID_GRADIENT = 3, |
| 41 // The element is filled with the content web site. Only one content element |
| 42 // may be added to the |
| 43 // scene. |
| 44 CONTENT = 4 |
| 45 }; |
| 46 |
| 31 struct ReversibleTransform { | 47 struct ReversibleTransform { |
| 32 ReversibleTransform(); | 48 ReversibleTransform(); |
| 33 | 49 |
| 34 void MakeIdentity(); | 50 void MakeIdentity(); |
| 35 void Rotate(gvr::Quatf quat); | 51 void Rotate(gvr::Quatf quat); |
| 36 void Rotate(float ax, float ay, float az, float rad); | 52 void Rotate(float ax, float ay, float az, float rad); |
| 37 void Translate(float tx, float ty, float tz); | 53 void Translate(float tx, float ty, float tz); |
| 38 void Scale(float sx, float sy, float sz); | 54 void Scale(float sx, float sy, float sz); |
| 39 | 55 |
| 40 gvr::Mat4f to_world; | 56 gvr::Mat4f to_world; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 65 | 81 |
| 66 // Indicates whether the element should be visually rendered. | 82 // Indicates whether the element should be visually rendered. |
| 67 bool IsVisible() const; | 83 bool IsVisible() const; |
| 68 | 84 |
| 69 // Indicates whether the element should be tested for cursor input. | 85 // Indicates whether the element should be tested for cursor input. |
| 70 bool IsHitTestable() const; | 86 bool IsHitTestable() const; |
| 71 | 87 |
| 72 // Valid IDs are non-negative. | 88 // Valid IDs are non-negative. |
| 73 int id = -1; | 89 int id = -1; |
| 74 | 90 |
| 75 // If a non-negative parent ID is specified, applicable tranformations | 91 // If a non-negative parent ID is specified, applicable transformations |
| 76 // are applied relative to the parent, rather than absolutely. | 92 // are applied relative to the parent, rather than absolutely. |
| 77 int parent_id = -1; | 93 int parent_id = -1; |
| 78 | 94 |
| 79 // If true, this object will be visible. | 95 // If true, this object will be visible. |
| 80 bool visible = true; | 96 bool visible = true; |
| 81 | 97 |
| 82 // If false, the reticle will not hit the element, even if visible. | 98 // If false, the reticle will not hit the element, even if visible. |
| 83 bool hit_testable = true; | 99 bool hit_testable = true; |
| 84 | 100 |
| 85 // If true, transformations will be applied relative to the field of view, | 101 // If true, transformations will be applied relative to the field of view, |
| 86 // rather than the world. | 102 // rather than the world. |
| 87 bool lock_to_fov = false; | 103 bool lock_to_fov = false; |
| 88 | 104 |
| 89 // If true, this element is the content quad. Only one content quad may be | |
| 90 // added to the scene. | |
| 91 bool content_quad = false; | |
| 92 | |
| 93 // Specifies the region (in pixels) of a texture to render. | 105 // Specifies the region (in pixels) of a texture to render. |
| 94 Recti copy_rect = {0, 0, 0, 0}; | 106 Recti copy_rect = {0, 0, 0, 0}; |
| 95 | 107 |
| 96 // The size of the object. This does not affect children. | 108 // The size of the object. This does not affect children. |
| 97 gvr::Vec3f size = {1.0f, 1.0f, 1.0f}; | 109 gvr::Vec3f size = {1.0f, 1.0f, 1.0f}; |
| 98 | 110 |
| 99 // The scale of the object, and its children. | 111 // The scale of the object, and its children. |
| 100 gvr::Vec3f scale = {1.0f, 1.0f, 1.0f}; | 112 gvr::Vec3f scale = {1.0f, 1.0f, 1.0f}; |
| 101 | 113 |
| 102 // The rotation of the object, and its children. | 114 // The rotation of the object, and its children. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 114 | 126 |
| 115 // If anchoring is specified, the translation will be relative to the | 127 // If anchoring is specified, the translation will be relative to the |
| 116 // specified edge(s) of the parent, rather than the center. A parent object | 128 // specified edge(s) of the parent, rather than the center. A parent object |
| 117 // must be specified when using anchoring. | 129 // must be specified when using anchoring. |
| 118 XAnchoring x_anchoring = XAnchoring::XNONE; | 130 XAnchoring x_anchoring = XAnchoring::XNONE; |
| 119 YAnchoring y_anchoring = YAnchoring::YNONE; | 131 YAnchoring y_anchoring = YAnchoring::YNONE; |
| 120 | 132 |
| 121 // Animations that affect the properties of the object over time. | 133 // Animations that affect the properties of the object over time. |
| 122 std::vector<std::unique_ptr<Animation>> animations; | 134 std::vector<std::unique_ptr<Animation>> animations; |
| 123 | 135 |
| 136 Fill fill = Fill::NONE; |
| 137 |
| 138 Colorf edge_color = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 139 Colorf center_color = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 140 |
| 141 int gridline_count = 1; |
| 142 |
| 124 private: | 143 private: |
| 125 DISALLOW_COPY_AND_ASSIGN(ContentRectangle); | 144 DISALLOW_COPY_AND_ASSIGN(ContentRectangle); |
| 126 }; | 145 }; |
| 127 | 146 |
| 128 } // namespace vr_shell | 147 } // namespace vr_shell |
| 129 | 148 |
| 130 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ | 149 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
| OLD | NEW |