diff --git a/app/Mono.cs b/app/Mono.cs index 2bb2e3e..29eff11 100644 --- a/app/Mono.cs +++ b/app/Mono.cs @@ -6,6 +6,8 @@ public class Mono { public PullRequest.Noise noise = new PullRequest.Noise(939949595); + public Material matDev; + public Rig rig = new Rig(); public Scene scene = new Scene(); @@ -49,7 +51,6 @@ public class Mono { // new StretchCursor() { deadzone = 0.01f, strength = 3f }, }; } - Pose anchor = Pose.Identity; public void Init() { @@ -60,6 +61,9 @@ public class Mono { // spaceMono.Init(); greenyard.Init(); + + matDev = Material.Default.Copy(); + matDev.SetTexture("diffuse", Tex.DevTex); } // ------------------------------------------------- diff --git a/app/dofs/stretch-cursor/og/StretchCursor.cs b/app/dofs/stretch-cursor/og/StretchCursor.cs index 8ce1f93..62bccc5 100644 --- a/app/dofs/stretch-cursor/og/StretchCursor.cs +++ b/app/dofs/stretch-cursor/og/StretchCursor.cs @@ -2,7 +2,7 @@ namespace Oriels; class StretchCursor : dof { // input - public Pose p0, p1; + public Pose to, from; // data public Pose cursor; @@ -10,12 +10,12 @@ class StretchCursor : dof { public void Init() {} public void Frame() { - Vec3 vec = p0.position - p1.position; + Vec3 vec = to.position - from.position; float len = vec.Length; float stretch = Math.Max(len - deadzone, 0f); - Vec3 dir = backhand ? vec / len : p0.orientation * Vec3.Forward; + Vec3 dir = backhand ? vec / len : to.orientation * Vec3.Forward; - cursor.position = p0.position + dir * stretch * strength; // * Mono.inst.stretchStr; + cursor.position = to.position + dir * stretch * strength; // * Mono.inst.stretchStr; Mesh.Cube.Draw(Material.Default, Matrix.TS(cursor.position, 0.01f)); } diff --git a/app/dofs/stretch-cursor/og/⧉ b/app/dofs/stretch-cursor/og/⧉ index e69de29..5bd8cab 100644 --- a/app/dofs/stretch-cursor/og/⧉ +++ b/app/dofs/stretch-cursor/og/⧉ @@ -0,0 +1,22 @@ +input + to = [pos, ori] + from = [pos, ori] + +data + cursor + +init + cursor = to.pos + +frame + vec = to.pos - from.pos + len = vec.len + stretch = max(len - deadzone, 0) + dir = pointer ? to.ori * v3.fwd : vec / len + + cursor = to.pos + dir * stretch * strength + +design + pointer = false + deadzone = 0.1 + strength = 3 \ No newline at end of file diff --git a/app/dofs/stretch-cursor/wave/WaveCursor.cs b/app/dofs/stretch-cursor/wave/WaveCursor.cs index 00de0db..fd082e3 100644 --- a/app/dofs/stretch-cursor/wave/WaveCursor.cs +++ b/app/dofs/stretch-cursor/wave/WaveCursor.cs @@ -8,8 +8,9 @@ class WaveCursor : dof { Vec3 oldLocalPad; Quat delta; public Pose cursor = Pose.Identity; - Material mat = Material.Default; + Material mat; public void Init() { + mat = Material.Default.Copy(); mat.SetTexture("diffuse", Tex.DevTex); } @@ -61,6 +62,9 @@ class WaveCursor : dof { if (localPad.Length < 0.015f) { color = new Color(1, 0, 0); } + if (localPad.Length > 0.055f) { + color = new Color(0, 1, 1); + } if (localPad.Length < 0.03f && isTracking) { delta = PullRequest.Relative( @@ -70,7 +74,10 @@ class WaveCursor : dof { } if (isTracking) { - cursor.orientation = delta * cursor.orientation; + Quat newOri = delta * cursor.orientation; + if (new Vec3(newOri.x, newOri.y, newOri.z).LengthSq > 0) { + cursor.orientation = newOri; + } } // Lines.Add(