bamboo shoots bg

This commit is contained in:
ethan merchant 2024-12-19 04:35:45 -05:00
parent 2541a6d96c
commit de6f05f382

View file

@ -86,14 +86,63 @@ static class Arts
);
// bamboo
Mesh.Cube.Draw(
mat_unlit,
Matrix.TS(
V.XYZ(0, 1, -5),
V.XYZ(0.1f, 2, 0.1f)
),
Color.Hex(0xB9E7AFFF)
);
for (int i = -12; i <= 12; i++)
{
float z_offset = Noise.s_scalar_x(i) * 2.0f;
float x_offset = Noise.s_scalar_x(i + 32) * 0.2f;
float x_wind = Maths.smooth_stop(Maths.u_scalar(SKMath.Sin((i * 0.16f) - Time.Totalf)));
Vec3[] p = new Vec3[] {
V.XYZ(i * 0.3f, 0, -10 + z_offset),
V.XYZ(i * 0.3f, 1, -10 + z_offset),
V.XYZ(i * 0.3f, 4, -10 + z_offset),
V.XYZ(i * 0.3f + x_offset + x_wind, 5, -10 + z_offset),
};
// debug bezier points
// for (int i = 0; i < p.Length; i++)
// {
// Mesh.Sphere.Draw(
// mat_justcolor,
// Matrix.TS(
// p[i],
// 2 * U.mm
// ),
// Color.White
// );
// }
// ground bump
// Mesh.Sphere.Draw(
// mat_justcolor,
// Matrix.TS(
// box_mount,
// 3 * U.mm
// ),
// Color.Hex(0x959493FF).ToLinear()
// );
int steps = 92;
Vec3 pastPos = p[0];
float pastThc = 0.0f;
for (int j = 0; j < steps; j++)
{
float t = (float)j / (steps - 1);
Vec3 a = Vec3.Lerp(p[0], p[1], t);
Vec3 b = Vec3.Lerp(p[1], p[2], t);
Vec3 c = Vec3.Lerp(p[2], p[3], t);
Vec3 pos = Vec3.Lerp(Vec3.Lerp(a, b, t), Vec3.Lerp(b, c, t), t);
float thc = (1.0f + Maths.precision((1.0f - t), Maths.lerp(0.1f, 0.2f, Noise.u_scalar_x(i))) * 2.0f) * U.cm * 6.0f;
Lines.Add(
pastPos,
pos,
thc != pastThc ? Color.Hex(0x959493FF).ToLinear() : Color.Hex(0xB9E7AFFF).ToLinear(),
thc
);
pastPos = pos;
pastThc = thc;
}
}
// unit cube
// Mesh.Cube.Draw(