dynamic slash mesh test

This commit is contained in:
ethan merchant 2024-12-02 15:55:10 -05:00
parent 93e7cae6b0
commit 7bfa3e0db3

View file

@ -13,8 +13,11 @@ static class Arts
static Material mat_backface = new Material("backface.hlsl");
static Material mat_justcolor = new Material("justcolor.hlsl");
static Material mat_slash = new Material("unlit.hlsl");
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;
@ -40,6 +43,8 @@ static class Arts
mat_backface.DepthWrite = false;
mat_both.Chain = mat_backface;
mat_slash.FaceCull = Cull.None;
}
public static void Frame()
@ -53,12 +58,32 @@ static class Arts
meshes["Food"].Draw(
mat_mono,
Matrix.TRS(
Vec3.Zero,
V.XYZ(0, 0, -1),
Quat.Identity,
1.0f
0.1f
)
);
Mesh mesh = new();
Quat hand_rot = Quat.FromAngles(0, 0, SKMath.Sin(Time.Totalf * 6f) * 30f);
Vec3 hand_pos = V.XYZ(SKMath.Sin(Time.Totalf * 1f) * 0.1f, 0, 0);
Vec3 tip_pos = hand_pos + hand_rot * V.XYZ(0, 1, 0);
mesh.SetData(
new Vertex[] {
new( hand_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_slash,
Matrix.T(0, -1.0f, -1)
);
last_tip_pos = Vec3.Lerp(last_tip_pos, tip_pos, Time.Stepf / 0.1f);
// particles
Particle[] particles = VFX.particles;
for (int i = 0; i < particles.Length; i++)