public void DestroySenseAR() { if (shotButton) { shotButton.gameObject.SetActive(false); } if (SenseARInstance) { slamController = null; database.Destroy(); database = null; Destroy(SenseARInstance); SenseARInstance = null; Debug.LogError("after SenseAR.Destroy"); } if (axisInstance) { Destroy(axisInstance); axisInstance = null; Debug.LogError("after axis.Destroy"); } Debug.LogError("end DestroySenseAR"); }
public void CreateSenseAR() { if (type == ReferenceImageType.Database && bCompleteReadingImageDatabase == false) { Debug.Log("CreateSenseAR Failed"); return; } if (type == ReferenceImageType.Patt && bCompleteReadingConfig == false) { Debug.Log("CreateSenseAR Failed"); return; } if (shotButton) { shotButton.gameObject.SetActive(true); } if (SenseARInstance == null) { SenseARInstance = (GameObject)Instantiate(SenseARBasePrefab, transform.position, transform.rotation); slamController = GameObject.Find("SlamController").GetComponent <SenseARSLAMController>(); updateTexture = GameObject.Find("ARCamera").GetComponent <SenseARUpdateTexture>(); session = SenseARInstance.GetComponent <ARCoreSession>(); database = new ReferenceImageDatabase(Session.GetNativeSession()); if (type == ReferenceImageType.SingleImage) { for (int i = 0; i < textures.Length; ++i) { database.AddImage(textures[i].name, textures[i]); } } else if (type == ReferenceImageType.Patt) { database.LoadConfig(ConfigBuffer, ConfigBufferLength); for (int i = 0; i < patts.Length; ++i) { database.AddPatt(PattsBuffer[i], PattsBufferLength[i]); } } else { database.Deserialize(ImageDatabaseBuffer, ImageDatabaseBufferLength); } session.SetReferenceImageDatabase(database); session.Connect(); // display size return screen size when portrait mode //int ScreenWidth = 0, ScreenHeight = 0; //Session.GetNativeSession().SessionApi.GetDisplaySize(ref ScreenWidth, ref ScreenHeight); } if (AxisPrefab) { axisInstance = (GameObject)Instantiate(AxisPrefab, new Vector3(0, 0, 0), transform.rotation); } }
public void SetReferenceImageDatabase(ARCoreSessionConfig config, ReferenceImageDatabase database) { m_NativeSession.SessionConfigApi.SetReferenceImageDatabase(IntPtr.Zero, database.m_ReferenceImageDatabaseNativeHandle); }