Player hand rendering
This commit is contained in:
@@ -15,7 +15,7 @@ const UV_INSET = 0.01;
|
||||
// a part of minecraft's player model, like its ModelParts. sizes and positions are in skin pixels, the model faces
|
||||
// -z with its right side towards +x and its feet at 0. each part is a box from `from` to `from + size` around the
|
||||
// pivot it turns on, with its texture at `texture` in a 1.8 (64x64) skin and a second layer drawn a bit bigger
|
||||
interface ModelPart {
|
||||
export interface ModelPart {
|
||||
name: "head" | "body" | "right_arm" | "left_arm" | "right_leg" | "left_leg";
|
||||
size: Vec3;
|
||||
pivot: Vec3;
|
||||
@@ -105,6 +105,11 @@ const SLIM_ARMS: ModelPart[] = [
|
||||
];
|
||||
const SLIM_PARTS = PARTS.map((part) => SLIM_ARMS.find((arm) => arm.name === part.name) ?? part);
|
||||
|
||||
// the right arm of the wide or slim model, for drawing it on its own in first person
|
||||
export function right_arm(slim: boolean): ModelPart {
|
||||
return (slim ? SLIM_PARTS : PARTS).find((part) => part.name === "right_arm")!;
|
||||
}
|
||||
|
||||
// a box's faces, like minecraft's ModelPart.Cube. `rect` is where the face is in the box's texture, which is laid
|
||||
// out as in a skin: the top and bottom above the sides (right, front, left, back). corners go counter clockwise from
|
||||
// outside as [x, y, z, u, v], 0 for the low end and 1 for the high one
|
||||
@@ -182,7 +187,8 @@ export function render_player(player: Player, skin: Texture, partial_tick: numbe
|
||||
}
|
||||
}
|
||||
|
||||
function push_cube(
|
||||
// one layer of a part's box, its texture at uv and grown by inflate. transform takes points around the part's pivot
|
||||
export function push_cube(
|
||||
skin: Texture,
|
||||
part: ModelPart,
|
||||
uv: [number, number],
|
||||
|
||||
Reference in New Issue
Block a user