diff --git a/Platforms/Android/AndroidManifest.xml b/Platforms/Android/AndroidManifest.xml index 8136c10..6dc3efa 100644 --- a/Platforms/Android/AndroidManifest.xml +++ b/Platforms/Android/AndroidManifest.xml @@ -1,9 +1,9 @@ - + @@ -17,25 +17,43 @@ - + - - - + + + - - + + - + - + @@ -45,11 +63,26 @@ - - - - - + + + + + - - - + + + - + @@ -86,4 +131,4 @@ - \ No newline at end of file + diff --git a/readme.md b/readme.md index baebdce..e788456 100644 --- a/readme.md +++ b/readme.md @@ -54,12 +54,12 @@ todo benchmark 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 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*) 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 diff --git a/src/Arts.cs b/src/Arts.cs index 5d9a762..e275033 100644 --- a/src/Arts.cs +++ b/src/Arts.cs @@ -84,22 +84,66 @@ static class Arts box_scale ); - // hanger + // telescoping hanging rod 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); - Lines.Add( - 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), - Color.Hex(0x808080FF).ToLinear(), - 1.0f * U.mm - ); - Lines.Add( - Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist), - Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0), - Color.Hex(0x808080FF).ToLinear(), - 1.0f * U.mm + + Vec3 box_mount = box_m4 * V.XYZ(0, Mono.SD_Y - 0.5f, 0); + Vec3 box_handl = Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist); + + 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); + Vec3[] p = new Vec3[] { + box_mount, + box_handl, + + 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.2f) * 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 diff --git a/src/Maths.cs b/src/Maths.cs index ba23f40..cf96010 100644 --- a/src/Maths.cs +++ b/src/Maths.cs @@ -35,7 +35,10 @@ public static class Maths // public static int roundi(float value) => MathF.Round(value) 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_stop(float t) @@ -43,6 +46,11 @@ public static class Maths float s = sign(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; }