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

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

Issue 2777633003: Avoid duplicate math when computing VR scene hierarchy. (Closed)
Patch Set: Rever the inheritable transform getter for now - we can make a struct-to-class change later if we w… 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_elements.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_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
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* GetTransform() { return &transform_; }
mthiesse 2017/03/27 15:31:16 nit: maybe use MutableTransform()? Correct style i
cjgrant 2017/03/27 15:58:24 Done. Good call on that!
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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/ui_elements.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698