Skip to content

Commit b5db7b5

Browse files
committed
Updated VRDisplayTracked prefab to use HDK descriptor by default.
Added fields for vendor, model, version, note, and a ToString() override to DeviceDescriptor.cs Replaced SimpleJSON with Newtonsoft Json.NET, parsing changes in DisplayInterface.cs Refactored VREye.cs and VRHead.cs for easy Unity5 upgrade.
1 parent 892e7d4 commit b5db7b5

11 files changed

Lines changed: 282 additions & 1250 deletions

File tree

OSVR-Unity/Assets/OSVRUnity/Prefabs/VRDisplayTracked.prefab

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ MonoBehaviour:
140140
m_Script: {fileID: 11500000, guid: a288e4aec9950634b83d232abc73d1bb, type: 3}
141141
m_Name:
142142
m_EditorClassIdentifier:
143-
path: /display
144-
jsonDescriptorFile: {fileID: 4900000, guid: 6c4ce626027a5de4692d184d6a1b6db3, type: 3}
143+
JsonDescriptorFile: {fileID: 4900000, guid: 903a53a7997a82c42b329c472b623a4e, type: 3}
145144
--- !u!114 &11431730
146145
MonoBehaviour:
147146
m_ObjectHideFlags: 1

OSVR-Unity/Assets/OSVRUnity/Sample/Demo/Scenes/OSVRDemo.unity

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,8 +2562,7 @@ MonoBehaviour:
25622562
m_Script: {fileID: 11500000, guid: a288e4aec9950634b83d232abc73d1bb, type: 3}
25632563
m_Name:
25642564
m_EditorClassIdentifier:
2565-
path: /display
2566-
jsonDescriptorFile: {fileID: 4900000, guid: 6c4ce626027a5de4692d184d6a1b6db3, type: 3}
2565+
JsonDescriptorFile: {fileID: 4900000, guid: 903a53a7997a82c42b329c472b623a4e, type: 3}
25672566
--- !u!1 &1850521407
25682567
GameObject:
25692568
m_ObjectHideFlags: 0

OSVR-Unity/Assets/OSVRUnity/Sample/VRDisplayDemo.unity

Lines changed: 71 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,18 +1198,63 @@ Transform:
11981198
m_Children: []
11991199
m_Father: {fileID: 0}
12001200
m_RootOrder: 1
1201+
--- !u!1001 &715470731
1202+
Prefab:
1203+
m_ObjectHideFlags: 0
1204+
serializedVersion: 2
1205+
m_Modification:
1206+
m_TransformParent: {fileID: 0}
1207+
m_Modifications:
1208+
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1209+
propertyPath: m_LocalPosition.x
1210+
value: 0
1211+
objectReference: {fileID: 0}
1212+
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1213+
propertyPath: m_LocalPosition.y
1214+
value: 0
1215+
objectReference: {fileID: 0}
1216+
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1217+
propertyPath: m_LocalPosition.z
1218+
value: 0
1219+
objectReference: {fileID: 0}
1220+
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1221+
propertyPath: m_LocalRotation.x
1222+
value: 0
1223+
objectReference: {fileID: 0}
1224+
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1225+
propertyPath: m_LocalRotation.y
1226+
value: 0
1227+
objectReference: {fileID: 0}
1228+
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1229+
propertyPath: m_LocalRotation.z
1230+
value: 0
1231+
objectReference: {fileID: 0}
1232+
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1233+
propertyPath: m_LocalRotation.w
1234+
value: 1
1235+
objectReference: {fileID: 0}
1236+
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1237+
propertyPath: m_RootOrder
1238+
value: 0
1239+
objectReference: {fileID: 0}
1240+
m_RemovedComponents: []
1241+
m_ParentPrefab: {fileID: 100100000, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1242+
m_RootGameObject: {fileID: 955452065}
1243+
m_IsPrefabParent: 0
1244+
m_IsExploded: 1
12011245
--- !u!1 &955452065
12021246
GameObject:
12031247
m_ObjectHideFlags: 0
12041248
m_PrefabParentObject: {fileID: 131736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1205-
m_PrefabInternal: {fileID: 1603019521}
1249+
m_PrefabInternal: {fileID: 715470731}
12061250
serializedVersion: 4
12071251
m_Component:
12081252
- 4: {fileID: 955452066}
12091253
- 20: {fileID: 955452068}
12101254
- 81: {fileID: 955452069}
12111255
- 114: {fileID: 955452067}
12121256
- 114: {fileID: 955452070}
1257+
- 114: {fileID: 955452071}
12131258
m_Layer: 0
12141259
m_Name: VRDisplayTracked
12151260
m_TagString: Untagged
@@ -1221,7 +1266,7 @@ GameObject:
12211266
Transform:
12221267
m_ObjectHideFlags: 0
12231268
m_PrefabParentObject: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1224-
m_PrefabInternal: {fileID: 1603019521}
1269+
m_PrefabInternal: {fileID: 715470731}
12251270
m_GameObject: {fileID: 955452065}
12261271
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
12271272
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1236,7 +1281,7 @@ MonoBehaviour:
12361281
m_ObjectHideFlags: 0
12371282
m_PrefabParentObject: {fileID: 11431734, guid: bcbb49b5078d05d498ef83a6373ba939,
12381283
type: 2}
1239-
m_PrefabInternal: {fileID: 1603019521}
1284+
m_PrefabInternal: {fileID: 715470731}
12401285
m_GameObject: {fileID: 955452065}
12411286
m_Enabled: 1
12421287
m_EditorHideFlags: 0
@@ -1251,7 +1296,7 @@ Camera:
12511296
m_ObjectHideFlags: 0
12521297
m_PrefabParentObject: {fileID: 2031736, guid: bcbb49b5078d05d498ef83a6373ba939,
12531298
type: 2}
1254-
m_PrefabInternal: {fileID: 1603019521}
1299+
m_PrefabInternal: {fileID: 715470731}
12551300
m_GameObject: {fileID: 955452065}
12561301
m_Enabled: 1
12571302
serializedVersion: 2
@@ -1284,27 +1329,40 @@ AudioListener:
12841329
m_ObjectHideFlags: 0
12851330
m_PrefabParentObject: {fileID: 8131736, guid: bcbb49b5078d05d498ef83a6373ba939,
12861331
type: 2}
1287-
m_PrefabInternal: {fileID: 1603019521}
1332+
m_PrefabInternal: {fileID: 715470731}
12881333
m_GameObject: {fileID: 955452065}
12891334
m_Enabled: 1
12901335
--- !u!114 &955452070
12911336
MonoBehaviour:
12921337
m_ObjectHideFlags: 0
12931338
m_PrefabParentObject: {fileID: 11431736, guid: bcbb49b5078d05d498ef83a6373ba939,
12941339
type: 2}
1295-
m_PrefabInternal: {fileID: 1603019521}
1340+
m_PrefabInternal: {fileID: 715470731}
12961341
m_GameObject: {fileID: 955452065}
12971342
m_Enabled: 1
12981343
m_EditorHideFlags: 0
1299-
m_Script: {fileID: 11500000, guid: ee225769fa78e894c970514b2f2e1f90, type: 3}
1344+
m_Script: {fileID: 11500000, guid: d819a5e6a69cc5c46be733d8a56d387e, type: 3}
13001345
m_Name:
13011346
m_EditorClassIdentifier:
13021347
path: /me/head
1348+
--- !u!114 &955452071
1349+
MonoBehaviour:
1350+
m_ObjectHideFlags: 0
1351+
m_PrefabParentObject: {fileID: 11400556, guid: bcbb49b5078d05d498ef83a6373ba939,
1352+
type: 2}
1353+
m_PrefabInternal: {fileID: 715470731}
1354+
m_GameObject: {fileID: 955452065}
1355+
m_Enabled: 1
1356+
m_EditorHideFlags: 0
1357+
m_Script: {fileID: 11500000, guid: a288e4aec9950634b83d232abc73d1bb, type: 3}
1358+
m_Name:
1359+
m_EditorClassIdentifier:
1360+
JsonDescriptorFile: {fileID: 4900000, guid: 903a53a7997a82c42b329c472b623a4e, type: 3}
13031361
--- !u!1 &1468488789
13041362
GameObject:
13051363
m_ObjectHideFlags: 0
13061364
m_PrefabParentObject: {fileID: 131734, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1307-
m_PrefabInternal: {fileID: 1603019521}
1365+
m_PrefabInternal: {fileID: 715470731}
13081366
serializedVersion: 4
13091367
m_Component:
13101368
- 4: {fileID: 1468488791}
@@ -1321,7 +1379,7 @@ MonoBehaviour:
13211379
m_ObjectHideFlags: 0
13221380
m_PrefabParentObject: {fileID: 11431732, guid: bcbb49b5078d05d498ef83a6373ba939,
13231381
type: 2}
1324-
m_PrefabInternal: {fileID: 1603019521}
1382+
m_PrefabInternal: {fileID: 715470731}
13251383
m_GameObject: {fileID: 1468488789}
13261384
m_Enabled: 1
13271385
m_EditorHideFlags: 0
@@ -1334,62 +1392,14 @@ MonoBehaviour:
13341392
Transform:
13351393
m_ObjectHideFlags: 0
13361394
m_PrefabParentObject: {fileID: 431734, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1337-
m_PrefabInternal: {fileID: 1603019521}
1395+
m_PrefabInternal: {fileID: 715470731}
13381396
m_GameObject: {fileID: 1468488789}
13391397
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
13401398
m_LocalPosition: {x: 0, y: 0, z: 0}
13411399
m_LocalScale: {x: 1, y: 1, z: 1}
13421400
m_Children: []
13431401
m_Father: {fileID: 955452066}
13441402
m_RootOrder: 0
1345-
--- !u!1001 &1603019521
1346-
Prefab:
1347-
m_ObjectHideFlags: 0
1348-
serializedVersion: 2
1349-
m_Modification:
1350-
m_TransformParent: {fileID: 0}
1351-
m_Modifications:
1352-
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1353-
propertyPath: m_LocalPosition.x
1354-
value: 0
1355-
objectReference: {fileID: 0}
1356-
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1357-
propertyPath: m_LocalPosition.y
1358-
value: 0
1359-
objectReference: {fileID: 0}
1360-
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1361-
propertyPath: m_LocalPosition.z
1362-
value: 0
1363-
objectReference: {fileID: 0}
1364-
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1365-
propertyPath: m_LocalRotation.x
1366-
value: 0
1367-
objectReference: {fileID: 0}
1368-
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1369-
propertyPath: m_LocalRotation.y
1370-
value: 0
1371-
objectReference: {fileID: 0}
1372-
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1373-
propertyPath: m_LocalRotation.z
1374-
value: 0
1375-
objectReference: {fileID: 0}
1376-
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1377-
propertyPath: m_LocalRotation.w
1378-
value: 1
1379-
objectReference: {fileID: 0}
1380-
- target: {fileID: 431736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1381-
propertyPath: m_RootOrder
1382-
value: 0
1383-
objectReference: {fileID: 0}
1384-
- target: {fileID: 131736, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1385-
propertyPath: m_Name
1386-
value: VRDisplayTracked
1387-
objectReference: {fileID: 0}
1388-
m_RemovedComponents: []
1389-
m_ParentPrefab: {fileID: 100100000, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1390-
m_RootGameObject: {fileID: 955452065}
1391-
m_IsPrefabParent: 0
1392-
m_IsExploded: 1
13931403
--- !u!1001 &1925542040
13941404
Prefab:
13951405
m_ObjectHideFlags: 0
@@ -1442,7 +1452,7 @@ Prefab:
14421452
GameObject:
14431453
m_ObjectHideFlags: 0
14441454
m_PrefabParentObject: {fileID: 131732, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1445-
m_PrefabInternal: {fileID: 1603019521}
1455+
m_PrefabInternal: {fileID: 715470731}
14461456
serializedVersion: 4
14471457
m_Component:
14481458
- 4: {fileID: 2061423056}
@@ -1458,7 +1468,7 @@ GameObject:
14581468
Transform:
14591469
m_ObjectHideFlags: 0
14601470
m_PrefabParentObject: {fileID: 431732, guid: bcbb49b5078d05d498ef83a6373ba939, type: 2}
1461-
m_PrefabInternal: {fileID: 1603019521}
1471+
m_PrefabInternal: {fileID: 715470731}
14621472
m_GameObject: {fileID: 2061423055}
14631473
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
14641474
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1471,7 +1481,7 @@ MonoBehaviour:
14711481
m_ObjectHideFlags: 0
14721482
m_PrefabParentObject: {fileID: 11431730, guid: bcbb49b5078d05d498ef83a6373ba939,
14731483
type: 2}
1474-
m_PrefabInternal: {fileID: 1603019521}
1484+
m_PrefabInternal: {fileID: 715470731}
14751485
m_GameObject: {fileID: 2061423055}
14761486
m_Enabled: 1
14771487
m_EditorHideFlags: 0

OSVR-Unity/Assets/OSVRUnity/src/DeviceDescriptor.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,31 @@
2424
//a class for storing information about a device based on it's json descriptor file
2525
public class DeviceDescriptor {
2626

27+
//hmd
28+
private string _vendor = "";
29+
public string Vendor
30+
{
31+
get { return _vendor; }
32+
set { _vendor = value; }
33+
}
34+
private string _model = "";
35+
public string Model
36+
{
37+
get { return _model; }
38+
set { _model = value; }
39+
}
40+
private string _version;
41+
public string Version
42+
{
43+
get { return _version; }
44+
set { _version = value; }
45+
}
46+
private string _note = "";
47+
public string Note
48+
{
49+
get { return _note; }
50+
set { _note = value; }
51+
}
2752
//field of view
2853
private float _monocularHorizontal = 60f;
2954
public float MonocularHorizontal
@@ -149,4 +174,35 @@ public DeviceDescriptor(float monocularHorizontal, float monocularVertical, floa
149174
this._centerProjY = centerProjY;
150175
this._rotate180 = rotate180;
151176
}
177+
178+
public override string ToString()
179+
{
180+
string deviceDescription = "Device Description:\n" + "HMD:\n";
181+
deviceDescription += "Vendor = " + Vendor + "\n";
182+
deviceDescription += "Model = " + Model + "\n";
183+
deviceDescription += "Version = " + Version + "\n";
184+
deviceDescription += "Note = " + Note + "\n";
185+
deviceDescription += "\nFIELD OF VIEW:\n";
186+
deviceDescription += "monocular_horizontal = " + MonocularHorizontal + "\n";
187+
deviceDescription += "monocular_vertical = " + MonocularVertical + "\n";
188+
deviceDescription += "overlap_percent = " + OverlapPercent + "\n";
189+
deviceDescription += "pitch_tilt = " + PitchTilt + "\n";
190+
deviceDescription += "\nRESOLUTION\n";
191+
deviceDescription += "width = " + Width + "\n";
192+
deviceDescription += "height = " + Height + "\n";
193+
deviceDescription += "video_inputs = " + VideoInputs + "\n";
194+
deviceDescription += "display_mode = " + DisplayMode + "\n";
195+
deviceDescription += "\nDISTORTION\n";
196+
deviceDescription += "k1_red = " + K1Red + "\n";
197+
deviceDescription += "k1_green = " + K1Green + "\n";
198+
deviceDescription += "k1_blue = " + K1Blue + "\n";
199+
deviceDescription += "\nRENDERING\n";
200+
deviceDescription += "left_roll = " + LeftRoll + "\n";
201+
deviceDescription += "right_roll = " + RightRoll + "\n";
202+
deviceDescription += "\nEYES\n";
203+
deviceDescription += "center_proj_x = " + CenterProjX + "\n";
204+
deviceDescription += "center_proj_y = " + CenterProjY + "\n";
205+
deviceDescription += "rotate_180 = " + Rotate180 + "\n";
206+
return deviceDescription;
207+
}
152208
}

0 commit comments

Comments
 (0)