fix ray intersections after rotation, scale, mirror
This commit is contained in:
parent
5ff787f516
commit
4671e0cdd2
1 changed files with 14 additions and 6 deletions
|
|
@ -340,6 +340,14 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
|
|
||||||
PRO.loadData = PRO.loadVertices;
|
PRO.loadData = PRO.loadVertices;
|
||||||
|
|
||||||
|
PRO.setModified = function() {
|
||||||
|
this.modified = true;
|
||||||
|
if (this.mesh && this.mesh.geometry) {
|
||||||
|
// this fixes ray intersections after the mesh is modified
|
||||||
|
this.mesh.geometry.boundingSphere = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
PRO.indexGeo = function() {
|
PRO.indexGeo = function() {
|
||||||
let indices = this.getGeoIndices();
|
let indices = this.getGeoIndices();
|
||||||
if (!indices) {
|
if (!indices) {
|
||||||
|
|
@ -532,7 +540,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
// for use with the packer
|
// for use with the packer
|
||||||
// invalidate cached points
|
// invalidate cached points
|
||||||
this.points = null;
|
this.points = null;
|
||||||
this.modified = true;
|
this.setModified();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -593,7 +601,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
pos.z += (z || 0);
|
pos.z += (z || 0);
|
||||||
}
|
}
|
||||||
if (x || y || z) {
|
if (x || y || z) {
|
||||||
this.modified = true;
|
this.setModified();
|
||||||
KIRI.api.event.emit('widget.move', {widget: this, pos});
|
KIRI.api.event.emit('widget.move', {widget: this, pos});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -615,7 +623,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
scale.x *= (x || 1.0);
|
scale.x *= (x || 1.0);
|
||||||
scale.y *= (y || 1.0);
|
scale.y *= (y || 1.0);
|
||||||
scale.z *= (z || 1.0);
|
scale.z *= (z || 1.0);
|
||||||
this.modified = true;
|
this.setModified();
|
||||||
};
|
};
|
||||||
|
|
||||||
PRO.rotate = function(x, y, z, temp) {
|
PRO.rotate = function(x, y, z, temp) {
|
||||||
|
|
@ -652,7 +660,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
rot.y += (y || 0);
|
rot.y += (y || 0);
|
||||||
rot.z += (z || 0);
|
rot.z += (z || 0);
|
||||||
}
|
}
|
||||||
this.modified = true;
|
this.setModified();
|
||||||
};
|
};
|
||||||
|
|
||||||
PRO.unrotate = function() {
|
PRO.unrotate = function() {
|
||||||
|
|
@ -661,7 +669,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
});
|
});
|
||||||
this.roto = [];
|
this.roto = [];
|
||||||
this.center();
|
this.center();
|
||||||
this.modified = true;
|
this.setModified();
|
||||||
};
|
};
|
||||||
|
|
||||||
PRO.mirror = function() {
|
PRO.mirror = function() {
|
||||||
|
|
@ -698,7 +706,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
geo.computeFaceNormals();
|
geo.computeFaceNormals();
|
||||||
geo.computeVertexNormals();
|
geo.computeVertexNormals();
|
||||||
ot.mirror = !ot.mirror;
|
ot.mirror = !ot.mirror;
|
||||||
this.modified = true;
|
this.setModified();
|
||||||
this.points = null;
|
this.points = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue