cleanup rotation / scale and stub in rotation reset

This commit is contained in:
Stewart Allen 2020-06-13 22:52:46 -04:00
commit a9b04ad26f
4 changed files with 30 additions and 11 deletions

View file

@ -1897,6 +1897,7 @@
$('mode-sla').onclick = () => { API.mode.set('SLA') };
$('mode-cam').onclick = () => { API.mode.set('CAM') };
$('mode-laser').onclick = () => { API.mode.set('LASER') };
// $('unrotate').onclick = () => { API.widgets.for(w => w.unrotate()) };
// add app name hover info
$('app-info').innerText = KIRI.version;

View file

@ -112,6 +112,7 @@
if (groups.indexOf(this.group) < 0) {
groups.push(this.group);
}
this.roto = new THREE.Matrix4();
this.mesh = null;
this.points = null;
// todo resolve use of this vs. mesh.bounds
@ -548,7 +549,8 @@
} else {
m4 = m4.makeRotationFromQuaternion(x);
}
this.mesh.geometry.applyMatrix4(m4);
this.roto.multiply(m4);
this.mesh.geometry.applyMatrix4(new THREE.Matrix4().getInverse(m4));
if (!temp && euler) {
let rot = this.track.rot;
rot.x += (x || 0);
@ -557,6 +559,10 @@
}
};
PRO.unrotate = function() {
this.mesh.geometry.applyMatrix4(this.roto);
};
PRO.mirror = function() {
this.group.forEach(w => {
w._mirror();