-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
65 lines (52 loc) · 1.99 KB
/
Copy pathProgram.cs
File metadata and controls
65 lines (52 loc) · 1.99 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
61
62
63
64
65
using StereoKit;
using StereoKit.Framework;
using System;
namespace PassthroughDotNet
{
internal class Program
{
static void Main(string[] args)
{
PassthroughFBExt stepper = SK.AddStepper<PassthroughFBExt>();
// Initialize StereoKit
SKSettings settings = new SKSettings
{
appName = "PassthroughDotNet",
assetsFolder = "Assets",
};
if (!SK.Initialize(settings))
Environment.Exit(1);
// Create assets used by the app
Pose cubePose = new Pose(0, 0, -0.5f, Quat.Identity);
Model cube = Model.FromMesh(
Mesh.GenerateRoundedCube(Vec3.One * 0.1f, 0.02f),
Default.MaterialUI);
Matrix floorTransform = Matrix.TS(0, -1.5f, 0, new Vec3(30, 0.1f, 30));
Material floorMaterial = new Material(Shader.FromFile("floor.hlsl"));
floorMaterial.Transparency = Transparency.Blend;
Pose windowPose = new Pose(-0.5f, 0, -0.3f, Quat.LookDir(1, 0, 1));
// Core application loop
while (SK.Step(() =>
{
if (SK.System.displayType == Display.Opaque)
Default.MeshCube.Draw(floorMaterial, floorTransform);
UI.Handle("Cube", ref cubePose, cube.Bounds);
cube.Draw(cubePose.ToMatrix());
// Passthrough menu
UI.WindowBegin("Passthrough Menu", ref windowPose);
if (stepper.Available)
{
if (UI.Button("toggle"))
stepper.Enabled = !stepper.Enabled;
UI.Label($"Passthrough is {(stepper.Enabled ? "ON" : "OFF")}");
}
else
{
UI.Label("Passthrough is not available :(");
}
UI.WindowEnd();
})) ;
SK.Shutdown();
}
}
}