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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void Rotate(float ax, float ay, float az, float rad); | 52 void Rotate(float ax, float ay, float az, float rad); |
53 void Translate(float tx, float ty, float tz); | 53 void Translate(float tx, float ty, float tz); |
54 void Scale(float sx, float sy, float sz); | 54 void Scale(float sx, float sy, float sz); |
55 | 55 |
56 gvr::Mat4f to_world; | 56 gvr::Mat4f to_world; |
57 }; | 57 }; |
58 | 58 |
59 class WorldRectangle { | 59 class WorldRectangle { |
60 public: | 60 public: |
61 const gvr::Mat4f& TransformMatrix() const; | 61 const gvr::Mat4f& TransformMatrix() const; |
62 void SetTransform(const Transform& transform); | 62 Transform* mutable_transform() { return &transform_; } |
63 | 63 |
64 gvr::Vec3f GetCenter() const; | 64 gvr::Vec3f GetCenter() const; |
65 gvr::Vec3f GetNormal() const; | 65 gvr::Vec3f GetNormal() const; |
66 | 66 |
67 // Computes the distance from |ray_origin| to this rectangles's plane, along | 67 // Computes the distance from |ray_origin| to this rectangles's plane, along |
68 // |ray_vector|. Returns true and populates |distance| if the calculation is | 68 // |ray_vector|. Returns true and populates |distance| if the calculation is |
69 // possible, and false if the ray is parallel to the plane. | 69 // possible, and false if the ray is parallel to the plane. |
70 bool GetRayDistance(const gvr::Vec3f& ray_origin, | 70 bool GetRayDistance(const gvr::Vec3f& ray_origin, |
71 const gvr::Vec3f& ray_vector, | 71 const gvr::Vec3f& ray_vector, |
72 float* distance) const; | 72 float* distance) const; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 Fill fill = Fill::NONE; | 148 Fill fill = Fill::NONE; |
149 | 149 |
150 Colorf edge_color = {1.0f, 1.0f, 1.0f, 1.0f}; | 150 Colorf edge_color = {1.0f, 1.0f, 1.0f, 1.0f}; |
151 Colorf center_color = {1.0f, 1.0f, 1.0f, 1.0f}; | 151 Colorf center_color = {1.0f, 1.0f, 1.0f, 1.0f}; |
152 | 152 |
153 int gridline_count = 1; | 153 int gridline_count = 1; |
154 | 154 |
155 int draw_phase = 1; | 155 int draw_phase = 1; |
156 | 156 |
| 157 // This transform can be used by children to derive position of its parent. |
| 158 Transform inheritable_transform; |
| 159 |
| 160 // A flag usable during transformation calculates to avoid duplicate work. |
| 161 bool dirty; |
| 162 |
157 private: | 163 private: |
158 DISALLOW_COPY_AND_ASSIGN(ContentRectangle); | 164 DISALLOW_COPY_AND_ASSIGN(ContentRectangle); |
159 }; | 165 }; |
160 | 166 |
161 } // namespace vr_shell | 167 } // namespace vr_shell |
162 | 168 |
163 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ | 169 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
OLD | NEW |