Fix frontend input release and vegetation proxies

This commit is contained in:
2026-05-21 20:44:02 +00:00
parent 03dbcbc5f8
commit 3f27be7f88
16 changed files with 120 additions and 46 deletions
+68 -13
View File
@@ -847,6 +847,50 @@ def add_leaf_card(vertices, faces, center, width, height, yaw_degrees, lean_degr
faces.append((base + 0, base + 1, base + 2, base + 3))
def add_irregular_leaf_card(vertices, faces, center, width, height, yaw_degrees, lean_degrees=0.0, pinch=0.18):
yaw = math.radians(yaw_degrees)
lean = math.radians(lean_degrees)
right = (math.cos(yaw) * width * 0.5, math.sin(yaw) * width * 0.5, 0.0)
up_offset = (math.sin(lean) * height * 0.35, 0.0, math.cos(lean) * height)
cx, cy, cz = center
base = len(vertices)
vertices.extend(
[
(cx - right[0] * 0.86, cy - right[1] * 0.86, cz),
(cx + right[0] * 0.92, cy + right[1] * 0.92, cz + height * 0.08),
(cx + right[0] * pinch + up_offset[0], cy + right[1] * pinch + up_offset[1], cz + up_offset[2]),
(cx - right[0] * 0.68 + up_offset[0] * 0.55, cy - right[1] * 0.68 + up_offset[1] * 0.55, cz + up_offset[2] * 0.58),
]
)
faces.append((base + 0, base + 1, base + 2, base + 3))
def add_tapered_cylinder(vertices, faces, base_center, height, base_radius, top_radius, segments=9, yaw_offset_degrees=0.0, top_offset=(0.0, 0.0)):
bx, by, bz = base_center
yaw_offset = math.radians(yaw_offset_degrees)
base_indices = []
top_indices = []
for index in range(segments):
angle = yaw_offset + (math.tau * index) / segments
cos_a = math.cos(angle)
sin_a = math.sin(angle)
base_indices.append(len(vertices))
vertices.append((bx + cos_a * base_radius, by + sin_a * base_radius, bz))
top_indices.append(len(vertices))
vertices.append((bx + top_offset[0] + cos_a * top_radius, by + top_offset[1] + sin_a * top_radius, bz + height))
base_center_index = len(vertices)
vertices.append((bx, by, bz))
top_center_index = len(vertices)
vertices.append((bx + top_offset[0], by + top_offset[1], bz + height))
for index in range(segments):
next_index = (index + 1) % segments
faces.append((base_indices[index], base_indices[next_index], top_indices[next_index], top_indices[index]))
faces.append((base_center_index, base_indices[index], base_indices[next_index]))
faces.append((top_center_index, top_indices[next_index], top_indices[index]))
def add_low_poly_ellipsoid(vertices, faces, center, radius_x, radius_y, radius_z, segments=10):
cx, cy, cz = center
top_index = len(vertices)
@@ -876,33 +920,44 @@ def add_low_poly_ellipsoid(vertices, faces, center, radius_x, radius_y, radius_z
def coastal_oak_mesh():
vertices = []
faces = []
add_box(vertices, faces, (0.0, 0.0, 140.0), (36.0, 30.0, 280.0))
add_box(vertices, faces, (-34.0, 14.0, 250.0), (18.0, 16.0, 125.0))
add_box(vertices, faces, (42.0, -12.0, 275.0), (18.0, 16.0, 115.0))
add_low_poly_ellipsoid(vertices, faces, (0.0, 0.0, 350.0), 150.0, 125.0, 105.0)
add_low_poly_ellipsoid(vertices, faces, (-95.0, 30.0, 320.0), 105.0, 82.0, 78.0)
add_low_poly_ellipsoid(vertices, faces, (95.0, -20.0, 330.0), 112.0, 88.0, 82.0)
add_tapered_cylinder(vertices, faces, (0.0, 0.0, 0.0), 275.0, 23.0, 12.0, 11, 8.0, (18.0, -10.0))
add_tapered_cylinder(vertices, faces, (-8.0, 2.0, 180.0), 145.0, 12.0, 6.0, 8, 21.0, (-86.0, 36.0))
add_tapered_cylinder(vertices, faces, (12.0, -4.0, 205.0), 150.0, 11.0, 5.5, 8, 12.0, (92.0, -42.0))
add_tapered_cylinder(vertices, faces, (5.0, 0.0, 235.0), 120.0, 9.0, 5.0, 8, 44.0, (22.0, 90.0))
for center, rx, ry, rz, segments in (
((0.0, 4.0, 362.0), 165.0, 126.0, 86.0, 13),
((-108.0, 38.0, 330.0), 116.0, 82.0, 66.0, 11),
((105.0, -34.0, 342.0), 122.0, 88.0, 70.0, 11),
((24.0, 106.0, 330.0), 88.0, 70.0, 58.0, 9),
):
add_low_poly_ellipsoid(vertices, faces, center, rx, ry, rz, segments)
for yaw in (8.0, 52.0, 96.0, 141.0):
add_irregular_leaf_card(vertices, faces, (0.0, 0.0, 285.0), 235.0, 150.0, yaw, 6.0, 0.3)
return vertices, faces
def coyote_brush_mesh():
vertices = []
faces = []
for yaw in (0.0, 35.0, 82.0, 128.0, 171.0):
add_leaf_card(vertices, faces, (0.0, 0.0, 0.0), 190.0, 145.0, yaw, 8.0)
add_low_poly_ellipsoid(vertices, faces, (-32.0, 18.0, 78.0), 92.0, 68.0, 56.0, 8)
add_low_poly_ellipsoid(vertices, faces, (48.0, -16.0, 70.0), 86.0, 70.0, 50.0, 8)
add_low_poly_ellipsoid(vertices, faces, (0.0, 42.0, 62.0), 78.0, 52.0, 45.0, 8)
for yaw in (0.0, 27.0, 55.0, 88.0, 122.0, 156.0):
add_irregular_leaf_card(vertices, faces, (0.0, 0.0, 0.0), 170.0, 132.0, yaw, 10.0, 0.24)
for center, rx, ry, rz in (
((-38.0, 18.0, 72.0), 88.0, 62.0, 45.0),
((45.0, -22.0, 68.0), 82.0, 66.0, 42.0),
((0.0, 45.0, 62.0), 72.0, 48.0, 37.0),
((18.0, -56.0, 58.0), 62.0, 44.0, 32.0),
):
add_low_poly_ellipsoid(vertices, faces, center, rx, ry, rz, 9)
return vertices, faces
def dry_grass_clump_mesh():
vertices = []
faces = []
for index, yaw in enumerate((0.0, 22.0, 47.0, 76.0, 111.0, 146.0, 178.0)):
for index, yaw in enumerate((0.0, 16.0, 31.0, 49.0, 73.0, 97.0, 121.0, 148.0, 172.0)):
width = 18.0 + (index % 3) * 4.0
height = 95.0 + (index % 4) * 14.0
add_leaf_card(vertices, faces, (0.0, 0.0, 0.0), width, height, yaw, -5.0 + (index % 3) * 5.0)
add_irregular_leaf_card(vertices, faces, (0.0, 0.0, 0.0), width, height, yaw, -8.0 + (index % 3) * 6.0, 0.08)
return vertices, faces