//public static void CheckForManagerRefresh( bool UseDepth, bool UseSkeleton ) public static void CheckForManagerRefresh(ExpSettings.DATA_REQUESTED dataRequested) { if (_Instance == null) { return; } //_Instance.StartCoroutine( _Instance._CheckForManagerRefresh(UseDepth, UseSkeleton) ); _Instance.StartCoroutine(_Instance._CheckForManagerRefresh(dataRequested)); }
private IEnumerator _CheckForManagerRefresh(ExpSettings.DATA_REQUESTED dataResquested) { Debug.Log("_CheckForManagerRefresh : " + dataResquested + "/ platform = " + Application.platform); bool shouldRefresh = false; if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer) { shouldRefresh = false; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { shouldRefresh = (dataResquested != LastResquestedData); } else { shouldRefresh = false; } //if ( UseDepth && !UseSkeleton) /* * if (dataResquested == ExpSettings.DATA_REQUESTED.Depth) * { * if( KManager.getDepthFrames != KinectManager.DepthTextureType.DepthTexture || KManager.getBodyFrames != KinectManager.BodyTextureType.None) * { * shouldRefresh = true; * } * } * //else if( !UseDepth && UseSkeleton) * else if (dataResquested == ExpSettings.DATA_REQUESTED.Body) * { * if( KManager.getBodyFrames != KinectManager.BodyTextureType.UserTexture || KManager.getDepthFrames != KinectManager.DepthTextureType.None) * { * shouldRefresh = true; * } * } * else if( dataResquested == ExpSettings.DATA_REQUESTED.Users) * { * if (KManager.getBodyFrames != KinectManager.BodyTextureType.UserTexture || KManager.getDepthFrames != KinectManager.DepthTextureType.None) * { * shouldRefresh = true; * } * } */ /* * else if( UseDepth && UseSkeleton) * { * shouldRefresh = true; * } */ /* * if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer) * { * shouldRefresh = false; * }*/ Debug.Log("ShouldRefresh = " + shouldRefresh); if (shouldRefresh) { Debug.Log("We should Refresh CVInterface for " + dataResquested); Destroy(ManagerGO); ManagerGO = null; KManager = null; yield return(null); //Init(UseDepth, UseSkeleton); Init(dataResquested); } yield return(null); }
private void Init(ExpSettings.DATA_REQUESTED dataRequest = ExpSettings.DATA_REQUESTED.Body) //private void Init(bool UseDepth = false, bool UseSkeleton = true) { Initialized = false; ManagerGO = Instantiate(Resources.Load <GameObject>(KINECT_PREFAB), transform); ManagerGO.name = "KinectManager"; KManager = ManagerGO.GetComponent <KinectManager>(); Debug.Log("CVInterface: Init platform " + Application.platform + "/ data req = " + dataRequest); LastResquestedData = dataRequest; if (Application.platform == RuntimePlatform.WindowsEditor) { GameObject igo = Instantiate(Resources.Load <GameObject>(K2_INTERFACE_PREFAB), ManagerGO.transform); CurrentSensorInterface = igo.GetComponent <DepthSensorBase>(); } else if (Application.platform == RuntimePlatform.WindowsPlayer) { GameObject igo = Instantiate(Resources.Load <GameObject>(K2_INTERFACE_PREFAB), ManagerGO.transform); CurrentSensorInterface = igo.GetComponent <DepthSensorBase>(); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { GameObject igo = Instantiate(Resources.Load <GameObject>(ARKIT_INTERFACE_PREFAB), ManagerGO.transform); CurrentSensorInterface = igo.GetComponent <DepthSensorBase>(); } else { Debug.LogWarning("What platform ?!? = " + Application.platform); } if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer) { KManager.getDepthFrames = KinectManager.DepthTextureType.DepthTexture; KManager.getBodyFrames = KinectManager.BodyTextureType.UserTexture; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { ARKitInterface ark = CurrentSensorInterface as ARKitInterface; if (dataRequest == ExpSettings.DATA_REQUESTED.Body) { KManager.getDepthFrames = KinectManager.DepthTextureType.None; KManager.getBodyFrames = KinectManager.BodyTextureType.UserTexture; } else if (dataRequest == ExpSettings.DATA_REQUESTED.Depth) { KManager.getDepthFrames = KinectManager.DepthTextureType.DepthTexture; KManager.getBodyFrames = KinectManager.BodyTextureType.None; ark.depthMode = com.rfilkov.kinect.ARKitInterface.ArKitDepthMode.EnvironmentDepth; } else if (dataRequest == ExpSettings.DATA_REQUESTED.Users) { KManager.getDepthFrames = KinectManager.DepthTextureType.DepthTexture; KManager.getBodyFrames = KinectManager.BodyTextureType.None; ark.depthMode = com.rfilkov.kinect.ARKitInterface.ArKitDepthMode.HumanDepth; } else { Debug.Log("Probleme avec dataRequest : " + dataRequest); } Debug.Log("arkit depth set to " + ark.depthMode); } /* * if (UseDepth && !UseSkeleton) * { * if (KManager.getDepthFrames != KinectManager.DepthTextureType.DepthTexture) * { * KManager.getDepthFrames = KinectManager.DepthTextureType.DepthTexture; * KManager.getBodyFrames = KinectManager.BodyTextureType.None; * } * } * else if (!UseDepth && UseSkeleton) * { * if (KManager.getBodyFrames != KinectManager.BodyTextureType.UserTexture) * { * KManager.getDepthFrames = KinectManager.DepthTextureType.None; * KManager.getBodyFrames = KinectManager.BodyTextureType.UserTexture; * } * } * else * { * if (Application.platform == RuntimePlatform.IPhonePlayer) * { * KManager.getDepthFrames = KinectManager.DepthTextureType.None; * KManager.getBodyFrames = KinectManager.BodyTextureType.UserTexture; * } * else * { * KManager.getDepthFrames = KinectManager.DepthTextureType.DepthTexture; * KManager.getBodyFrames = KinectManager.BodyTextureType.UserTexture; * } * } */ /* * if( Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer) * { * KManager.getDepthFrames = KinectManager.DepthTextureType.DepthTexture; * KManager.getBodyFrames = KinectManager.BodyTextureType.UserTexture; * } */ SetDebug(LastDebugValue); KManager.StartDepthSensors(); Initialized = true; }