diff --git a/FormLocator.Designer.cs b/FormLocator.Designer.cs index 79e6ca7..e6ba2b3 100644 --- a/FormLocator.Designer.cs +++ b/FormLocator.Designer.cs @@ -65,7 +65,7 @@ private void InitializeComponent() this.groupBoxDestination.Size = new System.Drawing.Size(331, 64); this.groupBoxDestination.TabIndex = 0; this.groupBoxDestination.TabStop = false; - this.groupBoxDestination.Text = "Target"; + this.groupBoxDestination.Text = "Target location"; // // label3 // @@ -89,17 +89,17 @@ private void InitializeComponent() // this.textBoxAltitude.Location = new System.Drawing.Point(223, 32); this.textBoxAltitude.Name = "textBoxAltitude"; + this.textBoxAltitude.ReadOnly = true; this.textBoxAltitude.Size = new System.Drawing.Size(102, 20); this.textBoxAltitude.TabIndex = 3; - this.textBoxAltitude.TextChanged += new System.EventHandler(this.textBoxAltitude_TextChanged); // // textBoxLatitude // this.textBoxLatitude.Location = new System.Drawing.Point(115, 32); this.textBoxLatitude.Name = "textBoxLatitude"; + this.textBoxLatitude.ReadOnly = true; this.textBoxLatitude.Size = new System.Drawing.Size(100, 20); this.textBoxLatitude.TabIndex = 2; - this.textBoxLatitude.TextChanged += new System.EventHandler(this.textBoxLatitude_TextChanged); // // label1 // @@ -114,9 +114,9 @@ private void InitializeComponent() // this.textBoxLongitude.Location = new System.Drawing.Point(9, 32); this.textBoxLongitude.Name = "textBoxLongitude"; + this.textBoxLongitude.ReadOnly = true; this.textBoxLongitude.Size = new System.Drawing.Size(100, 20); this.textBoxLongitude.TabIndex = 0; - this.textBoxLongitude.TextChanged += new System.EventHandler(this.textBoxLongitude_TextChanged); // // groupBoxBearing // diff --git a/FormLocator.cs b/FormLocator.cs index 306e4af..e2a0a07 100644 --- a/FormLocator.cs +++ b/FormLocator.cs @@ -167,21 +167,6 @@ public void UpdateTracking(EDLocation CurrentLocation =null) UpdateVRLocatorImage(); } - private void textBoxLongitude_TextChanged(object sender, EventArgs e) - { - TrySetDestination(); - } - - private void textBoxLatitude_TextChanged(object sender, EventArgs e) - { - TrySetDestination(); - } - - private void textBoxAltitude_TextChanged(object sender, EventArgs e) - { - TrySetDestination(); - } - private void TrySetDestination() { // This shouldn't ever be called cross-thread, so no need to check for invoke @@ -425,18 +410,18 @@ private Bitmap LocatorBitmap() graphics.FillRectangle(new SolidBrush(Color.Black), graphics.ClipBounds); // Tracking target - Brush whiteBrush = new SolidBrush(Color.White); - Brush orangeBrush = new SolidBrush(Color.Orange); + Brush directionBrush = new SolidBrush(Color.White); + Brush targetBrush = new SolidBrush(Color.Orange); Font font = new Font("Arial", 12); - graphics.DrawString(_trackingTarget, font, orangeBrush, new PointF(0,0)); + graphics.DrawString(_trackingTarget, font, targetBrush, new PointF(0,0)); // Bearing - font = new Font("Arial", 24); + font = new Font("Arial", 14); //SizeF textSize = graphics.MeasureString(labelHeading.Text, font); - graphics.DrawString(labelHeading.Text, font, whiteBrush, new PointF(20, 30)); + graphics.DrawString(labelHeading.Text, font, directionBrush, new PointF(20, 30)); // Distance - graphics.DrawString(labelDistance.Text, font, whiteBrush, new PointF(80, 30)); + graphics.DrawString(labelDistance.Text, font, directionBrush, new PointF(80, 30)); graphics.Save(); } @@ -458,63 +443,19 @@ private void UpdateVRLocatorImage() private static void InitVRMatrix() { - /* - _vrMatrix = new HmdMatrix34_t(); - _vrMatrix.m0 = 1.0F; // row 0 col 0 - _vrMatrix.m1 = 0.0F; // row 0 col 1 - _vrMatrix.m2 = 0.0F; - _vrMatrix.m3 = 0.0F; - - _vrMatrix.m4 = 0.0F; - _vrMatrix.m5 = 1.0F; - _vrMatrix.m6 = 0.0F; - _vrMatrix.m7 = 1.0F; - - _vrMatrix.m8 = 0.0F; - _vrMatrix.m9 = 0.0F; - _vrMatrix.m10 = 1.0F; - _vrMatrix.m11 = 0.0F;*/ - _vrMatrix = new HmdMatrix34_t(); - _vrMatrix.m0 = 1.0F; // row 0 col 0 - _vrMatrix.m1 = 0.0F; // row 0 col 1 - _vrMatrix.m2 = 0.0F; - _vrMatrix.m3 = 0.12F; - - _vrMatrix.m4 = 0.0F; - _vrMatrix.m5 = 1.0F; - _vrMatrix.m6 = 0.0F; - _vrMatrix.m7 = 0.08F; - - _vrMatrix.m8 = 0.0F; - _vrMatrix.m9 = 0.0F; - _vrMatrix.m10 = 1.0F; - _vrMatrix.m11 = -0.3F; - - /* - transform.{ - 1.0f, 0.0f, 0.0f, 0.12f, - 0.0f, 1.0f, 0.0f, 0.08f, - 0.0f, 0.0f, 1.0f, -0.3f - }; - - * - _vrMatrix.m0 = 1.0F; + _vrMatrix.m0 = 1F; _vrMatrix.m1 = 0.0F; _vrMatrix.m2 = 0.0F; - - _vrMatrix.m3 = 0.0F; - _vrMatrix.m4 = 0.0F; - _vrMatrix.m5 = 1.0F; - - _vrMatrix.m6 = 0.0F; - _vrMatrix.m7 = 1.0F; - _vrMatrix.m8 = 0.0F; - - _vrMatrix.m9 = 0.0F; + _vrMatrix.m3 = 0.32F; + _vrMatrix.m4 = 0F; + _vrMatrix.m5 = -0.2F; + _vrMatrix.m6 = 0F; + _vrMatrix.m7 = 0.78F; + _vrMatrix.m8 = 0F; + _vrMatrix.m9 = 0.5F; _vrMatrix.m10 = 1.0F; - _vrMatrix.m11 = -2.0F; - * */ + _vrMatrix.m11 = -0.2F; } private bool ShowVRLocator() @@ -542,7 +483,10 @@ private bool ShowVRLocator() var error = OpenVR.Overlay.ShowOverlay(_vrOverlayHandle); OpenVR.Overlay.SetOverlayTransformAbsolute(_vrOverlayHandle, Valve.VR.ETrackingUniverseOrigin.TrackingUniverseStanding, ref _vrMatrix); - + /* + FormVRMatrixTest formVRMatrixTest = new FormVRMatrixTest(_vrOverlayHandle); + formVRMatrixTest.SetMatrix(ref _vrMatrix); + formVRMatrixTest.Show();*/ return true; } diff --git a/FormRoutePlanner.cs b/FormRoutePlanner.cs index 2e4c968..f80b294 100644 --- a/FormRoutePlanner.cs +++ b/FormRoutePlanner.cs @@ -150,7 +150,11 @@ private void buttonSetAsTarget_Click(object sender, EventArgs e) // Set the selected waypoint as the current target if ( _locatorForm == null || listBoxWaypoints.SelectedItem == null) return; - _locatorForm.SetTarget(((EDWaypoint)listBoxWaypoints.SelectedItem).Location); + try + { + _locatorForm.SetTarget(_route.Waypoints[listBoxWaypoints.SelectedIndex].Location); + } + catch { } } private void UpdateButtons() diff --git a/FormStatusMessages.Designer.cs b/FormStatusMessages.Designer.cs index 61ff2db..450b84a 100644 --- a/FormStatusMessages.Designer.cs +++ b/FormStatusMessages.Designer.cs @@ -29,11 +29,11 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.buttonOk = new System.Windows.Forms.Button(); - this.buttonCancel = new System.Windows.Forms.Button(); this.dataGridViewStatusMessages = new System.Windows.Forms.DataGridView(); this.EventName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.EventStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.buttonOk = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewStatusMessages)).BeginInit(); this.SuspendLayout(); @@ -48,26 +48,6 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Status messages"; // - // buttonOk - // - this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOk.Location = new System.Drawing.Point(348, 247); - this.buttonOk.Name = "buttonOk"; - this.buttonOk.Size = new System.Drawing.Size(75, 23); - this.buttonOk.TabIndex = 1; - this.buttonOk.Text = "Ok"; - this.buttonOk.UseVisualStyleBackColor = true; - // - // buttonCancel - // - this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(267, 247); - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(75, 23); - this.buttonCancel.TabIndex = 2; - this.buttonCancel.Text = "Cancel"; - this.buttonCancel.UseVisualStyleBackColor = true; - // // dataGridViewStatusMessages // this.dataGridViewStatusMessages.AllowUserToAddRows = false; @@ -77,6 +57,7 @@ private void InitializeComponent() this.EventName, this.EventStatus}); this.dataGridViewStatusMessages.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridViewStatusMessages.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; this.dataGridViewStatusMessages.Location = new System.Drawing.Point(3, 16); this.dataGridViewStatusMessages.Name = "dataGridViewStatusMessages"; this.dataGridViewStatusMessages.RowHeadersVisible = false; @@ -96,6 +77,26 @@ private void InitializeComponent() this.EventStatus.Name = "EventStatus"; this.EventStatus.Width = 250; // + // buttonOk + // + this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOk.Location = new System.Drawing.Point(348, 247); + this.buttonOk.Name = "buttonOk"; + this.buttonOk.Size = new System.Drawing.Size(75, 23); + this.buttonOk.TabIndex = 1; + this.buttonOk.Text = "Ok"; + this.buttonOk.UseVisualStyleBackColor = true; + // + // buttonCancel + // + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Location = new System.Drawing.Point(267, 247); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 2; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // // FormStatusMessages // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/FormStatusMessages.resx b/FormStatusMessages.resx index e24ce0a..f567451 100644 --- a/FormStatusMessages.resx +++ b/FormStatusMessages.resx @@ -123,10 +123,4 @@ True - - True - - - True - \ No newline at end of file diff --git a/FormTracker.Designer.cs b/FormTracker.Designer.cs index 3be992d..a15504d 100644 --- a/FormTracker.Designer.cs +++ b/FormTracker.Designer.cs @@ -293,8 +293,6 @@ private void InitializeComponent() // checkBoxUpload // this.checkBoxUpload.AutoSize = true; - this.checkBoxUpload.Checked = true; - this.checkBoxUpload.CheckState = System.Windows.Forms.CheckState.Checked; this.checkBoxUpload.Location = new System.Drawing.Point(6, 19); this.checkBoxUpload.Name = "checkBoxUpload"; this.checkBoxUpload.Size = new System.Drawing.Size(98, 17); diff --git a/FormVRMatrixTest.Designer.cs b/FormVRMatrixTest.Designer.cs new file mode 100644 index 0000000..35429f6 --- /dev/null +++ b/FormVRMatrixTest.Designer.cs @@ -0,0 +1,439 @@ +namespace SRVTracker +{ + partial class FormVRMatrixTest + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.numericUpDownm0 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm1 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm2 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm3 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm4 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm5 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm6 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm7 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm8 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm9 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm10 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownm11 = new System.Windows.Forms.NumericUpDown(); + this.buttonApply = new System.Windows.Forms.Button(); + this.buttonClose = new System.Windows.Forms.Button(); + this.buttonExport = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm0)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm8)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm9)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm10)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm11)).BeginInit(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.numericUpDownm11); + this.groupBox1.Controls.Add(this.numericUpDownm10); + this.groupBox1.Controls.Add(this.numericUpDownm9); + this.groupBox1.Controls.Add(this.numericUpDownm8); + this.groupBox1.Controls.Add(this.numericUpDownm7); + this.groupBox1.Controls.Add(this.numericUpDownm6); + this.groupBox1.Controls.Add(this.numericUpDownm5); + this.groupBox1.Controls.Add(this.numericUpDownm4); + this.groupBox1.Controls.Add(this.numericUpDownm3); + this.groupBox1.Controls.Add(this.numericUpDownm2); + this.groupBox1.Controls.Add(this.numericUpDownm1); + this.groupBox1.Controls.Add(this.numericUpDownm0); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(266, 104); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Transform matrix"; + // + // numericUpDownm0 + // + this.numericUpDownm0.DecimalPlaces = 2; + this.numericUpDownm0.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm0.Location = new System.Drawing.Point(6, 19); + this.numericUpDownm0.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm0.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm0.Name = "numericUpDownm0"; + this.numericUpDownm0.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm0.TabIndex = 0; + // + // numericUpDownm1 + // + this.numericUpDownm1.DecimalPlaces = 2; + this.numericUpDownm1.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm1.Location = new System.Drawing.Point(69, 19); + this.numericUpDownm1.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm1.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm1.Name = "numericUpDownm1"; + this.numericUpDownm1.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm1.TabIndex = 1; + // + // numericUpDownm2 + // + this.numericUpDownm2.DecimalPlaces = 2; + this.numericUpDownm2.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm2.Location = new System.Drawing.Point(132, 19); + this.numericUpDownm2.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm2.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm2.Name = "numericUpDownm2"; + this.numericUpDownm2.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm2.TabIndex = 2; + // + // numericUpDownm3 + // + this.numericUpDownm3.DecimalPlaces = 2; + this.numericUpDownm3.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm3.Location = new System.Drawing.Point(195, 19); + this.numericUpDownm3.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm3.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm3.Name = "numericUpDownm3"; + this.numericUpDownm3.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm3.TabIndex = 3; + // + // numericUpDownm4 + // + this.numericUpDownm4.DecimalPlaces = 2; + this.numericUpDownm4.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm4.Location = new System.Drawing.Point(6, 45); + this.numericUpDownm4.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm4.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm4.Name = "numericUpDownm4"; + this.numericUpDownm4.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm4.TabIndex = 4; + // + // numericUpDownm5 + // + this.numericUpDownm5.DecimalPlaces = 2; + this.numericUpDownm5.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm5.Location = new System.Drawing.Point(69, 45); + this.numericUpDownm5.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm5.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm5.Name = "numericUpDownm5"; + this.numericUpDownm5.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm5.TabIndex = 5; + // + // numericUpDownm6 + // + this.numericUpDownm6.DecimalPlaces = 2; + this.numericUpDownm6.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm6.Location = new System.Drawing.Point(132, 45); + this.numericUpDownm6.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm6.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm6.Name = "numericUpDownm6"; + this.numericUpDownm6.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm6.TabIndex = 6; + // + // numericUpDownm7 + // + this.numericUpDownm7.DecimalPlaces = 2; + this.numericUpDownm7.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm7.Location = new System.Drawing.Point(195, 45); + this.numericUpDownm7.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm7.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm7.Name = "numericUpDownm7"; + this.numericUpDownm7.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm7.TabIndex = 7; + // + // numericUpDownm8 + // + this.numericUpDownm8.DecimalPlaces = 2; + this.numericUpDownm8.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm8.Location = new System.Drawing.Point(6, 71); + this.numericUpDownm8.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm8.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm8.Name = "numericUpDownm8"; + this.numericUpDownm8.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm8.TabIndex = 8; + // + // numericUpDownm9 + // + this.numericUpDownm9.DecimalPlaces = 2; + this.numericUpDownm9.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm9.Location = new System.Drawing.Point(69, 71); + this.numericUpDownm9.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm9.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm9.Name = "numericUpDownm9"; + this.numericUpDownm9.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm9.TabIndex = 9; + // + // numericUpDownm10 + // + this.numericUpDownm10.DecimalPlaces = 2; + this.numericUpDownm10.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm10.Location = new System.Drawing.Point(132, 71); + this.numericUpDownm10.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm10.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm10.Name = "numericUpDownm10"; + this.numericUpDownm10.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm10.TabIndex = 10; + // + // numericUpDownm11 + // + this.numericUpDownm11.DecimalPlaces = 2; + this.numericUpDownm11.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownm11.Location = new System.Drawing.Point(195, 71); + this.numericUpDownm11.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.numericUpDownm11.Minimum = new decimal(new int[] { + 2, + 0, + 0, + -2147483648}); + this.numericUpDownm11.Name = "numericUpDownm11"; + this.numericUpDownm11.Size = new System.Drawing.Size(57, 20); + this.numericUpDownm11.TabIndex = 11; + // + // buttonApply + // + this.buttonApply.Location = new System.Drawing.Point(203, 122); + this.buttonApply.Name = "buttonApply"; + this.buttonApply.Size = new System.Drawing.Size(75, 23); + this.buttonApply.TabIndex = 1; + this.buttonApply.Text = "Apply"; + this.buttonApply.UseVisualStyleBackColor = true; + this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click); + // + // buttonClose + // + this.buttonClose.Location = new System.Drawing.Point(12, 122); + this.buttonClose.Name = "buttonClose"; + this.buttonClose.Size = new System.Drawing.Size(75, 23); + this.buttonClose.TabIndex = 2; + this.buttonClose.Text = "Close"; + this.buttonClose.UseVisualStyleBackColor = true; + this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click); + // + // buttonExport + // + this.buttonExport.Location = new System.Drawing.Point(108, 122); + this.buttonExport.Name = "buttonExport"; + this.buttonExport.Size = new System.Drawing.Size(75, 23); + this.buttonExport.TabIndex = 3; + this.buttonExport.Text = "Export"; + this.buttonExport.UseVisualStyleBackColor = true; + this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click); + // + // FormVRMatrixTest + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(293, 156); + this.ControlBox = false; + this.Controls.Add(this.buttonExport); + this.Controls.Add(this.buttonClose); + this.Controls.Add(this.buttonApply); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "FormVRMatrixTest"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Matrix Editor"; + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm0)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm8)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm9)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm10)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownm11)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.NumericUpDown numericUpDownm11; + private System.Windows.Forms.NumericUpDown numericUpDownm10; + private System.Windows.Forms.NumericUpDown numericUpDownm9; + private System.Windows.Forms.NumericUpDown numericUpDownm8; + private System.Windows.Forms.NumericUpDown numericUpDownm7; + private System.Windows.Forms.NumericUpDown numericUpDownm6; + private System.Windows.Forms.NumericUpDown numericUpDownm5; + private System.Windows.Forms.NumericUpDown numericUpDownm4; + private System.Windows.Forms.NumericUpDown numericUpDownm3; + private System.Windows.Forms.NumericUpDown numericUpDownm2; + private System.Windows.Forms.NumericUpDown numericUpDownm1; + private System.Windows.Forms.NumericUpDown numericUpDownm0; + private System.Windows.Forms.Button buttonApply; + private System.Windows.Forms.Button buttonClose; + private System.Windows.Forms.Button buttonExport; + } +} \ No newline at end of file diff --git a/FormVRMatrixTest.cs b/FormVRMatrixTest.cs new file mode 100644 index 0000000..c8d2251 --- /dev/null +++ b/FormVRMatrixTest.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Valve.VR; + +namespace SRVTracker +{ + public partial class FormVRMatrixTest : Form + { + private ulong _overlayHandle = 0; + private HmdMatrix34_t _hmdMatrix; + + public FormVRMatrixTest(ulong overlayHandle) + { + InitializeComponent(); + _overlayHandle = overlayHandle; + _hmdMatrix = new HmdMatrix34_t(); + } + + private void buttonClose_Click(object sender, EventArgs e) + { + this.Close(); + } + + public void SetMatrix(ref HmdMatrix34_t hmdMatrix) + { + numericUpDownm0.Value = (decimal)hmdMatrix.m0; + numericUpDownm1.Value = (decimal)hmdMatrix.m1; + numericUpDownm2.Value = (decimal)hmdMatrix.m2; + numericUpDownm3.Value = (decimal)hmdMatrix.m3; + numericUpDownm4.Value = (decimal)hmdMatrix.m4; + numericUpDownm5.Value = (decimal)hmdMatrix.m5; + numericUpDownm6.Value = (decimal)hmdMatrix.m6; + numericUpDownm7.Value = (decimal)hmdMatrix.m7; + numericUpDownm8.Value = (decimal)hmdMatrix.m8; + numericUpDownm9.Value = (decimal)hmdMatrix.m9; + numericUpDownm10.Value = (decimal)hmdMatrix.m10; + numericUpDownm11.Value = (decimal)hmdMatrix.m11; + _hmdMatrix = hmdMatrix; + } + + public HmdMatrix34_t GetMatrix() + { + + _hmdMatrix.m0 = (float)numericUpDownm0.Value; + _hmdMatrix.m1 = (float)numericUpDownm1.Value; + _hmdMatrix.m2 = (float)numericUpDownm2.Value; + _hmdMatrix.m3 = (float)numericUpDownm3.Value; + _hmdMatrix.m4 = (float)numericUpDownm4.Value; + _hmdMatrix.m5 = (float)numericUpDownm5.Value; + _hmdMatrix.m6 = (float)numericUpDownm6.Value; + _hmdMatrix.m7 = (float)numericUpDownm7.Value; + _hmdMatrix.m8 = (float)numericUpDownm8.Value; + _hmdMatrix.m9 = (float)numericUpDownm9.Value; + _hmdMatrix.m10 = (float)numericUpDownm10.Value; + _hmdMatrix.m11 = (float)numericUpDownm11.Value; + return _hmdMatrix; + } + + private void buttonApply_Click(object sender, EventArgs e) + { + if (_overlayHandle > 0) + { + GetMatrix(); + OpenVR.Overlay.SetOverlayTransformAbsolute(_overlayHandle, Valve.VR.ETrackingUniverseOrigin.TrackingUniverseStanding, ref _hmdMatrix); + } + } + + private void buttonExport_Click(object sender, EventArgs e) + { + StringBuilder matrixCode = new StringBuilder(); + + matrixCode.AppendLine("_vrMatrix = new HmdMatrix34_t();"); + matrixCode.AppendLine($"_vrMatrix.m0 = {numericUpDownm0.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m1 = {numericUpDownm1.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m2 = {numericUpDownm2.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m3 = {numericUpDownm3.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m4 = {numericUpDownm4.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m5 = {numericUpDownm5.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m6 = {numericUpDownm6.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m7 = {numericUpDownm7.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m8 = {numericUpDownm8.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m9 = {numericUpDownm9.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m10 = {numericUpDownm10.Value}F;"); + matrixCode.AppendLine($"_vrMatrix.m11 = {numericUpDownm11.Value}F;"); + matrixCode.AppendLine(); + + File.AppendAllText("matrices.txt", matrixCode.ToString()); + } + } +} diff --git a/FormVRMatrixTest.resx b/FormVRMatrixTest.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/FormVRMatrixTest.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LocationManager.cs b/LocationManager.cs index 2579122..0d854c3 100644 --- a/LocationManager.cs +++ b/LocationManager.cs @@ -24,14 +24,6 @@ public LocationManager() LoadLocationsFromFile(_saveFilename); } - public LocationManager(string restoreFromFile = "") - { - InitializeComponent(); - if (!String.IsNullOrEmpty(restoreFromFile)) - _saveFilename = restoreFromFile; - LoadLocationsFromFile(_saveFilename); - } - protected virtual void OnSelectionChanged(EventArgs e) { SelectionChanged?.Invoke(this, e); diff --git a/SRVTracker.csproj b/SRVTracker.csproj index d88166f..ec3f735 100644 --- a/SRVTracker.csproj +++ b/SRVTracker.csproj @@ -104,6 +104,12 @@ FormTracker.cs + + Form + + + FormVRMatrixTest.cs + UserControl @@ -136,6 +142,9 @@ FormTracker.cs + + FormVRMatrixTest.cs + LocationManager.cs