• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 Google Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "include/core/SkCanvas.h"
18 #include "platform_tools/android/apps/arcore/src/main/cpp/hello_ar_application.h"
19 #include "platform_tools/android/apps/arcore/src/main/cpp/plane_renderer.h"
20 #include "platform_tools/android/apps/arcore/src/main/cpp/util.h"
21 
22 namespace hello_ar {
PendingAnchor(SkPoint touchLocation)23     PendingAnchor::PendingAnchor(SkPoint touchLocation) : touchLocation(touchLocation) {}
24 
~PendingAnchor()25     PendingAnchor::~PendingAnchor() {}
26 
GetTouchLocation()27     SkPoint PendingAnchor::GetTouchLocation() {
28         return touchLocation;
29     }
30 
GetEditMode()31     bool PendingAnchor::GetEditMode() {
32         return editMode;
33     }
34 
GetContainingPlane()35     ArPlane* PendingAnchor::GetContainingPlane() {
36         return containingPlane;
37     }
38 
GetAnchorPos(ArSession * arSession)39     glm::vec4 PendingAnchor::GetAnchorPos(ArSession* arSession) {
40         float poseRaw[] = {0, 0, 0, 0, 0, 0, 0};
41         ArPose* anchorPose = nullptr;
42         ArPose_create(arSession, poseRaw, &anchorPose);
43         ArAnchor_getPose(arSession, this->anchor, anchorPose);
44         ArPose_getPoseRaw(arSession, anchorPose, poseRaw);
45         ArPose_destroy(anchorPose);
46         glm::vec4 anchorPos = glm::vec4(poseRaw[4], poseRaw[5], poseRaw[6], 1);
47         return anchorPos;
48     }
49 
GetArAnchor()50     ArAnchor* PendingAnchor::GetArAnchor() {
51         return anchor;
52     }
53 
SetArAnchor(ArAnchor * anchor)54     void PendingAnchor::SetArAnchor(ArAnchor* anchor) {
55         this->anchor = anchor;
56     }
57 
SetEditMode(bool editMode)58     void PendingAnchor::SetEditMode(bool editMode) {
59         this->editMode = editMode;
60     }
61 
SetContainingPlane(ArPlane * plane)62     void PendingAnchor::SetContainingPlane(ArPlane* plane) {
63         this->containingPlane = plane;
64     }
65 
66 
67 
68 }  // namespace hello_ar
69