Compare commits

...

5 commits

6 changed files with 176 additions and 62 deletions

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8" ?>
<manifest <manifest
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dofdev.snake" package="com.dofdev.snake"
android:versionCode="48" android:versionCode="51"
android:versionName="1.53" android:versionName="1.56"
android:installLocation="auto" android:installLocation="auto"
> >
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" /> <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />
@ -17,25 +17,43 @@
<!-- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> --> <!-- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> -->
<!-- Generic OpenXR items --> <!-- Generic OpenXR items -->
<uses-feature android:name="android.hardware.vr.headtracking" android:required="true" android:version="1" /> <uses-feature
android:name="android.hardware.vr.headtracking"
android:required="true"
android:version="1"
/>
<uses-permission android:name="org.khronos.openxr.permission.OPENXR_SYSTEM" /> <uses-permission android:name="org.khronos.openxr.permission.OPENXR_SYSTEM" />
<uses-permission android:name="org.khronos.openxr.permission.OPENXR" /> <uses-permission android:name="org.khronos.openxr.permission.OPENXR" />
<queries> <queries>
<provider android:authorities="org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker" /> <provider
<intent> <action android:name="org.khronos.openxr.OpenXRRuntimeService" /> </intent> android:authorities="org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker"
<intent> <action android:name="org.khronos.openxr.OpenXRApiLayerService" /> </intent> />
<intent> <action
android:name="org.khronos.openxr.OpenXRRuntimeService"
/> </intent>
<intent> <action
android:name="org.khronos.openxr.OpenXRApiLayerService"
/> </intent>
</queries> </queries>
<!-- Vive specific items --> <!-- Vive specific items -->
<uses-feature android:name="wave.feature.handtracking" android:required="false" /> <uses-feature
<uses-feature android:name="wave.feature.tracker" android:required="false" /> android:name="wave.feature.handtracking"
android:required="false"
/>
<uses-feature android:name="wave.feature.tracker" android:required="false" />
<!-- Snapdragon specific items --> <!-- Snapdragon specific items -->
<uses-permission android:name="com.qualcomm.qti.qxr.QXRServiceClientPermission" android:required="false" /> <uses-permission
android:name="com.qualcomm.qti.qxr.QXRServiceClientPermission"
android:required="false"
/>
<queries> <queries>
<package android:name="com.qualcomm.qti.spaces.services" /> <package android:name="com.qualcomm.qti.spaces.services" />
<package android:name="com.qualcomm.qti.openxrruntime" /> <package android:name="com.qualcomm.qti.openxrruntime" />
<intent> <action android:name="com.qualcomm.qti.openxr.spaces.intent.action.BIND" /> </intent> <intent> <action
android:name="com.qualcomm.qti.openxr.spaces.intent.action.BIND"
/> </intent>
</queries> </queries>
<!-- Oculus specific items --> <!-- Oculus specific items -->
@ -45,11 +63,26 @@
<uses-permission android:name="com.oculus.permission.EYE_TRACKING" /> <uses-permission android:name="com.oculus.permission.EYE_TRACKING" />
<uses-permission android:name="com.oculus.permission.USE_ANCHOR_API" /> <uses-permission android:name="com.oculus.permission.USE_ANCHOR_API" />
<uses-permission android:name="com.oculus.permission.USE_SCENE" /> <uses-permission android:name="com.oculus.permission.USE_SCENE" />
<uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="true" /> <uses-feature
<uses-feature android:name="oculus.software.handtracking" android:required="false" /> android:name="com.oculus.feature.PASSTHROUGH"
<uses-feature android:name="com.oculus.software.body_tracking" android:required="false" /> android:required="true"
<uses-feature android:name="oculus.software.face_tracking" android:required="false" /> />
<uses-feature android:name="oculus.software.eye_tracking" android:required="false" /> <uses-feature
android:name="oculus.software.handtracking"
android:required="false"
/>
<uses-feature
android:name="com.oculus.software.body_tracking"
android:required="false"
/>
<uses-feature
android:name="oculus.software.face_tracking"
android:required="false"
/>
<uses-feature
android:name="oculus.software.eye_tracking"
android:required="false"
/>
<application <application
android:allowBackup="false" android:allowBackup="false"
@ -59,11 +92,23 @@
android:supportsRtl="true" android:supportsRtl="true"
> >
<!-- Oculus --> <!-- Oculus -->
<meta-data android:name="com.oculus.supportedDevices" android:value="quest2|quest3|questpro" /> <meta-data
<meta-data android:name="com.oculus.handtracking.version" android:value="V2.0" /> android:name="com.oculus.supportedDevices"
<meta-data android:name="com.oculus.ossplash.background" android:value="passthrough-contextual" /> android:value="quest2|quest3|questpro"
/>
<meta-data
android:name="com.oculus.handtracking.version"
android:value="V2.0"
/>
<meta-data
android:name="com.oculus.ossplash.background"
android:value="passthrough-contextual"
/>
<meta-data android:name="com.oculus.vr.focusaware" android:value="true" /> <meta-data android:name="com.oculus.vr.focusaware" android:value="true" />
<uses-native-library android:name="libopenxr_forwardloader.oculus.so" android:required="false" /> <uses-native-library
android:name="libopenxr_forwardloader.oculus.so"
android:required="false"
/>
<!-- Pico --> <!-- Pico -->
<meta-data android:name="pvr.app.type" android:value="vr" /> <meta-data android:name="pvr.app.type" android:value="vr" />
<meta-data android:name="handtracking" android:value="1" /> <meta-data android:name="handtracking" android:value="1" />
@ -86,4 +131,4 @@
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>
</manifest> </manifest>

View file

@ -1,4 +1,3 @@
- [lynx r1 resource](https://github.com/technobaboo/stereokit_lynx_dotnet_template)
- [fb passthrough resource](https://www.aesiio.com/blog/passthrough-dot-net-core) - [fb passthrough resource](https://www.aesiio.com/blog/passthrough-dot-net-core)
- [fb passthrough tool source](https://github.com/StereoKit/StereoKit/blob/master/Examples/StereoKitTest/Tools/PassthroughFBExt.cs) - [fb passthrough tool source](https://github.com/StereoKit/StereoKit/blob/master/Examples/StereoKitTest/Tools/PassthroughFBExt.cs)
@ -55,12 +54,12 @@ todo
benchmark benchmark
need to be able to play without moving/turning the box need to be able to play without moving/turning the box
DepthTest Material.DepthTest { get; set; }
you could use DepthTest.Greater to draw a glow that indicates an object is behind something.
start music on egg eat start music on egg eat
to keep prior tutorial phase focused and a strong indication that auto move has kicked in to keep prior tutorial phase focused and a strong indication that auto move has kicked in
curved hanger
my tempo (zen mode *after initial release*) my tempo (zen mode *after initial release*)
on l_con tap (a) btn to step, and repeatedly to set tempo on l_con tap (a) btn to step, and repeatedly to set tempo
once a tempo has been set you can stop tapping and you'll coast at that tempo once a tempo has been set you can stop tapping and you'll coast at that tempo

View file

@ -84,22 +84,66 @@ static class Arts
box_scale box_scale
); );
// hanger // telescoping hanging rod
if (Mono.in_cone.state && Mono.box_mode == Mono.BoxMode.Hold || Mono.box_mode == Mono.BoxMode.Mount) if (Mono.in_cone.state && Mono.box_mode == Mono.BoxMode.Hold || Mono.box_mode == Mono.BoxMode.Mount)
{ {
float box_head_dist = Vec3.Distance(box_pos, Rig.head.position); float box_head_dist = Vec3.Distance(box_pos, Rig.head.position);
Lines.Add(
box_m4 * V.XYZ(0, Mono.SD_Y - 0.5f, 0), Vec3 box_mount = box_m4 * V.XYZ(0, Mono.SD_Y - 0.5f, 0);
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist), Vec3 box_handl = Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist);
Color.Hex(0x808080FF).ToLinear(),
1.0f * U.mm Vec3 head_mount = Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0);
); Vec3 head_handl = Vec3.Lerp(box_handl, head_mount, 0.5f);
Lines.Add( Vec3[] p = new Vec3[] {
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist), box_mount,
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0), box_handl,
Color.Hex(0x808080FF).ToLinear(),
1.0f * U.mm head_handl,
head_mount,
};
// debug bezier points
// for (int i = 0; i < p.Length; i++)
// {
// Mesh.Sphere.Draw(
// mat_justcolor,
// Matrix.TS(
// p[i],
// 2 * U.mm
// ),
// Color.White
// );
// }
Mesh.Sphere.Draw(
mat_justcolor,
Matrix.TS(
box_mount,
3 * U.mm
),
Color.Hex(0x959493FF).ToLinear()
); );
int steps = 64;
Vec3 pastPos = p[0];
float pastThc = 0.0f;
for (int i = 0; i < steps; i++)
{
float t = (float)i / (steps - 1);
Vec3 a = Vec3.Lerp(p[0], p[1], t);
Vec3 b = Vec3.Lerp(p[1], p[2], t);
Vec3 c = Vec3.Lerp(p[2], p[3], t);
Vec3 pos = Vec3.Lerp(Vec3.Lerp(a, b, t), Vec3.Lerp(b, c, t), t);
float thc = (1.0f + Maths.precision(t, 0.333f) * 2.0f) * U.mm;
Lines.Add(
pastPos,
pos,
thc != pastThc ? Color.Hex(0x959493FF).ToLinear() : Color.Hex(0x808080FF).ToLinear(),
thc
);
pastPos = pos;
pastThc = thc;
}
} }
// box contents // box contents

View file

@ -35,7 +35,10 @@ public static class Maths
// public static int roundi(float value) => MathF.Round(value) // public static int roundi(float value) => MathF.Round(value)
public static float precision(float x, float p) public static float precision(float x, float p)
=> round(x * p) / p; {
float ps = p < 1.0f ? 1 / p : p;
return round(x * ps) / ps;
}
public static float smooth_start(float t) => (t * t * t); public static float smooth_start(float t) => (t * t * t);
public static float smooth_stop(float t) public static float smooth_stop(float t)
@ -43,6 +46,11 @@ public static class Maths
float s = sign(t); float s = sign(t);
return (s - ((s - t) * (s - t) * (s - t))); return (s - ((s - t) * (s - t) * (s - t)));
} }
public static float less_smooth_stop(float t) // [!] messy implementation
{
float s = sign(t);
return (s - ((s - t) * (s - t)));
}
public static float lerp(float a, float b, float t) => a + (b - a) * t; public static float lerp(float a, float b, float t) => a + (b - a) * t;
} }

View file

@ -15,7 +15,7 @@ static class Mono
public static bool menu = true; public static bool menu = true;
public static Pose box_pose = new(0, -3 * U.cm, -10 * U.cm); public static Pose box_pose = new(0, -3 * U.cm, -10 * U.cm);
public static float box_dist = 32 * U.cm; public static float box_dist = 42 * U.cm;
public static float box_scale = 1.333f * U.cm; public static float box_scale = 1.333f * U.cm;
public const int SD_X = 3, SD_Y = 2, SD_Z = 3; public const int SD_X = 3, SD_Y = 2, SD_Z = 3;
public static SpatialArray<int> public static SpatialArray<int>

View file

@ -40,33 +40,51 @@ static class Rig
} }
else else
{ {
// Hand r_hand = Input.Hand(Handed.Right); if (Input.HandSource(Handed.Right) == HandSource.Articulated)
// [!] hand input simulates controller...
Controller r_con = Input.Controller(Handed.Right);
bool con_tracked = r_con.trackedPos > TrackState.Lost;
// bool hand_tracked = Input.HandSource(Handed.Right) > HandSource.None;
if (con_tracked)
{ {
btn_select.Step(r_con.x1.IsActive() || r_con.trigger > 0.5f); Hand r_hnd = Input.Hand(Handed.Right);
btn_grip.Step(r_con.grip > 0.5f); if (r_hnd.IsTracked)
btn_back.Step(r_con.x2.IsActive()); {
btn_select.Step(r_hnd.IsPinched);
btn_grip.Step(r_hnd.IsGripped);
// btn_back.Step(); // [!] todo
Vec2 stick = r_con.stick; Vec3 thumb_tip = r_hnd.Get(FingerId.Thumb, JointId.Tip).position;
Quat stick_rot = Quat.FromAngles(stick.y * -90, 0, stick.x * +90); Vec3 index_tip = r_hnd.Get(FingerId.Index, JointId.Tip).position;
float stick_sign = r_con.IsStickClicked ? -1 : +1; r_con_stick.position = thumb_tip;
r_con_stick = r_con.aim;
// r_con_stick.position += r_con_stick.orientation * V.XYZ(0.0065f, -0.012f, -0.05f);
// r_con_stick.orientation *= Quat.FromAngles(-50, 0, 0);
fullstick = r_con_stick.orientation * stick_rot * Vec3.Up * stick_sign;
// Vec3 fullstick = r_hand.palm.orientation * Vec3.Up; fullstick = Vec3.Direction(index_tip, thumb_tip);
float ax = Maths.abs(fullstick.x);
float ay = Maths.abs(fullstick.y); float ax = Maths.abs(fullstick.x);
float az = Maths.abs(fullstick.z); float ay = Maths.abs(fullstick.y);
if (ax > ay && ax > az) new_dir = new(Maths.sign(fullstick.x), 0, 0); float az = Maths.abs(fullstick.z);
if (ay > ax && ay > az) new_dir = new(0, Maths.sign(fullstick.y), 0); if (ax > ay && ax > az) new_dir = new(Maths.sign(fullstick.x), 0, 0);
if (az > ax && az > ay) new_dir = new(0, 0, Maths.sign(fullstick.z)); if (ay > ax && ay > az) new_dir = new(0, Maths.sign(fullstick.y), 0);
if (az > ax && az > ay) new_dir = new(0, 0, Maths.sign(fullstick.z));
}
}
else
{
Controller r_con = Input.Controller(Handed.Right);
if (r_con.IsTracked)
{
btn_select.Step(r_con.x1.IsActive() || r_con.trigger > 0.5f);
btn_grip.Step(r_con.grip > 0.5f);
btn_back.Step(r_con.x2.IsActive());
Vec2 stick = r_con.stick;
Quat stick_rot = Quat.FromAngles(stick.y * -90, 0, stick.x * +90);
float stick_sign = r_con.IsStickClicked ? -1 : +1;
r_con_stick = r_con.aim;
fullstick = r_con_stick.orientation * stick_rot * Vec3.Up * stick_sign;
float ax = Maths.abs(fullstick.x);
float ay = Maths.abs(fullstick.y);
float az = Maths.abs(fullstick.z);
if (ax > ay && ax > az) new_dir = new(Maths.sign(fullstick.x), 0, 0);
if (ay > ax && ay > az) new_dir = new(0, Maths.sign(fullstick.y), 0);
if (az > ax && az > ay) new_dir = new(0, 0, Maths.sign(fullstick.z));
}
} }
} }
} }