Skip to content

five-on-it / apps/client/src/renderer/cracks

apps/client/src/renderer/cracks ​

Cracked glass: a window a shot hits or goes out through shows a crack where it did, from then on, for as long as that car exists. Nothing of it is the server's: the client reads the shot events it already receives. A shot from outside cracks the first pane its line enters where the shot stopped (glass.ts traces it against the car's model, the car placed as the snapshot has it and as it stood up to the snapshots' three ticks before, a moving car's shot having happened in between); a shot fired from inside (its muzzle in the car: a seated shooter's) cracks the pane it goes out through, traced from the shooter's seat. A crack is a decal: a star of cracks (a texture drawn here, no file) on a quad lying on the pane a few millimetres out, turned at random, kept inside the pane; a pane takes several, a car a dozen at most. A crack on a door's window swings with the door. A car whose health comes back (a repair, a reset, a new car under the same entity id), that jumps (put back at a spawn), whose driver here asks for a reset (R) or whose class changes has clean glass again; one gone from the snapshots, or the whole level reset, loses its cracks.

Every crack of every car in view is one thin instance of a single see-through mesh (models.ts' Batch), drawn after the glass.

Classes ​

Interfaces ​