| 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..1cb2f3eed27f111d2e60c2af062bd09590da0ddd
|
| --- /dev/null
|
| +++ b/chrome/browser/android/vr_shell/ui_elements.h
|
| @@ -0,0 +1,88 @@
|
| +// 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,
|
| + YBOTTOM,
|
| + YCENTER,
|
| + YNONE
|
| +};
|
| +
|
| +class ReversibleTransform {
|
| + public:
|
| + ReversibleTransform();
|
| +
|
| + void SetIdentity();
|
| + 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 mToWorld;
|
| + gvr::Mat4f mFromWorld;
|
| +
|
| + // 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 mOrientation = {0.0f, 0.0f, 0.0f, 1.0f};
|
| +};
|
| +
|
| +class WorldObject {
|
| + public:
|
| + // WorldObject* mParent = nullptr;
|
| + ReversibleTransform mTransform;
|
| +};
|
| +
|
| +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 contentTextureHandle;
|
| + Rectf copyRect;
|
| + Recti windowRect;
|
| + gvr::Vec3f size;
|
| + gvr::Vec3f translation;
|
| + XAnchoring xAnchoring;
|
| + YAnchoring yAnchoring;
|
| + bool anchorZ;
|
| + std::vector<float> orientationAxisAngle;
|
| + std::vector<float> rotationAxisAngle;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(ContentRectangle);
|
| +};
|
| +
|
| +} // namespace vr_shell
|
| +
|
| +#endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_H_
|
|
|