This commit is contained in:
Lucas Dower 2021-07-06 00:12:07 +01:00
parent 291ea43a6e
commit cf1d164d2c

View File

@ -18,16 +18,6 @@ function resizeCanvas() {
}
resizeCanvas();
/*
const suzanneLeft = new Mesh('./resources/suzanne_left.obj');
voxelManager.voxeliseMesh(suzanneLeft);
renderer.registerVoxels(voxelManager.voxels);
const suzanneRight = new Mesh('./resources/suzanne_right.obj');
renderer.registerMesh(suzanneRight);
*/
let loadedMesh = null;
document.querySelector("#objBtn").addEventListener('click', () => {
@ -61,31 +51,15 @@ document.querySelector("#voxelBtn").addEventListener('click', () => {
renderer.clear();
const mesh = voxelManager.buildMesh();
for (const box of mesh) {
renderer.registerBox(box.centre, box.size, false);
//renderer.registerBox(box.centre, box.size, true);
}
//renderer.registerVoxels(voxelManager.voxels, false);
renderer.compileRegister();
});
//voxelManager.addVoxel(new Vector3(0, 0, 0));
//voxelManager.addVoxel(new Vector3(voxelSize, 0, 0));
loadedMesh = new Mesh("./resources/suzanne.obj");
voxelManager.voxeliseMesh(loadedMesh);
const mesh = voxelManager.buildMesh();
for (const box of mesh) {
renderer.registerBox(box.centre, box.size, false);
renderer.registerBox(box.centre, box.size, true);
}
renderer.compileRegister();
function render(time) {
resizeCanvas();