| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
| 7 |
| 8 #include <cmath> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/logging.h" |
| 12 #include "chrome/browser/android/vr_shell/vr_util.h" |
| 13 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr_types.h" |
| 14 |
| 15 namespace vr_shell { |
| 16 |
| 17 enum XAnchoring { |
| 18 XLEFT = 0, |
| 19 XRIGHT, |
| 20 XCENTER, |
| 21 XNONE |
| 22 }; |
| 23 |
| 24 enum YAnchoring { |
| 25 YTOP = 0, |
| 26 YBOTTOM, |
| 27 YCENTER, |
| 28 YNONE |
| 29 }; |
| 30 |
| 31 struct ReversibleTransform { |
| 32 ReversibleTransform(); |
| 33 |
| 34 void MakeIdentity(); |
| 35 void Rotate(gvr::Quatf quat); |
| 36 void Rotate(float ax, float ay, float az, float rad); |
| 37 void Translate(float tx, float ty, float tz); |
| 38 void Scale(float sx, float sy, float sz); |
| 39 |
| 40 gvr::Mat4f to_world; |
| 41 gvr::Mat4f from_world; |
| 42 |
| 43 // This object-to-world orientation quaternion is technically |
| 44 // redundant, but it's easy to track it here for use as needed. |
| 45 // TODO(klausw): use this instead of MatrixVectorRotation()? |
| 46 // Would need quat * vector implementation. |
| 47 gvr::Quatf orientation = {0.0f, 0.0f, 0.0f, 1.0f}; |
| 48 }; |
| 49 |
| 50 struct WorldObject { |
| 51 ReversibleTransform transform; |
| 52 }; |
| 53 |
| 54 struct WorldRectangle : public WorldObject { |
| 55 gvr::Vec3f GetCenter() const; |
| 56 gvr::Vec3f GetNormal() const; |
| 57 float GetRayDistance(gvr::Vec3f rayOrigin, gvr::Vec3f rayVector) const; |
| 58 }; |
| 59 |
| 60 struct ContentRectangle : public WorldRectangle { |
| 61 ContentRectangle(); |
| 62 ~ContentRectangle(); |
| 63 |
| 64 int id; |
| 65 // samplerExternalOES texture data for desktop content image. |
| 66 int content_texture_handle; |
| 67 Rectf copy_rect; |
| 68 Recti window_rect; |
| 69 gvr::Vec3f size; |
| 70 gvr::Vec3f translation; |
| 71 XAnchoring x_anchoring; |
| 72 YAnchoring y_anchoring; |
| 73 bool anchor_z; |
| 74 std::vector<float> orientation_axis_angle; |
| 75 std::vector<float> rotation_axis_angle; |
| 76 |
| 77 private: |
| 78 DISALLOW_COPY_AND_ASSIGN(ContentRectangle); |
| 79 }; |
| 80 |
| 81 } // namespace vr_shell |
| 82 |
| 83 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
| OLD | NEW |