7 using System.Collections.Generic;
10 using System.Runtime.InteropServices;
19 private const int MAX_VERTICES = 1000;
20 private const int MAX_INDICES = 20000;
22 private float progress = 0.0f;
23 private int vertexCount = 0;
24 private int indexCount = 0;
25 private static float[] vertexBuffer = null;
26 private static short[] indexBuffer = null;
33 internal void UpdateSurfaceMesh()
35 if (Application.platform == RuntimePlatform.IPhonePlayer)
37 ulong SurfaceMesh_cPtr =
NativeStaticAPI.TrackerManager_getSurfaceMesh();
38 if (SurfaceMesh_cPtr != 0)
40 progress =
NativeStaticAPI.SurfaceMesh_getInitializingProgress(SurfaceMesh_cPtr);
41 vertexCount =
NativeStaticAPI.SurfaceMesh_getVertexCount(SurfaceMesh_cPtr);
42 indexCount =
NativeStaticAPI.SurfaceMesh_getIndexCount(SurfaceMesh_cPtr);
44 if (vertexBuffer == null)
46 vertexBuffer =
new float[MAX_VERTICES * 3];
49 if (indexBuffer == null)
51 indexBuffer =
new short[MAX_INDICES];
54 NativeStaticAPI.SurfaceMesh_getVertexBuffer(SurfaceMesh_cPtr, vertexBuffer, vertexCount * 3);
55 NativeStaticAPI.SurfaceMesh_getIndexBuffer(SurfaceMesh_cPtr, indexBuffer, indexCount);
60 ulong SurfaceMesh_cPtr =
NativeSharedAPI.TrackerManager_getSurfaceMesh();
61 if (SurfaceMesh_cPtr != 0)
63 progress =
NativeSharedAPI.SurfaceMesh_getInitializingProgress(SurfaceMesh_cPtr);
64 vertexCount =
NativeSharedAPI.SurfaceMesh_getVertexCount(SurfaceMesh_cPtr);
65 indexCount =
NativeSharedAPI.SurfaceMesh_getIndexCount(SurfaceMesh_cPtr);
67 if (vertexBuffer == null)
69 vertexBuffer =
new float[MAX_VERTICES * 3];
72 if (indexBuffer == null)
74 indexBuffer =
new short[MAX_INDICES];
77 NativeSharedAPI.SurfaceMesh_getVertexBuffer(SurfaceMesh_cPtr, vertexBuffer, vertexCount * 3);
78 NativeSharedAPI.SurfaceMesh_getIndexBuffer(SurfaceMesh_cPtr, indexBuffer, indexCount);
float [] GetVertexBuffer()
surface mesh vertex buffer (Always returns same address so vertex count must be considered) ...
float GetInitializingProgress()
Get a percentage of progress during an initialization step of SLAM
short [] GetIndexBuffer()
surface mesh index buffer (Always returns same address so index count must be considered ) ...
Contains surface's mesh data generated from slam tracking