Chromium Code Reviews| Index: chrome/browser/android/vr_shell/ui_elements.h |
| diff --git a/chrome/browser/android/vr_shell/ui_elements.h b/chrome/browser/android/vr_shell/ui_elements.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2e122ac1e42d32f2d98df43028efe73e1638e8f7 |
| --- /dev/null |
| +++ b/chrome/browser/android/vr_shell/ui_elements.h |
| @@ -0,0 +1,87 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
| +#define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |
| + |
| +#include <cmath> |
| +#include <vector> |
| + |
| +#include "base/logging.h" |
| +#include "chrome/browser/android/vr_shell/vr_util.h" |
| +#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr_types.h" |
| + |
| +namespace vr_shell { |
| + |
| +enum XAnchoring { |
| + XLEFT = 0, |
| + XRIGHT, |
| + XCENTER, |
| + XNONE |
| +}; |
| + |
| +enum YAnchoring { |
| + YTOP = 0, |
| + YBOTTOM, |
| + YCENTER, |
| + YNONE |
| +}; |
| + |
| +class ReversibleTransform { |
| + public: |
| + ReversibleTransform(); |
| + |
| + void MakeIdentity(); |
| + void Rotate(gvr::Quatf quat); |
| + void Rotate(float ax, float ay, float az, float rad); |
| + void Translate(float tx, float ty, float tz); |
| + void Scale(float sx, float sy, float sz); |
| + |
| + gvr::Mat4f to_world_; |
|
bshe
2016/09/09 14:42:10
remove trailing _ for public members.
mthiesse
2016/09/09 15:16:38
Done.
David Trainor- moved to gerrit
2016/09/13 05:43:06
Hmm are you sure? IIUC the Google style guide req
bshe
2016/09/13 13:54:28
Looking back at the style guide. You are right, it
|
| + gvr::Mat4f from_world_; |
|
bshe
2016/09/09 14:42:10
ditto.
mthiesse
2016/09/09 15:16:38
Done.
|
| + |
| + // This object-to-world orientation quaternion is technically |
| + // redundant, but it's easy to track it here for use as needed. |
| + // TODO(klausw): use this instead of MatrixVectorRotation()? |
| + // Would need quat * vector implementation. |
| + gvr::Quatf orientation_ = {0.0f, 0.0f, 0.0f, 1.0f}; |
|
bshe
2016/09/09 14:42:10
ditto
mthiesse
2016/09/09 15:16:38
Done.
|
| +}; |
| + |
| +class WorldObject { |
| + public: |
| + ReversibleTransform transform_; |
| +}; |
| + |
| +class WorldRectangle : public WorldObject { |
| + public: |
| + gvr::Vec3f GetCenter() const; |
| + gvr::Vec3f GetNormal() const; |
| + float GetRayDistance(gvr::Vec3f rayOrigin, gvr::Vec3f rayVector) const; |
| +}; |
| + |
| +class ContentRectangle : public WorldRectangle { |
| + public: |
| + ContentRectangle(); |
| + ~ContentRectangle(); |
| + |
| + int id; |
| + // samplerExternalOES texture data for desktop content image. |
| + int content_texture_handle; |
|
David Trainor- moved to gerrit
2016/09/09 06:28:29
Need trailing _ for these
mthiesse
2016/09/09 15:16:38
These are public members, expected to be accessed
David Trainor- moved to gerrit
2016/09/13 05:43:06
I feel like in that case we should just make the c
bshe
2016/09/13 13:54:28
Agree. See. https://google.github.io/styleguide/cp
|
| + Rectf copy_rect; |
| + Recti window_rect; |
| + gvr::Vec3f size; |
| + gvr::Vec3f translation; |
| + XAnchoring x_anchoring; |
| + YAnchoring y_anchoring; |
| + bool anchor_z; |
| + std::vector<float> orientation_axis_angle; |
| + std::vector<float> rotation_axis_angle; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(ContentRectangle); |
| +}; |
| + |
| +} // namespace vr_shell |
| + |
| +#endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_ |