| 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, |
| 26 YBOTTOM, |
| 27 YCENTER, |
| 28 YNONE |
| 29 }; |
| 30 |
| 31 class ReversibleTransform { |
| 32 public: |
| 33 ReversibleTransform(); |
| 34 |
| 35 void SetIdentity(); |
| 36 void Rotate(gvr::Quatf quat); |
| 37 void Rotate(float ax, float ay, float az, float rad); |
| 38 void Translate(float tx, float ty, float tz); |
| 39 void Scale(float sx, float sy, float sz); |
| 40 |
| 41 gvr::Mat4f mToWorld; |
| 42 gvr::Mat4f mFromWorld; |
| 43 |
| 44 // This object-to-world orientation quaternion is technically |
| 45 // redundant, but it's easy to track it here for use as needed. |
| 46 // TODO(klausw): use this instead of MatrixVectorRotation()? |
| 47 // Would need quat * vector implementation. |
| 48 gvr::Quatf mOrientation = {0.0f, 0.0f, 0.0f, 1.0f}; |
| 49 }; |
| 50 |
| 51 class WorldObject { |
| 52 public: |
| 53 // WorldObject* mParent = nullptr; |
| 54 ReversibleTransform mTransform; |
| 55 }; |
| 56 |
| 57 class WorldRectangle : public WorldObject { |
| 58 public: |
| 59 gvr::Vec3f getCenter() const; |
| 60 gvr::Vec3f getNormal() const; |
| 61 float getRayDistance(gvr::Vec3f rayOrigin, gvr::Vec3f rayVector) const; |
| 62 }; |
| 63 |
| 64 class ContentRectangle : public WorldRectangle { |
| 65 public: |
| 66 ContentRectangle(); |
| 67 ~ContentRectangle(); |
| 68 |
| 69 int id; |
| 70 // samplerExternalOES texture data for desktop content image. |
| 71 int contentTextureHandle; |
| 72 Rectf copyRect; |
| 73 Recti windowRect; |
| 74 gvr::Vec3f size; |
| 75 gvr::Vec3f translation; |
| 76 XAnchoring xAnchoring; |
| 77 YAnchoring yAnchoring; |
| 78 bool anchorZ; |
| 79 std::vector<float> orientationAxisAngle; |
| 80 std::vector<float> rotationAxisAngle; |
| 81 |
| 82 private: |
| 83 DISALLOW_COPY_AND_ASSIGN(ContentRectangle); |
| 84 }; |
| 85 |
| 86 } // namespace vr_shell |
| 87 |
| 88 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
| OLD | NEW |