perf: faster still

This commit is contained in:
Dan Finch 2026-08-04 19:12:09 +02:00
parent ef5029da1d
commit 67cd54fe33
8 changed files with 280 additions and 203 deletions

View file

@ -34,12 +34,9 @@ export namespace Sprite {
const lz = p.z - rz * hw
const gx = p.x + rx * hw
const gz = p.z + rz * hw
const vertices = [
{ pos: { x: lx, y: y0, z: lz }, uv: { x: 0, y: 1 } },
{ pos: { x: gx, y: y0, z: gz }, uv: { x: 1, y: 1 } },
{ pos: { x: gx, y: y1, z: gz }, uv: { x: 1, y: 0 } },
{ pos: { x: lx, y: y1, z: lz }, uv: { x: 0, y: 0 } },
]
return { vertices, indices: [0, 1, 2, 0, 2, 3] }
// Flat verts (x, y, z, u, v) per corner: bottom-left, bottom-right, top-right,
// top-left.
const verts = [lx, y0, lz, 0, 1, gx, y0, gz, 1, 1, gx, y1, gz, 1, 0, lx, y1, lz, 0, 0]
return { verts, indices: [0, 1, 2, 0, 2, 3] }
}
}