3D working

This commit is contained in:
Kbz-8
2024-02-22 06:01:56 +01:00
committed by AdrienLSH
parent b6936751b1
commit 668ab9ff2e
13 changed files with 106 additions and 52 deletions

View File

@ -14,7 +14,7 @@ function renderCube(ctx, x, y, z, angle = 0, sx = 1, sy = 1, sz = 1)
modelMatrix,
modelMatrix,
angle,
[0, 1, 1],
[0, 1, 0],
);
mat4.scale(
@ -23,6 +23,12 @@ function renderCube(ctx, x, y, z, angle = 0, sx = 1, sy = 1, sz = 1)
[sx, sy, sz]
);
mat4.translate(
modelMatrix,
modelMatrix,
[-1, 0, 0] // wtf, this works ?
);
const normalMatrix = mat4.create();
mat4.invert(normalMatrix, modelMatrix);
mat4.transpose(normalMatrix, normalMatrix);