Beispiel #1
0
    void Start()
    {
        //allocate unmanaged memory for tracker reports
        repsPtr = new IntPtr[MaxReports];
        TrackerReport report = new TrackerReport();

        report.sensor  = 0;
        report.pos     = new double[3];
        report.quat    = new double[4];
        report.quat[3] = 1.0f;
        for (int i = 0; i < MaxReports; i++)
        {
            repsPtr[i] = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(TrackerReport)));
            Marshal.StructureToPtr(report, repsPtr[i], true);
        }
        if (DeviceToUnity == null || SensorOffset == null)
        {
            if (DeviceToUnity == null)
            {
                Console.WriteLine("Warning: DeviceToUnity field not referencing a transform");
            }
            if (SensorOffset == null)
            {
                Console.WriteLine("Warning: SensorOffset field not referencing a transform");
            }
        }

        // Setup last report time memory
        LastReport = new VRPNManager.TimeVal();
    }
Beispiel #2
0
 //Auxiliar method that sends last frame report
 private void sendingReport(VRPNAnalog.AnalogReportNew lastReport)
 {
     VRPNAnalog.AnalogReport newReport  = new VRPNAnalog.AnalogReport();
     VRPNManager.TimeVal     newMsgTime = new VRPNManager.TimeVal();
     newMsgTime.tv_sec     = (UInt32)lastReport.msg_time.tv_sec;
     newMsgTime.tv_usec    = (UInt32)lastReport.msg_time.tv_usec;
     newReport.msg_time    = newMsgTime;
     newReport.num_channel = lastReport.num_channel;
     newReport.channel     = lastReport.channel;
     VRPNEventManager.TriggerEventAnalog(data.deviceType, data.deviceName, newReport);
 }
Beispiel #3
0
 //Auxiliar method that sends last frame report
 private void sendingReport(VRPNAnalog.AnalogReportNew lastReport)
 {
     VRPNAnalog.AnalogReport newReport = new VRPNAnalog.AnalogReport();
     VRPNManager.TimeVal newMsgTime = new VRPNManager.TimeVal();
     newMsgTime.tv_sec = (UInt32)lastReport.msg_time.tv_sec;
     newMsgTime.tv_usec = (UInt32)lastReport.msg_time.tv_usec;
     newReport.msg_time = newMsgTime;
     newReport.num_channel = lastReport.num_channel;
     newReport.channel = lastReport.channel;
     VRPNEventManager.TriggerEventAnalog(data.deviceType, data.deviceName, newReport);
 }
Beispiel #4
0
 //Auxiliar method that sends last frame report for each button
 private void sendingReports(Dictionary <int, VRPNButton.ButtonReportNew> lastReports)
 {
     foreach (KeyValuePair <int, VRPNButton.ButtonReportNew> pair in lastReports)
     {
         VRPNButton.ButtonReport newReport  = new VRPNButton.ButtonReport();
         VRPNManager.TimeVal     newMsgTime = new VRPNManager.TimeVal();
         newMsgTime.tv_sec  = (UInt32)pair.Value.msg_time.tv_sec;
         newMsgTime.tv_usec = (UInt32)pair.Value.msg_time.tv_usec;
         newReport.msg_time = newMsgTime;
         newReport.button   = pair.Value.button;
         newReport.state    = pair.Value.state;
         VRPNEventManager.TriggerEventButton(data.deviceType, data.deviceName, newReport);
     }
 }
Beispiel #5
0
 //Auxiliar method that sends last frame report for each button
 private void sendingReports(Dictionary<int, VRPNButton.ButtonReportNew> lastReports)
 {
     foreach (KeyValuePair<int, VRPNButton.ButtonReportNew> pair in lastReports)
     {
         VRPNButton.ButtonReport newReport = new VRPNButton.ButtonReport();
         VRPNManager.TimeVal newMsgTime = new VRPNManager.TimeVal();
         newMsgTime.tv_sec = (UInt32)pair.Value.msg_time.tv_sec;
         newMsgTime.tv_usec = (UInt32)pair.Value.msg_time.tv_usec;
         newReport.msg_time = newMsgTime;
         newReport.button = pair.Value.button;
         newReport.state = pair.Value.state;
         VRPNEventManager.TriggerEventButton(data.deviceType, data.deviceName, newReport);
     }
 }
Beispiel #6
0
 //Auxiliar method that sends last frame report for each sensor
 private void sendingReports(Dictionary<int, VRPNTracker.TrackerReportNew> lastReports)
 {
     foreach (KeyValuePair<int, VRPNTracker.TrackerReportNew> pair in lastReports)
     {
         VRPNTracker.TrackerReport newReport = new VRPNTracker.TrackerReport();
         VRPNManager.TimeVal newMsgTime = new VRPNManager.TimeVal();
         newMsgTime.tv_sec = (UInt32)pair.Value.msg_time.tv_sec;
         newMsgTime.tv_usec = (UInt32)pair.Value.msg_time.tv_usec;
         newReport.msg_time = newMsgTime;
         newReport.pos = pair.Value.pos;
         newReport.quat = pair.Value.quat;
         newReport.sensor = pair.Value.sensor;
         VRPNEventManager.TriggerEventTracker(data.deviceType, data.deviceName, newReport);
     }
 }
Beispiel #7
0
 //Auxiliar method that sends last frame report for each sensor
 private void sendingReports(Dictionary <int, VRPNTracker.TrackerReportNew> lastReports)
 {
     foreach (KeyValuePair <int, VRPNTracker.TrackerReportNew> pair in lastReports)
     {
         VRPNTracker.TrackerReport newReport  = new VRPNTracker.TrackerReport();
         VRPNManager.TimeVal       newMsgTime = new VRPNManager.TimeVal();
         newMsgTime.tv_sec  = (UInt32)pair.Value.msg_time.tv_sec;
         newMsgTime.tv_usec = (UInt32)pair.Value.msg_time.tv_usec;
         newReport.msg_time = newMsgTime;
         newReport.pos      = pair.Value.pos;
         newReport.quat     = pair.Value.quat;
         newReport.sensor   = pair.Value.sensor;
         VRPNEventManager.TriggerEventTracker(data.deviceType, data.deviceName, newReport);
     }
 }
Beispiel #8
0
    // Functions

    void Start()
    {
        //allocate unmanaged memory for button reports
        reportsPtr = new IntPtr[MaxReports];
        ButtonReport report = new ButtonReport();

        report.button = 0;
        report.state  = 0;
        for (int i = 0; i < MaxReports; i++)
        {
            reportsPtr[i] = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ButtonReport)));
            Marshal.StructureToPtr(report, reportsPtr[i], true);
        }

        // Setup last report time memory
        LastReport = new VRPNManager.TimeVal();
    }
Beispiel #9
0
    // Functions

    void Start()
    {
        //allocate unmanaged memory for analog reports
        reportsPtr = new IntPtr[MaxReports];
        AnalogReport report = new AnalogReport();

        report.num_channel = MAX_ANALOG_CHANNELS;
        report.channel     = new double[MAX_ANALOG_CHANNELS];
        for (int i = 0; i < MaxReports; i++)
        {
            reportsPtr[i] = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(AnalogReport)));
            Marshal.StructureToPtr(report, reportsPtr[i], true);
        }

        // Setup last report time memory
        LastReport = new VRPNManager.TimeVal();
    }
Beispiel #10
0
    void Start () {
    	//allocate unmanaged memory for tracker reports
		repsPtr = new IntPtr[MaxReports];
		TrackerReport report = new TrackerReport();
		report.sensor = 0;
     	report.pos = new double[3];
     	report.quat = new double[4];
		report.quat[3] = 1.0f;
		for(int i=0; i<MaxReports ; i++)
		{
			repsPtr[i] = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(TrackerReport)));
			Marshal.StructureToPtr(report, repsPtr[i], true);
		}
    	if (DeviceToUnity == null || SensorOffset == null)
    	{
    		if (DeviceToUnity == null)
    			Console.WriteLine("Warning: DeviceToUnity field not referencing a transform");
    		if (SensorOffset == null)
    			Console.WriteLine("Warning: SensorOffset field not referencing a transform");
    	}
        
        // Setup last report time memory 
		LastReport = new VRPNManager.TimeVal();  
    }
Beispiel #11
0
    // Functions
    void Start()
    {
        //allocate unmanaged memory for analog reports
        reportsPtr = new IntPtr[MaxReports];
        AnalogReport report = new AnalogReport();
        report.num_channel = MAX_ANALOG_CHANNELS;
        report.channel = new double[MAX_ANALOG_CHANNELS];
        for(int i=0; i<MaxReports ; i++)
        {
            reportsPtr[i] = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(AnalogReport)));
            Marshal.StructureToPtr(report, reportsPtr[i], true);
        }

        // Setup last report time memory
        LastReport = new VRPNManager.TimeVal();
    }
Beispiel #12
0
 private static extern void VRPNButtonReports(string name, [In, Out] IntPtr[] reportsPtr, [In, Out] ref int cnt, [In, MarshalAs(UnmanagedType.LPStruct)] VRPNManager.TimeVal ts, int btn_num, bool clearReport);