-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
60 lines (52 loc) · 2.11 KB
/
Program.cs
File metadata and controls
60 lines (52 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using AR_Inventory.DevTools;
using AR_Inventory.Steppers;
using StereoKit;
using StereoKit.Framework;
namespace AR_Inventory;
public static class Program
{
static void Main(string[] args)
{
App.PreSKInit();
// Initialize StereoKit
SKSettings settings = new SKSettings
{
appName = "AR Inventory",
assetsFolder = "Assets",
};
if (!SK.Initialize(settings))
return;
App.PostSKInit();
// Floor for VR mode
Matrix floorTransform = Matrix.TS(0, -1.5f, 0, new Vec3(30, 0.1f, 30));
Material floorMaterial = new Material("floor.hlsl");
floorMaterial.Transparency = Transparency.Blend;
// Initialize Steppers
ManageInventory manageInventory = SK.AddStepper<ManageInventory>();
Minimap minimap = SK.AddStepper<Minimap>();
Search search = SK.AddStepper<Search>();
SK.AddStepper<Logger>();
SK.AddStepper<DebugWindow>();
SK.AddStepper<DebugFBSpatialEntity>();
// Radial hand menu
SK.AddStepper(new HandMenuRadial(
new HandRadialLayer("Root",
new HandMenuItem("", Catalog.Sprites.IconAdd, () => manageInventory.AddItem()),
new HandMenuItem("", Catalog.Sprites.IconRadar, () => minimap.Enabled = !minimap.Enabled),
new HandMenuItem("", Catalog.Sprites.IconSearch, () =>
{
Vec3 position = Input.Head.position + Input.Head.Forward * 50 * U.cm;
Quat orientation = Quat.LookAt(position, Input.Head.position);
search.TeleportMenu(new Pose(position, orientation));
}),
new HandMenuItem("", Catalog.Sprites.IconBug, () => App.DEBUG_ON = !App.DEBUG_ON),
new HandMenuItem("Cancel", null, null))
));
// Core application loop
SK.Run(() => {
// Only draw floor when using VR headset with no AR passthrough
if (SK.System.displayType == Display.Opaque && !App.Passthrough.Enabled)
Mesh.Cube.Draw(floorMaterial, floorTransform);
});
}
}