Chromium Code Reviews| 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, | |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
= 0 for consistency?
mthiesse
2016/09/08 17:44:41
Done.
| |
| 26 YBOTTOM, | |
| 27 YCENTER, | |
| 28 YNONE | |
| 29 }; | |
| 30 | |
| 31 class ReversibleTransform { | |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
Just want to make sure you've looked at the ui/gfx
mthiesse
2016/09/08 17:44:41
Yes, we've looked at it. The main problem is that
| |
| 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; | |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
to_world_
mthiesse
2016/09/08 17:44:40
Done.
| |
| 42 gvr::Mat4f mFromWorld; | |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
from_world_
mthiesse
2016/09/08 17:44:40
Done.
| |
| 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; | |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
Remove?
mthiesse
2016/09/08 17:44:40
Done.
| |
| 54 ReversibleTransform mTransform; | |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
transform_
mthiesse
2016/09/08 17:44:40
Done.
| |
| 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; | |
|
David Trainor- moved to gerrit
2016/09/08 05:49:30
Fix member variable names to match above comments.
mthiesse
2016/09/08 17:44:40
Done.
| |
| 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 |