test toggles

This commit is contained in:
ethan merchant 2024-12-08 00:09:40 -05:00
parent af27931d6c
commit 66e5afdb22
3 changed files with 16 additions and 3 deletions

View file

@ -117,7 +117,7 @@ static class Arts
// color_cube // color_cube
{ {
meshes["color_cube"].Draw( meshes[ColorCube.toggle ? "color_cube_toggle" : "color_cube"].Draw(
mat_colorcube, mat_colorcube,
ColorCube.grab.pose.ToMatrix(ColorCube.scl) ColorCube.grab.pose.ToMatrix(ColorCube.scl)
); );

View file

@ -34,7 +34,7 @@ static class Stretch
Vec3 delta = to_grab.pose.position - from_grab.pose.position; Vec3 delta = to_grab.pose.position - from_grab.pose.position;
stretch = Maths.max(delta.Magnitude - deadzone, 0); stretch = Maths.max(delta.Magnitude - deadzone, 0);
Vec3 dir = delta.Normalized; Vec3 dir = toggle ? delta.Normalized : to_grab.pose.orientation * Vec3.Forward;
cursor.position = to_grab.pose.position + dir * stretch * strength; cursor.position = to_grab.pose.position + dir * stretch * strength;
if (Vec3.Distance(cursor.position, last_particle_pos) > trail_dist) if (Vec3.Distance(cursor.position, last_particle_pos) > trail_dist)
@ -62,7 +62,8 @@ static class Stretch
} }
// design // design
static float deadzone = 0.1f; public static bool toggle = true;
static float deadzone = 0.06f;
static float strength = 3; static float strength = 3;
} }
@ -109,5 +110,8 @@ static class ColorCube
return x / 12.92f; return x / 12.92f;
} }
// design
public static bool toggle = true;
} }

View file

@ -39,6 +39,8 @@ static class Mono
ColorCube.Init(); ColorCube.Init();
} }
public static Pose windowPoseButton = new Pose(0, -0.4f, -0.4f, Quat.FromAngles(45, 180, 0));
public static void Frame() public static void Frame()
{ {
if (Rig.btn_back.delta == +1) if (Rig.btn_back.delta == +1)
@ -58,6 +60,13 @@ static class Mono
} }
} }
UI.WindowBegin("test toggles", ref windowPoseButton);
if (UI.Button(ColorCube.toggle ? "color frame" : "color face"))
ColorCube.toggle = !ColorCube.toggle;
if (UI.Button(Stretch.toggle ? "con dir" : "stretch dir"))
Stretch.toggle = !Stretch.toggle;
UI.WindowEnd();
// flatscreen dev controls // flatscreen dev controls
if (Device.Name == "Simulator") if (Device.Name == "Simulator")
{ {