Add cooking pot from farmer's delight !
This commit is contained in:
@@ -11,6 +11,8 @@ export interface ModelFaceJson {
|
||||
texture: string;
|
||||
// the part of the texture, [u1, v1, u2, v2] in pixels (0-16). defaults to the part the face covers
|
||||
uv?: [number, number, number, number];
|
||||
// turns the texture on the face clockwise: 0, 90, 180 or 270
|
||||
rotation?: number;
|
||||
// hidden when the neighbor on this side hides faces (a solid block)
|
||||
cullface?: ModelFace;
|
||||
}
|
||||
@@ -234,6 +236,8 @@ export function bake_model(model: ModelJson, textures: BlockTextures | undefined
|
||||
if (!face_json) continue;
|
||||
const index = FACE_INDEX[face];
|
||||
const uv = face_json.uv ?? default_uv(face, element.from, element.to);
|
||||
// each corner takes the uv of the corner a quarter turn along, per 90 degrees
|
||||
const uv_turns = Math.round((face_json.rotation ?? 0) / 90) % 4;
|
||||
|
||||
const positions: number[] = [];
|
||||
const uvs: number[] = [];
|
||||
@@ -242,7 +246,7 @@ export function bake_model(model: ModelJson, textures: BlockTextures | undefined
|
||||
point = rotate(point);
|
||||
for (let t = 0; t < turns; t++) point = [1 - point[2], point[1], point[0]];
|
||||
positions.push(...point);
|
||||
const [cu, cv] = CORNER_UVS[k];
|
||||
const [cu, cv] = CORNER_UVS[(k + uv_turns) % 4];
|
||||
uvs.push(cu ? uv[2] : uv[0], cv ? uv[3] : uv[1]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user