public int LoadMap(byte[] mapBytes = null) { if (mapBytes == null) { mapBytes = (m_MapFile != null) ? m_MapFile.bytes : null; } if (mapBytes == null) { return(-1); } m_MapHandle = Immersal.Core.LoadMap(mapBytes); if (m_MapHandle != -1) { Vector3[] points = new Vector3[65536]; int num = Immersal.Core.GetPointCloud(m_MapHandle, points); CreateCloud(points, num); if (!Application.isEditor) { m_Root = m_ArSpace.transform; Matrix4x4 offset = Matrix4x4.TRS(transform.localPosition, transform.localRotation, Vector3.one); ARLocalizer.RegisterSpace(m_Root, m_MapHandle, offset); } } return(m_MapHandle); }
public void FreeMap() { if (m_MapHandle != -1) { Immersal.Core.FreeMap(m_MapHandle); if (!Application.isEditor) { ARLocalizer.UnregisterSpace(m_Root, m_MapHandle); } } }
void Awake() { if (instance == null) { instance = this; } if (instance != this) { Debug.LogError("There must be only one ARLocalizer object in a scene."); UnityEngine.Object.DestroyImmediate(this); return; } }