public void Init(GestureConfigParams Param) { m_NativeParam = new NativeGestureConfigParam(); m_NativeParam.IsUsingSubThread = Convert.ToInt32(Param.IsUsingSubThread); m_NativeParam.ReturnInfoType = (int)Param.GestureReturnInfoType; m_NativeParam.PlayerNum = Param.PlayerNum; m_NativeParam.SkeletonVelocityFrames = Param.SkeletonVelocityFrames; m_NativeParam.SkeletonVelocityMulType = (int)Param.SkeletonVelocityMulType; m_NativeParam.SkeletonNum = OrbbecWrapper.availableJoints.Length; SkeletonIndexs = new int[m_NativeParam.SkeletonNum]; for (int i = 0; i < SkeletonIndexs.Length; ++i) { SkeletonIndexs[i] = (int)OrbbecWrapper.availableJoints[i]; } m_NativeParam.SkeletonTypeArray = Marshal.UnsafeAddrOfPinnedArrayElement(SkeletonIndexs, 0); m_NativeParam.IsGetVelocityData = Convert.ToInt32(Param.IsGetVelocityData); GestureNativeMethods.InitGestureNative(m_NativeParam); }
void Init(GestureConfigParams Param) { if (Param == null) { this.Param = new GestureConfigParams(); } else { this.Param = Param; } BindPlayers = new PlayerStateBase[this.Param.PlayerNum]; switch (this.Param.GestureReturnInfoType) { case ReturnInfoType.RIT_STATE_ONLY: for (int i = 0; i < Instance.BindPlayers.Length; ++i) { Instance.BindPlayers[i] = new PlayerState_State(); } break; case ReturnInfoType.RIT_SEGMENTID_STATE: for (int i = 0; i < Instance.BindPlayers.Length; ++i) { Instance.BindPlayers[i] = new PlayerState_SegState(); } break; case ReturnInfoType.RIT_SEGMENTID_TIME_STATE: for (int i = 0; i < Instance.BindPlayers.Length; ++i) { Instance.BindPlayers[i] = new PlayerState_SegTimeState(); } break; } if (this.Param.IsGetVelocityData) { for (int i = 0; i < Instance.BindPlayers.Length; ++i) { Instance.BindPlayers[i].SkeletonVelocityInfo = new Point3D[OrbbecManager.Instance.GetAvailableJointArray().Length]; } } if (this.Param.IsUsingSubThread) { m_GetGestureInfoFunc = OnGetGestureInfo; } else { m_GetGestureInfoFunc = UpdateSkeletonImmediate; } m_Wrapper = new GestureWrapper(); m_Wrapper.Init(this.Param); }
public static GestureManager Create(GestureConfigParams Param) { if (OrbbecManager.Instance == null) { Log.Print(Log.Level.Error, "OrbbecManager is null, you should create GestureManager after OrbbecManager has been created."); return(null); } if (!OrbbecManager.Instance.IsInited) { Log.Print(Log.Level.Error, "OrbbecManager still no be initialized, you should create GestureManager after OrbbecManager has been initialized."); return(null); } GameObject obj = new GameObject("GestureManager"); obj.AddComponent <GestureManager>(); Instance.Init(Param); return(Instance); }