pattern test

This commit is contained in:
spatialfree 2022-10-03 08:54:32 -04:00
parent ace7385db8
commit 95e7b714c5
4 changed files with 40 additions and 7 deletions

View file

@ -6,6 +6,8 @@ public class Mono {
public PullRequest.Noise noise = new PullRequest.Noise(939949595); public PullRequest.Noise noise = new PullRequest.Noise(939949595);
public Material matDev;
public Rig rig = new Rig(); public Rig rig = new Rig();
public Scene scene = new Scene(); public Scene scene = new Scene();
@ -49,7 +51,6 @@ public class Mono {
// new StretchCursor() { deadzone = 0.01f, strength = 3f }, // new StretchCursor() { deadzone = 0.01f, strength = 3f },
}; };
} }
Pose anchor = Pose.Identity;
public void Init() { public void Init() {
@ -60,6 +61,9 @@ public class Mono {
// spaceMono.Init(); // spaceMono.Init();
greenyard.Init(); greenyard.Init();
matDev = Material.Default.Copy();
matDev.SetTexture("diffuse", Tex.DevTex);
} }
// ------------------------------------------------- // -------------------------------------------------

View file

@ -2,7 +2,7 @@ namespace Oriels;
class StretchCursor : dof { class StretchCursor : dof {
// input // input
public Pose p0, p1; public Pose to, from;
// data // data
public Pose cursor; public Pose cursor;
@ -10,12 +10,12 @@ class StretchCursor : dof {
public void Init() {} public void Init() {}
public void Frame() { public void Frame() {
Vec3 vec = p0.position - p1.position; Vec3 vec = to.position - from.position;
float len = vec.Length; float len = vec.Length;
float stretch = Math.Max(len - deadzone, 0f); 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)); Mesh.Cube.Draw(Material.Default, Matrix.TS(cursor.position, 0.01f));
} }

View file

@ -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

View file

@ -8,8 +8,9 @@ class WaveCursor : dof {
Vec3 oldLocalPad; Vec3 oldLocalPad;
Quat delta; Quat delta;
public Pose cursor = Pose.Identity; public Pose cursor = Pose.Identity;
Material mat = Material.Default; Material mat;
public void Init() { public void Init() {
mat = Material.Default.Copy();
mat.SetTexture("diffuse", Tex.DevTex); mat.SetTexture("diffuse", Tex.DevTex);
} }
@ -61,6 +62,9 @@ class WaveCursor : dof {
if (localPad.Length < 0.015f) { if (localPad.Length < 0.015f) {
color = new Color(1, 0, 0); color = new Color(1, 0, 0);
} }
if (localPad.Length > 0.055f) {
color = new Color(0, 1, 1);
}
if (localPad.Length < 0.03f && isTracking) { if (localPad.Length < 0.03f && isTracking) {
delta = PullRequest.Relative( delta = PullRequest.Relative(
@ -70,7 +74,10 @@ class WaveCursor : dof {
} }
if (isTracking) { 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( // Lines.Add(