Remove duplicate code

This commit is contained in:
2026-10-13 11:57:43 -03:00
parent dfc6a6d77b
commit 5165698fe3
50 changed files with 307 additions and 812 deletions
+2 -7
View File
@@ -21,11 +21,9 @@ import {
draw_text,
draw_texture_region,
draw_texture_region_skewed,
flush_batch,
get_current_texture,
push_vertex,
set_current_texture,
Texture,
use_texture,
} from "$/client/renderer/mod.ts";
// the corners keep their size (times scale), the edges stretch along and the middle fills the rest, like minecraft's
@@ -163,10 +161,7 @@ const ICON_VIEW = [-1, 1, -1];
// a block's item_model in a slot: its faces that face the viewer, back to front
function draw_item_model(block_info: BlockRegistry, quads: BakedQuad[], x: number, y: number) {
const atlas = AssetManager.instance.get<Texture>("bworld:textures");
if (get_current_texture() !== atlas.tex) {
flush_batch();
set_current_texture(atlas.tex);
}
use_texture(atlas.tex);
const project = item_projection(x, y);
const toward_viewer = (p: number[]) => p[0] * ICON_VIEW[0] + p[1] * ICON_VIEW[1] + p[2] * ICON_VIEW[2];
const visible = quads