Render geo models in items
This commit is contained in:
@@ -500,7 +500,7 @@ export function bake_model(
|
||||
let cull = face_json.cullface ? FACE_INDEX[face_json.cullface] : -1;
|
||||
for (let t = 0; t < x_turns && cull >= 0; t++) cull = TURN_X[cull];
|
||||
for (let t = 0; t < turns && cull >= 0; t++) cull = TURN_Y[cull];
|
||||
const { face: facing, flush, aligned } = classify(positions);
|
||||
const { face: facing, flush, aligned } = classify_quad(positions);
|
||||
quads.push({
|
||||
positions,
|
||||
uvs,
|
||||
@@ -560,7 +560,7 @@ export function element_rotation(element: ModelElementJson): (point: number[]) =
|
||||
}
|
||||
|
||||
// which way a quad faces most, whether it's flat against the block's edge, and whether it faces straight along an axis
|
||||
function classify(p: number[]): { face: number; flush: boolean; aligned: boolean } {
|
||||
export function classify_quad(p: number[]): { face: number; flush: boolean; aligned: boolean } {
|
||||
const e1 = [p[3] - p[0], p[4] - p[1], p[5] - p[2]];
|
||||
const e2 = [p[9] - p[0], p[10] - p[1], p[11] - p[2]];
|
||||
const normal = [e1[1] * e2[2] - e1[2] * e2[1], e1[2] * e2[0] - e1[0] * e2[2], e1[0] * e2[1] - e1[1] * e2[0]];
|
||||
|
||||
Reference in New Issue
Block a user