//Close any ongoing Session
    void OnDisable()
    {
        if (smoother3D != null)
        {
            for (int i = 0; i < MaxHands; i++)
            {
                if (smoother3D[i] != null)
                {
                    for (int j = 0; j < MaxJoints; j++)
                    {
                        smoother3D[i][j].Dispose();
                        smoother3D[i][j] = null;
                    }
                }
            }
            smoother3D = null;
        }

        if (smoother != null)
        {
            smoother.Dispose();
            smoother = null;
        }

        if (sm != null)
        {
            sm.Close();
            sm.Dispose();
            sm = null;
        }
    }
    //Close any ongoing Session
    void OnDisable()
    {
        if (smoother3D != null)
        {
            for (int i = 0; i < MaxHands; i++)
            {
                if (smoother3D[i] != null)
                {
                    for (int j = 0; j < MaxJoints; j++)
                    {
                        smoother3D[i][j].Dispose();
                        smoother3D[i][j] = null;
                    }
                }
            }
            smoother3D = null;
        }

        if (smoother != null)
        {
            smoother.Dispose();
            smoother = null;
        }

        if (sm != null)
        {
            sm.Close();
            sm.Dispose();
            sm = null;
        }
    }
Esempio n. 3
0
 private void CreateSmootherType(SmoothingTypes type, float factor, out PXCMSmoother.Smoother1D smoother)
 {
     switch (type)
     {
         case SmoothingTypes.Quadratic:
             smoother = _smoother.Create1DQuadratic(factor);
             break;
         case SmoothingTypes.Stabilizer:
             smoother = _smoother.Create1DStabilizer(7, factor);
             break;
         case SmoothingTypes.Weighted:
             smoother = _smoother.Create1DWeighted((int)factor);
             break;
         case SmoothingTypes.Spring:
         default:
             smoother = _smoother.Create1DSpring(factor);
             break;
     }
 }