Task #19: UFO model built from primitives
UFOs no longer reuse the crow's bird mesh. EnemySystem.build_ufo_mesh() merges the mesh arrays of two CylinderMesh hull halves, a TorusMesh rim, a hemisphere SphereMesh dome and eight small sphere lights into one ArrayMesh (about 1.65 m across, -0.13..0.45 m about its origin), with per-part vertex colors and (glow, metalness) in UV. A second HordeRenderer (ufo_renderer) draws it with the new game/resources/ufo.gdshader: albedo from COLOR, no flap, a slow spin and bob with a per-enemy phase, chasing rim lights, and the bird shader's hit flash (INSTANCE_CUSTOM.g) and night_glow. Both batches mirror the dense slots (write_new, move_slot, clear), and commit_render scales each slot to nothing in the batch that doesn't draw its type. DayNight now takes a list of enemy materials and sets night_glow on both. UFOs get their own arrival cue (kenney/digital/powerUp2.ogg, previously unused) instead of the crow's caw. HordeRenderer.is_drawn() backs the new test_roster checks: a UFO is drawn by the UFO batch only, a crow by the bird batch only, a thief by neither, also after a swap-removal; and the saucer's size and centering. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
26b735d3e6
commit
9cb01f1ede
8 changed files with 264 additions and 35 deletions
|
|
@ -1,6 +1,6 @@
|
|||
class_name HordeRenderer
|
||||
extends MultiMeshInstance3D
|
||||
## Shared-mesh instanced rendering for pooled entities (birds, and projectiles via the same
|
||||
## Shared-mesh instanced rendering for pooled entities (birds, UFOs, and projectiles via the same
|
||||
## class). Active entities occupy the dense prefix [0, count); visible_instance_count is set to
|
||||
## count, so released entities stop rendering immediately (no parking at a remote coordinate or
|
||||
## zero scale). The buffer is written each physics tick and handed to the RenderingServer with
|
||||
|
|
@ -107,6 +107,18 @@ func commit(count: int) -> void:
|
|||
_reset_count = 0
|
||||
|
||||
|
||||
## Whether a slot is drawn: inside the visible prefix and not scaled to nothing (a batch that
|
||||
## shares its slots with entities it doesn't draw, like EnemySystem's, hides them that way).
|
||||
func is_drawn(slot: int) -> bool:
|
||||
if slot < 0 or slot >= multimesh.visible_instance_count:
|
||||
return false
|
||||
var o := slot * STRIDE
|
||||
var sq := 0.0
|
||||
for k: int in [0, 1, 2, 4, 5, 6, 8, 9, 10]:
|
||||
sq += buffer[o + k] * buffer[o + k]
|
||||
return sq > 1e-6
|
||||
|
||||
|
||||
## Restart: drop everything and make the next commit snap instead of interpolate.
|
||||
func clear() -> void:
|
||||
_reset_count = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue