render/test stretch cursor

This commit is contained in:
ethan merchant 2024-12-07 13:41:56 -05:00
parent b182017f12
commit 9c7b1f35b3
5 changed files with 70 additions and 108 deletions

View file

@ -2,8 +2,8 @@
<manifest <manifest
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dofdev.dofdemo" package="com.dofdev.dofdemo"
android:versionCode="1" android:versionCode="9"
android:versionName="1.01" android:versionName="1.09"
android:installLocation="auto" android:installLocation="auto"
> >
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" /> <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />

View file

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ApplicationIcon>Platforms\Net\App.ico</ApplicationIcon> <ApplicationIcon>Platforms\Net\App.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>

View file

@ -47,13 +47,15 @@ todo
peers to get a feel of some of our interactions without in a time efficient manner peers to get a feel of some of our interactions without in a time efficient manner
send and forget (perfect ux / no confusion or hand holding needed) send and forget (perfect ux / no confusion or hand holding needed)
iterate version on dotnet publish using shell script
featuring: featuring:
[] stretch_cursor [x] stretch_cursor
[] color_cube [ ] color_cube // move cube around picker which is constrained by cube limits
[] orbital_view [ ] orbital_view // same dis/mount system as snake in a box
[] fullstick [ ] fullstick
[] twist_cursor [ ] twist_cursor
[] cubic_flow [ ] cubic_flow
bug(s) bug(s)
... ...

View file

@ -13,11 +13,7 @@ static class Arts
static Material mat_backface = new Material("backface.hlsl"); static Material mat_backface = new Material("backface.hlsl");
static Material mat_justcolor = new Material("justcolor.hlsl"); static Material mat_justcolor = new Material("justcolor.hlsl");
static Material mat_dofdemo = new Material("unlit.hlsl");
public static Vec3 shake = new(0, 0, 0); public static Vec3 shake = new(0, 0, 0);
// static Quat spin_ori = Quat.Identity;
public static Vec3 last_tip_pos = new(0, 0, 0);
static TextStyle text_style; static TextStyle text_style;
@ -43,8 +39,6 @@ static class Arts
mat_backface.DepthWrite = false; mat_backface.DepthWrite = false;
mat_both.Chain = mat_backface; mat_both.Chain = mat_backface;
mat_dofdemo.FaceCull = Cull.None;
} }
public static void Frame() public static void Frame()
@ -52,28 +46,18 @@ static class Arts
// Input.HandVisible(Handed.Max, false); // Input.HandVisible(Handed.Max, false);
// world // world
Matrix m4_world = Mono.world_pose.ToMatrix(); Matrix m4_dof = Mono.dof_pose.ToMatrix(Mono.dof_scl);
Hierarchy.Push(m4_world); Hierarchy.Push(m4_dof);
// mesh test // mesh test
meshes["Food"].Draw( // meshes["Food"].Draw(
mat_mono, // mat_mono,
Matrix.TRS( // Matrix.TRS(
V.XYZ(0, 0, -1), // V.XYZ(0, 0, -1),
Quat.Identity, // Quat.Identity,
0.1f // 0.1f
) // )
); // );
// bamboo
Mesh.Cube.Draw(
mat_unlit,
Matrix.TS(
V.XYZ(0, 1, -2),
V.XYZ(0.1f, 2, 0.1f)
),
Color.Hex(0xB9E7AFFF)
);
// unit cube // unit cube
// Mesh.Cube.Draw( // Mesh.Cube.Draw(
@ -82,80 +66,58 @@ static class Arts
// Color.Hex(0x13180AFF).ToLinear() // Color.Hex(0x13180AFF).ToLinear()
// ); // );
// enemy //// dof
Vec3 enemy_pos = V.XYZ(SKMath.Sin(Time.Totalf * 1f) * 1.0f, 0.5f, -3.0f); // design
float enemy_rad = 0.5f; float deadzone = 0.1f;
Mesh.Sphere.Draw( float strength = 3;
mat_unlit,
Matrix.TS(enemy_pos, enemy_rad * 2.0f), // input
Color.Hex(0x13180AFF).ToLinear() // controls you can pick up (double grip to drop)
// if (!Mono.to_grab.Held)
// {
// Pose to_pose = new Pose(
// V.XYZ(0, 0, 0)
// );
// }
// else
// {
// to_pose = Rig.r_hld;
// }
// if (!Mono.from_grab.Held)
// {
// Pose from_pose = new Pose(
// to_pose.position + V.XYZ(0, 0, (deadzone + Maths.u_scalar(SKMath.Sin(Time.Totalf)) * deadzone))
// );
// }
// data
float stretch = 0.0f;
Pose cursor = new Pose();
// frame
Vec3 delta = Mono.to_grab.pose.position - Mono.from_grab.pose.position;
stretch = Maths.max(delta.Magnitude - deadzone, 0);
Vec3 dir = delta.Normalized;
cursor.position = Mono.to_grab.pose.position + dir * stretch * strength;
Mesh.Cube.Draw(
mat_mono,
Mono.to_grab.pose.ToMatrix(0.1f)
);
Mesh.Cube.Draw(
mat_mono,
Mono.from_grab.pose.ToMatrix(0.05f)
); );
// eyes Mesh.Cube.Draw(
// Mesh.Cube.Draw( mat_mono,
// mat_unlit, cursor.ToMatrix(0.05f)
// Rig.head.ToMatrix().Transform(),
// Color.Hex(0x13180AFF).ToLinear()
// );
// blade
Mesh mesh = new();
Quat blade_ori = Rig.r_hld.orientation;
Vec3 blade_pos = Rig.r_hld.position;
Vec3 tip_pos = blade_pos + blade_ori * V.XYZ(0, 0, 1);
mesh.SetData(
new Vertex[] {
new( blade_pos, V.XYZ(0,0,1)),
new( tip_pos, V.XYZ(0,0,1)),
new(last_tip_pos, V.XYZ(0,0,1))
},
new uint[] {
0, 1, 2
}
);
mesh.Draw(
mat_dofdemo,
Matrix.Identity,
Color.Hex(0xF9BF05FF).ToLinear()
);
last_tip_pos = Vec3.Lerp(last_tip_pos, tip_pos, Time.Stepf / 0.1f);
// revolver
Quat rvolv_ori = Rig.l_aim.orientation;
Vec3 rvolv_pos = Rig.l_aim.position;
Lines.Add(
rvolv_pos,
rvolv_pos + rvolv_ori * V.XYZ(0, 0, -10),
Color.Hex(0xF9BF05FF).ToLinear(),
U.cm
); );
if (true) // hit test
{ Hierarchy.Pop();
Vec3 hit_delta = rvolv_ori.Inverse * (enemy_pos - rvolv_pos);
float flat_z = hit_delta.z;
hit_delta.z = 0;
float hit_mag = hit_delta.Magnitude;
bool hit = hit_mag < enemy_rad;
if (hit)
{
float hit_dist = flat_z + (Maths.smooth_stop((enemy_rad - hit_mag) / enemy_rad) * enemy_rad);
Vec3 hit_pos = rvolv_pos + rvolv_ori * V.XYZ(0, 0, hit_dist);
Mesh.Sphere.Draw(
mat_unlit,
Matrix.TS(
hit_pos,
4 * U.cm
),
Color.White
);
if (Rig.btn_select.delta == +1)
{
VFX.Play(hit_pos);
}
}
}
// particles // particles
Particle[] particles = VFX.particles; Particle[] particles = VFX.particles;
@ -173,9 +135,6 @@ static class Arts
); );
} }
Hierarchy.Pop();
// menu // menu
Matrix m4_menu = Mono.menu_pose.ToMatrix(Mono.menu_scale); Matrix m4_menu = Mono.menu_pose.ToMatrix(Mono.menu_scale);
Hierarchy.Push(m4_menu); Hierarchy.Push(m4_menu);

View file

@ -19,7 +19,7 @@ class Program
// overlayApp = true, // overlayApp = true,
// overlayPriority = 1, // overlayPriority = 1,
depthMode = DepthMode.D32, depthMode = DepthMode.D32,
disableFlatscreenMRSim = true, // disableFlatscreenMRSim = true,
renderScaling = 2, renderScaling = 2,
renderMultisample = 0, renderMultisample = 0,
// mode = AppMode.Simulator, // mode = AppMode.Simulator,