wip fixing rotations
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// geometry.js
|
||||
import {mat4Identity, mat4RotateY, mat4Translate} from './math.js'; // Assuming you have mat4RotateX too
|
||||
import {mat4Identity, mat4RotateX, mat4RotateY, mat4Translate} from './math.js';
|
||||
|
||||
const FACES = {
|
||||
down: {n: [0, -1, 0], c: [[0, 0, 0], [1, 0, 0], [1, 0, 1], [0, 0, 1]]},
|
||||
@@ -51,8 +51,8 @@ export function buildGeometry(model, atlas, variant = {}) {
|
||||
// 1. Pre-calculate the blockstate rotation matrix (around block center)
|
||||
const blockMatrix = mat4Identity(new Float32Array(16));
|
||||
mat4Translate(blockMatrix, blockMatrix, [0.5, 0.5, 0.5]);
|
||||
// NOTE: Vanilla blockstates also support `x` rotation. You'd add mat4RotateX here if needed.
|
||||
if (variant.y) mat4RotateY(blockMatrix, blockMatrix, -variant.y * Math.PI / 180);
|
||||
if (variant.x) mat4RotateX(blockMatrix, blockMatrix, variant.x * Math.PI / 180);
|
||||
if (variant.y) mat4RotateY(blockMatrix, blockMatrix, variant.y * Math.PI / 180);
|
||||
mat4Translate(blockMatrix, blockMatrix, [-0.5, -0.5, -0.5]);
|
||||
|
||||
for (const el of model.elements || []) {
|
||||
|
||||
Reference in New Issue
Block a user