Ejemplo n.º 1
0
    // unzips the needed native libraries, if needed
    public static bool EnsureFbxWrapperAvailability(ref bool bNeedRestart)
    {
        bool   bOneCopied = false, bAllCopied = true;
        string sTargetPath = KinectInterop.GetTargetDllPath(".", KinectInterop.Is64bitArchitecture()) + "/";

        if (!KinectInterop.Is64bitArchitecture())
        {
            //Debug.Log("x32-architecture detected.");

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["FbxUnityWrapper.dll"] = sTargetPath + "FbxUnityWrapper.dll";
            //dictFilesToUnzip["libfbxsdk.dll"] = sTargetPath + "libfbxsdk.dll";
            dictFilesToUnzip["msvcp110.dll"] = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"] = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "FbxUnityWrapper.x86.zip", ref bOneCopied, ref bAllCopied);
        }
        else
        {
            //Debug.Log("x64-architecture detected.");

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["FbxUnityWrapper.dll"] = sTargetPath + "FbxUnityWrapper.dll";
            //dictFilesToUnzip["libfbxsdk.dll"] = sTargetPath + "libfbxsdk.dll";
            dictFilesToUnzip["msvcp110.dll"] = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"] = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "FbxUnityWrapper.x64.zip", ref bOneCopied, ref bAllCopied);
        }

        bNeedRestart = (bOneCopied && bAllCopied);

        return(true);
    }
Ejemplo n.º 2
0
    public bool InitSensorInterface(bool bCopyLibs, ref bool bNeedRestart)
    {
        bool   bOneCopied = false, bAllCopied = true;
        string sTargetPath = KinectInterop.GetTargetDllPath(".", KinectInterop.Is64bitArchitecture()) + "/";

        if (!bCopyLibs)
        {
            // check if the native library is there
            string sTargetLib = sTargetPath + "OrbbecAstraInterface.dll";
            bNeedRestart = false;

            string sZipFileName = !KinectInterop.Is64bitArchitecture() ? "OrbbecAstraInt.x86.zip" : "OrbbecAstraInt.x64.zip";
            long   iTargetSize  = KinectInterop.GetUnzippedEntrySize(sZipFileName, "KinectUnityAddin.dll");

            return(KinectInterop.IsFileExists(sTargetLib, iTargetSize));
        }

        // unzip the needed files
        Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();

        dictFilesToUnzip["OpenNI.ini"]  = sTargetPath + "OpenNI.ini";
        dictFilesToUnzip["OpenNI2.dll"] = sTargetPath + "OpenNI2.dll";
        dictFilesToUnzip["OrbbecAstraInterface.dll"]   = sTargetPath + "OrbbecAstraInterface.dll";
        dictFilesToUnzip["OrbbecBodyTracking.dll"]     = sTargetPath + "OrbbecBodyTracking.dll";
        dictFilesToUnzip["OrbbecBodyTracking.data"]    = sTargetPath + "OrbbecBodyTracking.data";
        dictFilesToUnzip["OpenNI2/Drivers/orbbec.dll"] = sTargetPath + "OpenNI2/Drivers/orbbec.dll";
        dictFilesToUnzip["OpenNI2/Drivers/orbbec.ini"] = sTargetPath + "OpenNI2/Drivers/orbbec.ini";
//		dictFilesToUnzip["Plugins/openni_sensor.dll"] = sTargetPath + "Plugins/openni_sensor.dll";
//		dictFilesToUnzip["Plugins/orbbec_hand.dll"] = sTargetPath + "Plugins/orbbec_hand.dll";
//		dictFilesToUnzip["Plugins/orbbec_hand.toml"] = sTargetPath + "Plugins/orbbec_hand.toml";
//		dictFilesToUnzip["Plugins/orbbec_xs.dll"] = sTargetPath + "Plugins/orbbec_xs.dll";
        dictFilesToUnzip["msvcp140.dll"]      = sTargetPath + "msvcp140.dll";
        dictFilesToUnzip["vcruntime140.dll"]  = sTargetPath + "vcruntime140.dll";
        dictFilesToUnzip["msvcp140d.dll"]     = sTargetPath + "msvcp140d.dll";
        dictFilesToUnzip["vcruntime140d.dll"] = sTargetPath + "vcruntime140d.dll";

        if (!KinectInterop.Is64bitArchitecture())
        {
            //Debug.Log("x32-architecture detected.");
            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "OrbbecAstraInt.x86.zip", ref bOneCopied, ref bAllCopied);
        }
        else
        {
            //Debug.Log("x64-architecture detected.");
            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "OrbbecAstraInt.x64.zip", ref bOneCopied, ref bAllCopied);
        }

        bNeedRestart = (bOneCopied && bAllCopied);

        return(true);
    }
Ejemplo n.º 3
0
    public bool IsFaceTrackingAvailable(ref bool bNeedRestart)
    {
        bool   bOneCopied = false, bAllCopied = true;
        string sTargetPath = ".";

        if (!KinectInterop.Is64bitArchitecture())
        {
            // 32 bit
            sTargetPath = KinectInterop.GetTargetDllPath(".", false) + "/";

//			KinectInterop.CopyResourceFile(sTargetPath + "Kinect20.Face.dll", "Kinect20.Face.dll", ref bOneCopied, ref bAllCopied);
//			KinectInterop.CopyResourceFile(sTargetPath + "KinectFaceUnityAddin.dll", "KinectFaceUnityAddin.dll", ref bOneCopied, ref bAllCopied);

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["Kinect20.Face.dll"]        = sTargetPath + "Kinect20.Face.dll";
            dictFilesToUnzip["KinectFaceUnityAddin.dll"] = sTargetPath + "KinectFaceUnityAddin.dll";
            dictFilesToUnzip["msvcp110.dll"]             = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"]             = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "KinectV2UnityAddin.x86.zip", ref bOneCopied, ref bAllCopied);
        }
        else
        {
            //Debug.Log("Face - x64-architecture.");
            sTargetPath = KinectInterop.GetTargetDllPath(".", true) + "/";

//			KinectInterop.CopyResourceFile(sTargetPath + "Kinect20.Face.dll", "Kinect20.Face.dll.x64", ref bOneCopied, ref bAllCopied);
//			KinectInterop.CopyResourceFile(sTargetPath + "KinectFaceUnityAddin.dll", "KinectFaceUnityAddin.dll.x64", ref bOneCopied, ref bAllCopied);

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["Kinect20.Face.dll"]        = sTargetPath + "Kinect20.Face.dll";
            dictFilesToUnzip["KinectFaceUnityAddin.dll"] = sTargetPath + "KinectFaceUnityAddin.dll";
            dictFilesToUnzip["msvcp110.dll"]             = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"]             = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "KinectV2UnityAddin.x64.zip", ref bOneCopied, ref bAllCopied);
        }

        KinectInterop.UnzipResourceDirectory(sTargetPath, "NuiDatabase.zip", sTargetPath + "NuiDatabase");

        bNeedRestart = (bOneCopied && bAllCopied);

        return(true);
    }
    public bool InitSensorInterface(bool bCopyLibs, ref bool bNeedRestart)
    {
        bool   bOneCopied = false, bAllCopied = true;
        string sTargetPath = KinectInterop.GetTargetDllPath(".", KinectInterop.Is64bitArchitecture()) + "/";

        if (!bCopyLibs)
        {
            // check if the native library is there
            string sTargetLib = sTargetPath + "KinectUnityAddin.dll";
            bNeedRestart = false;

            string sZipFileName = !KinectInterop.Is64bitArchitecture() ? "KinectV2UnityAddin.x86.zip" : "KinectV2UnityAddin.x64.zip";
            long   iTargetSize  = KinectInterop.GetUnzippedEntrySize(sZipFileName, "KinectUnityAddin.dll");

            return(KinectInterop.IsFileExists(sTargetLib, iTargetSize));
        }


        Debug.Log("x64-architecture detected.");

        //KinectInterop.CopyResourceFile(sTargetPath + "KinectUnityAddin.dll", "KinectUnityAddin.dll.x64", ref bOneCopied, ref bAllCopied);

        Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string> ();

        dictFilesToUnzip ["KinectUnityAddin.dll"]     = sTargetPath + "KinectUnityAddin.dll";
        dictFilesToUnzip ["Kinect20.Face.dll"]        = sTargetPath + "Kinect20.Face.dll";
        dictFilesToUnzip ["KinectFaceUnityAddin.dll"] = sTargetPath + "KinectFaceUnityAddin.dll";

        dictFilesToUnzip ["Kinect20.VisualGestureBuilder.dll"]        = sTargetPath + "Kinect20.VisualGestureBuilder.dll";
        dictFilesToUnzip ["KinectVisualGestureBuilderUnityAddin.dll"] = sTargetPath + "KinectVisualGestureBuilderUnityAddin.dll";
        dictFilesToUnzip ["vgbtechs/AdaBoostTech.dll"]    = sTargetPath + "vgbtechs/AdaBoostTech.dll";
        dictFilesToUnzip ["vgbtechs/RFRProgressTech.dll"] = sTargetPath + "vgbtechs/RFRProgressTech.dll";
        dictFilesToUnzip ["msvcp110.dll"] = sTargetPath + "msvcp110.dll";
        dictFilesToUnzip ["msvcr110.dll"] = sTargetPath + "msvcr110.dll";

        KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "KinectV2UnityAddin.x64.zip", ref bOneCopied, ref bAllCopied);


        KinectInterop.UnzipResourceDirectory(sTargetPath, "NuiDatabase.zip", sTargetPath + "NuiDatabase");

        bNeedRestart = (bOneCopied && bAllCopied);

        return(true);
    }
    private bool IsVisualGesturesAvailable(ref bool bNeedRestart)
    {
        bool   bOneCopied = false, bAllCopied = true;
        string sTargetPath = ".";

        if (!KinectInterop.Is64bitArchitecture())
        {
            // 32 bit
            sTargetPath = KinectInterop.GetTargetDllPath(".", false) + "/";

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["Kinect20.VisualGestureBuilder.dll"]        = sTargetPath + "Kinect20.VisualGestureBuilder.dll";
            dictFilesToUnzip["KinectVisualGestureBuilderUnityAddin.dll"] = sTargetPath + "KinectVisualGestureBuilderUnityAddin.dll";
            dictFilesToUnzip["vgbtechs/AdaBoostTech.dll"]    = sTargetPath + "vgbtechs/AdaBoostTech.dll";
            dictFilesToUnzip["vgbtechs/RFRProgressTech.dll"] = sTargetPath + "vgbtechs/RFRProgressTech.dll";
            dictFilesToUnzip["msvcp110.dll"] = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"] = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "KinectV2UnityAddin.x86.zip", ref bOneCopied, ref bAllCopied);
        }
        else
        {
            //Debug.Log("Face - x64-architecture.");
            sTargetPath = KinectInterop.GetTargetDllPath(".", true) + "/";

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["Kinect20.VisualGestureBuilder.dll"]        = sTargetPath + "Kinect20.VisualGestureBuilder.dll";
            dictFilesToUnzip["KinectVisualGestureBuilderUnityAddin.dll"] = sTargetPath + "KinectVisualGestureBuilderUnityAddin.dll";
            dictFilesToUnzip["vgbtechs/AdaBoostTech.dll"]    = sTargetPath + "vgbtechs/AdaBoostTech.dll";
            dictFilesToUnzip["vgbtechs/RFRProgressTech.dll"] = sTargetPath + "vgbtechs/RFRProgressTech.dll";
            dictFilesToUnzip["msvcp110.dll"] = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"] = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "KinectV2UnityAddin.x64.zip", ref bOneCopied, ref bAllCopied);
        }

        bNeedRestart = (bOneCopied && bAllCopied);

        return(true);
    }
Ejemplo n.º 6
0
    public bool InitSensorInterface(ref bool bNeedRestart)
    {
        bool bOneCopied = false, bAllCopied = true;

        if (!KinectInterop.Is64bitArchitecture())
        {
            Debug.Log("x32-architecture detected.");
            string sTargetPath = KinectInterop.GetTargetDllPath(".", false) + "/";

            //KinectInterop.CopyResourceFile(sTargetPath + "KinectUnityAddin.dll", "KinectUnityAddin.dll", ref bOneCopied, ref bAllCopied);

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["KinectUnityAddin.dll"] = sTargetPath + "KinectUnityAddin.dll";
            dictFilesToUnzip["msvcp110.dll"]         = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"]         = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "KinectV2UnityAddin.x86.zip", ref bOneCopied, ref bAllCopied);
        }
        else
        {
            Debug.Log("x64-architecture detected.");
            string sTargetPath = KinectInterop.GetTargetDllPath(".", true) + "/";

            //KinectInterop.CopyResourceFile(sTargetPath + "KinectUnityAddin.dll", "KinectUnityAddin.dll.x64", ref bOneCopied, ref bAllCopied);

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["KinectUnityAddin.dll"] = sTargetPath + "KinectUnityAddin.dll";
            dictFilesToUnzip["msvcp110.dll"]         = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"]         = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "KinectV2UnityAddin.x64.zip", ref bOneCopied, ref bAllCopied);
        }

        bNeedRestart = (bOneCopied && bAllCopied);

        return(true);
    }
Ejemplo n.º 7
0
    public bool IsSpeechRecognitionAvailable(ref bool bNeedRestart)
    {
        bool bOneCopied = false, bAllCopied = true;

        if (!KinectInterop.Is64bitArchitecture())
        {
            //Debug.Log("Speech - x32-architecture.");
            string sTargetPath = KinectInterop.GetTargetDllPath(".", false) + "/";

            //KinectInterop.CopyResourceFile(sTargetPath + "Kinect2SpeechWrapper.dll", "Kinect2SpeechWrapper.dll", ref bOneCopied, ref bAllCopied);

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["Kinect2SpeechWrapper.dll"] = sTargetPath + "Kinect2SpeechWrapper.dll";
            dictFilesToUnzip["msvcp110.dll"]             = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"]             = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "KinectV2UnityAddin.x86.zip", ref bOneCopied, ref bAllCopied);
        }
        else
        {
            //Debug.Log("Face - x64-architecture.");
            string sTargetPath = KinectInterop.GetTargetDllPath(".", true) + "/";

            //KinectInterop.CopyResourceFile(sTargetPath + "Kinect2SpeechWrapper.dll", "Kinect2SpeechWrapper.dll.x64", ref bOneCopied, ref bAllCopied);

            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();
            dictFilesToUnzip["Kinect2SpeechWrapper.dll"] = sTargetPath + "Kinect2SpeechWrapper.dll";
            dictFilesToUnzip["msvcp110.dll"]             = sTargetPath + "msvcp110.dll";
            dictFilesToUnzip["msvcr110.dll"]             = sTargetPath + "msvcr110.dll";

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "KinectV2UnityAddin.x64.zip", ref bOneCopied, ref bAllCopied);
        }

        bNeedRestart = (bOneCopied && bAllCopied);

        return(true);
    }
Ejemplo n.º 8
0
    public bool InitSensorInterface(bool bCopyLibs, ref bool bNeedRestart)
    {
        bool bOneCopied = false, bAllCopied = true;
        bool bArchX64 = KinectInterop.Is64bitArchitecture();

        string sTargetPath = KinectInterop.GetTargetDllPath(".", bArchX64) + "/";

        //string sTargetPath = "./";

        if (!bCopyLibs)
        {
            // check if the native library is there
            string sTargetLib = sTargetPath + "UnityInterface2.dll";
            bNeedRestart = false;

            string sZipFileName = !bArchX64 ? "OpenNI2UnityInterface.x86.zip" : "OpenNI2UnityInterface.x64.zip";
            long   iTargetSize  = KinectInterop.GetUnzippedEntrySize(sZipFileName, "UnityInterface2.dll");

            FileInfo targetFile = new FileInfo(sTargetLib);
            return(targetFile.Exists && targetFile.Length == iTargetSize);
        }

        // check openni directory and resources
        string sOpenNIPath = System.Environment.GetEnvironmentVariable(!bArchX64 ? "OPENNI2_REDIST" : "OPENNI2_REDIST64");

        if (sOpenNIPath == String.Empty || !Directory.Exists(sOpenNIPath))
        {
            Debug.LogWarning("OpenNI2-folder not found (check OPENNI2_REDIST).");
            return(false);
        }

        sOpenNIPath = sOpenNIPath.Replace('\\', '/');
        if (sOpenNIPath.EndsWith("/"))
        {
            sOpenNIPath = sOpenNIPath.Substring(0, sOpenNIPath.Length - 1);
        }

        // check nite directory and resources
        string sNiTEPath = System.Environment.GetEnvironmentVariable(!bArchX64 ? "NITE2_REDIST" : "NITE2_REDIST64");

        if (sNiTEPath == String.Empty || !Directory.Exists(sNiTEPath))
        {
            Debug.LogWarning("NiTE2-folder not found (check NITE2_REDIST).");
            return(false);
        }

        sNiTEPath = sNiTEPath.Replace('\\', '/');
        if (sNiTEPath.EndsWith("/"))
        {
            sNiTEPath = sNiTEPath.Substring(0, sNiTEPath.Length - 1);
        }

        string sUnityInterfaceLib = "UnityInterface2.dll";
        string sOpenNI2Lib        = "OpenNI2.dll";
        string sNiTE22Lib         = "NiTE2.dll";

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
        sUnityInterfaceLib = "UnityInterface2.dll";
        sOpenNI2Lib        = "libOpenNI2.dylib";
        sNiTE22Lib         = "libNiTE2.dylib";
#endif

        KinectInterop.CopyFile(sOpenNIPath + "/" + sOpenNI2Lib, sTargetPath + sOpenNI2Lib, ref bOneCopied, ref bAllCopied);
        KinectInterop.CopyFile(sNiTEPath + "/" + sNiTE22Lib, sTargetPath + sNiTE22Lib, ref bOneCopied, ref bAllCopied);

        if (!bArchX64)
        {
            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();

            dictFilesToUnzip[sUnityInterfaceLib] = sTargetPath + sUnityInterfaceLib;
            //dictFilesToUnzip["OpenNI2.dll"] = sTargetPath + "OpenNI2.dll";
            //dictFilesToUnzip["NiTE2.dll"] = sTargetPath + "NiTE2.dll";
            dictFilesToUnzip["OpenNI.ini"] = sTargetPath + "OpenNI.ini";
            dictFilesToUnzip["NiTE.ini"]   = sTargetPath + "NiTE.ini";

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            dictFilesToUnzip["msvcp100.dll"] = sTargetPath + "msvcp100.dll";
            dictFilesToUnzip["msvcr100.dll"] = sTargetPath + "msvcr100.dll";
#endif

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "OpenNI2UnityInterface.x86.zip", ref bOneCopied, ref bAllCopied);
        }
        else
        {
            Dictionary <string, string> dictFilesToUnzip = new Dictionary <string, string>();

            dictFilesToUnzip[sUnityInterfaceLib] = sTargetPath + sUnityInterfaceLib;
            //dictFilesToUnzip["OpenNI2.dll"] = sTargetPath + "OpenNI2.dll";
            //dictFilesToUnzip["NiTE2.dll"] = sTargetPath + "NiTE2.dll";
            dictFilesToUnzip["OpenNI.ini"] = sTargetPath + "OpenNI.ini";
            dictFilesToUnzip["NiTE.ini"]   = sTargetPath + "NiTE.ini";

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            dictFilesToUnzip["msvcp100.dll"] = sTargetPath + "msvcp100.dll";
            dictFilesToUnzip["msvcr100.dll"] = sTargetPath + "msvcr100.dll";
#endif

            KinectInterop.UnzipResourceFiles(dictFilesToUnzip, "OpenNI2UnityInterface.x64.zip", ref bOneCopied, ref bAllCopied);
        }

        if (File.Exists(sTargetPath + "OpenNI.ini"))
        {
            string sFileContent = File.ReadAllText(sTargetPath + "OpenNI.ini");
            sFileContent = sFileContent.Replace("%OPENNI_REDIST_DIR%", sOpenNIPath);
            File.WriteAllText(sTargetPath + "OpenNI.ini", sFileContent);
        }

        if (File.Exists(sTargetPath + "NiTE.ini"))
        {
            string sFileContent = File.ReadAllText(sTargetPath + "NiTE.ini");
            sFileContent = sFileContent.Replace("%NITE_REDIST_DIR%", sNiTEPath);
            File.WriteAllText(sTargetPath + "NiTE.ini", sFileContent);
        }

        bNeedRestart = (bOneCopied && bAllCopied);

        return(true);
    }