Пример #1
0
    static public string[] CreateStartParameters(SetupConfigs configs)
    {
        List <string> args = new List <string>
        {
            "unity"
        };

        if (configs.playbaskFile != "")
        {
            args.AddRange(new[] { "--playback", configs.playbaskFile });
            args.AddRange(new[] { "--playback-factor", configs.playbackFactor.ToString() });
        }

        if (configs.disambiguator != Disambiguator.Default)
        {
            args.AddRange(new[] { "--disambiguator", Enum.GetName(typeof(Disambiguator), configs.disambiguator) });
        }

        if (configs.calibrate != BoolConfig.Default)
        {
            args.Add(configs.calibrate == BoolConfig.Yes ? "--calibrate" : "--no-calibrate");
        }

        if (configs.configFile != "")
        {
            args.AddRange(new[] { "-c", configs.configFile });
        }

        //args.AddRange(new[] { "--disambiguator", Enum.GetName(typeof(Poser), disambiguator) });



        return(args.ToArray());
    }
Пример #2
0
    internal void CreateContext()
    {
        LogInfo("Start Init");

        SetupConfigs configs = new SetupConfigs
        {
            configFile = "survive_conf.json"
        };

        string[] args = CreateStartParameters(configs);

        //string[] vs = new[] { "--playback", "P:/c/libsurvive-data/lightcap-reformat/lightcap-reformat.log", "--disambiguator", "StateBased", "--calibrate" };

        context = Cfunctions.Survive_init_internal(args.Length, args);

        if (context == IntPtr.Zero)
        {
            throw new Exception("There was a problem initializing the lib!");
        }

        light_Process_Func   = LightEvent;
        raw_Pose_Func        = PoseEvent;
        lighthouse_Pose_Func = LightHouseEvent;
        angle_Process_Func   = AngleEvent;
        button_Process_Func  = ButtonEvent;
        htc_Config_Func      = HTCConfigEvent;
        imu_Process_Func     = IMUEvent;
        error_func           = ErrorEvent;
        info_func            = InfoEvent;

        Cfunctions.Survive_install_raw_pose_fn(context, raw_Pose_Func);
        Cfunctions.Survive_install_light_fn(context, light_Process_Func);
        Cfunctions.Survive_install_lighthouse_pose_fn(context, lighthouse_Pose_Func);
        Cfunctions.Survive_install_angle_fn(context, angle_Process_Func);
        Cfunctions.Survive_install_button_fn(context, button_Process_Func);
        Cfunctions.Survive_install_htc_config_fn(context, htc_Config_Func);
        Cfunctions.Survive_install_imu_fn(context, imu_Process_Func);
        Cfunctions.Survive_install_error_fn(context, error_func);
        Cfunctions.Survive_install_info_fn(context, info_func);

        LogInfo("Finished Init");

        LogInfo("Start Startup");

        int a = 0;

        try
        {
            a = Cfunctions.Survive_startup(context);
        }
        catch (Exception)
        {
            throw;
        }

        if (a != 0)
        {
            throw new Exception("Error in startup");
        }

        LogInfo("Finished Startup");
    }