aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/apps/arcore/src/main/cpp/SkArCamera.h
diff options
context:
space:
mode:
authorGravatar ziadb <ziadb@google.com>2018-07-11 10:16:49 -0400
committerGravatar Ziad Ben Hadj-Alouane <ziadb@google.com>2018-07-12 17:32:54 +0000
commit4cb6520bd0f0b65b29b02d8fa95afea689ae592b (patch)
tree040a4c0e21eecc056d8f91fd65ff17b5d3e6fe78 /platform_tools/android/apps/arcore/src/main/cpp/SkArCamera.h
parente346b1eea442065261c14f92b304031e1330e491 (diff)
SkArCamera* files
Bug: skia: Change-Id: I711143c53bf66ebc8130b2401738da3cde644fbe Reviewed-on: https://skia-review.googlesource.com/140560 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'platform_tools/android/apps/arcore/src/main/cpp/SkArCamera.h')
-rw-r--r--platform_tools/android/apps/arcore/src/main/cpp/SkArCamera.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/platform_tools/android/apps/arcore/src/main/cpp/SkArCamera.h b/platform_tools/android/apps/arcore/src/main/cpp/SkArCamera.h
new file mode 100644
index 0000000000..0cf8f3c449
--- /dev/null
+++ b/platform_tools/android/apps/arcore/src/main/cpp/SkArCamera.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2018 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkArCamera_DEFINED
+#define SkArCamera_DEFINED
+
+#include <memory>
+#include "SkArTrackingState.h"
+
+class ArCamera;
+class SkArFrame;
+class SkArSession;
+
+/**
+ * Provides information about the camera that is used to capture images. Such information
+ * includes projection matrices, pose of camera...
+ */
+
+class SkArCamera {
+
+public:
+ /**
+ * Factory method used to construct an SkArCamera from the current frame, using the current
+ * session
+ * @param session raw pointer to the current SkArSession
+ * @param frame raw pointer to the current SkArFrame
+ * @return unique pointer to an SkArCamera. Never nullptr
+ */
+ static std::unique_ptr<SkArCamera> Make(SkArSession* session, SkArFrame* frame);
+
+ ~SkArCamera();
+
+ /**
+ * Fills outColMajor with the values of the camera's current View matrix in column-major order
+ * @param session current SkArSession
+ * @param outColMajor 16-float array that will contain the View matrix content
+ */
+ void getViewMatrix(const SkArSession* session, float outColMajor[16]);
+
+ /**
+ * Fills outColMajor with the values of the camera's current Projection matrix in
+ * column-major order
+ * @param session current SkArSession
+ * @param nearClip wanted near clip value for the camera
+ * @param farClip wanted far clip value for the camera
+ * @param outColMajor 16-float array that will contain the Projection matrix content
+ */
+ void getProjectionMatrix(const SkArSession* session, float nearClip, float farClip,
+ float outColMajor[16]);
+
+ /**
+ * Used to check the current SkArTrackingState of the camera
+ * @param session current SkArSession
+ * @return tracking state of the SkArCamera described by the SkArTrackingState enum
+ */
+ SkArTrackingState getTrackingState(const SkArSession* session);
+
+private:
+ SkArCamera(SkArSession* session, SkArFrame* frame);
+
+ // This is a raw pointer. Its lifetime matches that of this class (SkArCamera)
+ ArCamera* fArCamera;
+};
+#endif // SkArCamera_DEFINED