Fix old rendering hack
This commit is contained in:
@@ -57,9 +57,6 @@ import { liquid_height, liquid_textures } from "$/common/everything_registry.ts"
|
||||
|
||||
type TexturesInfo = Record<string, SpriteRegion>;
|
||||
|
||||
// keeps texture lookups off the sprite's edge
|
||||
const UV_PAD = 0.5;
|
||||
|
||||
// same order as FACE_NORMALS in translucent_sort.ts, and FACE_CORNERS and CORNER_UVS in block_models.ts
|
||||
// minecraft's shading by direction, so faces stay apart even in flat light
|
||||
const FACE_SHADE = [1.0, 0.5, 0.8, 0.8, 0.6, 0.6];
|
||||
@@ -437,15 +434,14 @@ function push_quad(
|
||||
buffer.count += 1;
|
||||
}
|
||||
|
||||
// model uvs (0 to TEXTURE_SIZE across the sprite, whatever its size) to atlas coordinates, kept off the sprite's edge
|
||||
// model uvs (0 to TEXTURE_SIZE across the sprite, whatever its size) to atlas coordinates. the atlas's border around
|
||||
// each sprite (see ATLAS_BORDER) keeps lookups that round past its edge on its own pixels
|
||||
function atlas_u(sprite: SpriteRegion, u: number) {
|
||||
const px = u * sprite.width / TEXTURE_SIZE;
|
||||
return (sprite.x + Math.min(Math.max(px, UV_PAD), sprite.width - UV_PAD)) / image.width;
|
||||
return (sprite.x + u * sprite.width / TEXTURE_SIZE) / image.width;
|
||||
}
|
||||
|
||||
function atlas_v(sprite: SpriteRegion, v: number) {
|
||||
const px = v * sprite.height / TEXTURE_SIZE;
|
||||
return (sprite.y + Math.min(Math.max(px, UV_PAD), sprite.height - UV_PAD)) / image.height;
|
||||
return (sprite.y + v * sprite.height / TEXTURE_SIZE) / image.height;
|
||||
}
|
||||
|
||||
// the model quads for a block value, baked the first time it's seen
|
||||
|
||||
Reference in New Issue
Block a user