Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: chrome/browser/android/vr_shell/ui_elements.h

Issue 2301633002: Refactor Vr activity into ChromeTabbedActivity. (Closed)
Patch Set: Address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
David Trainor- moved to gerrit 2016/09/08 05:49:30 = 0 for consistency?
mthiesse 2016/09/08 17:44:41 Done.
+ YBOTTOM,
+ YCENTER,
+ YNONE
+};
+
+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
+ 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;
David Trainor- moved to gerrit 2016/09/08 05:49:30 to_world_
mthiesse 2016/09/08 17:44:40 Done.
+ gvr::Mat4f mFromWorld;
David Trainor- moved to gerrit 2016/09/08 05:49:30 from_world_
mthiesse 2016/09/08 17:44:40 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 mOrientation = {0.0f, 0.0f, 0.0f, 1.0f};
+};
+
+class WorldObject {
+ public:
+ // WorldObject* mParent = nullptr;
David Trainor- moved to gerrit 2016/09/08 05:49:30 Remove?
mthiesse 2016/09/08 17:44:40 Done.
+ ReversibleTransform mTransform;
David Trainor- moved to gerrit 2016/09/08 05:49:30 transform_
mthiesse 2016/09/08 17:44:40 Done.
+};
+
+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;
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.
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698