MaxstARSDK  3.5.0
GuideInfo.cs
1 /*==============================================================================
2 Copyright 2017 Maxst, Inc. All Rights Reserved.
3 ==============================================================================*/
4 
5 using UnityEngine;
6 using System;
7 using System.Collections.Generic;
8 using System.Linq;
9 using System.Text;
10 using System.Runtime.InteropServices;
11 
12 namespace maxstAR
13 {
17  public class GuideInfo
18  {
19  private const int MAX_VERTICES = 2000;
20 
21  private float progress = 0.0f;
22  private int keyframeCount = 0;
23  private int featureCount = 0;
24  private static float[] featureBuffer = null;
25 
26  internal GuideInfo()
27  {
28 
29  }
30 
31  internal void UpdateGuideInfo()
32  {
33  if (Application.platform == RuntimePlatform.IPhonePlayer)
34  {
35  ulong GuideInfo_cPtr = NativeStaticAPI.TrackerManager_getGuideInfo();
36  if (GuideInfo_cPtr != 0)
37  {
38  progress = NativeStaticAPI.GuideInfo_getInitializingProgress(GuideInfo_cPtr);
39  keyframeCount = NativeStaticAPI.GuideInfo_getKeyframeCount(GuideInfo_cPtr);
40  featureCount = NativeStaticAPI.GuideInfo_getFeatureCount(GuideInfo_cPtr);
41 
42  if (featureBuffer == null)
43  {
44  featureBuffer = new float[MAX_VERTICES * 3];
45  }
46 
47  NativeStaticAPI.GuideInfo_getFeatureBuffer(GuideInfo_cPtr, featureBuffer, featureCount * 3);
48  }
49  }
50  else
51  {
52  ulong GuideInfo_cPtr = NativeSharedAPI.TrackerManager_getGuideInfo();
53  if (GuideInfo_cPtr != 0)
54  {
55  progress = NativeSharedAPI.GuideInfo_getInitializingProgress(GuideInfo_cPtr);
56  keyframeCount = NativeSharedAPI.GuideInfo_getKeyframeCount(GuideInfo_cPtr);
57  featureCount = NativeSharedAPI.GuideInfo_getFeatureCount(GuideInfo_cPtr);
58 
59  if (featureBuffer == null)
60  {
61  featureBuffer = new float[MAX_VERTICES * 3];
62  }
63 
64  NativeSharedAPI.GuideInfo_getFeatureBuffer(GuideInfo_cPtr, featureBuffer, featureCount * 3);
65  }
66  }
67  }
68 
73  public float GetInitializingProgress()
74  {
75  return progress;
76  }
77 
82  public int GetFeatureCount()
83  {
84  return featureCount;
85  }
86 
91  public int GetKeyframeCount()
92  {
93  return keyframeCount;
94  }
95 
100  public float[] GetFeatureBuffer()
101  {
102  return featureBuffer;
103  }
104  }
105 }
float [] GetFeatureBuffer()
Get projected feature buffer for SLAM (Always returns same address so vertex count must be considered...
Definition: GuideInfo.cs:100
int GetFeatureCount()
Get projected feature count in SLAM (float * 3 = 1 feature)
Definition: GuideInfo.cs:82
Contains surface's data generated from slam tracking
Definition: GuideInfo.cs:17
float GetInitializingProgress()
Get a percentage of progress during an initialization step of SLAM
Definition: GuideInfo.cs:73
int GetKeyframeCount()
Get keyframe count in SLAM
Definition: GuideInfo.cs:91