improve efficiency of wire mesh generation. free point cache after slice
This commit is contained in:
parent
69eb0356a9
commit
824ec04814
4 changed files with 13 additions and 17 deletions
6
app.js
6
app.js
|
|
@ -231,7 +231,7 @@ const script = {
|
|||
"add/array",
|
||||
"add/three",
|
||||
"geo/base",
|
||||
"geo/render",
|
||||
// "geo/render",
|
||||
"geo/point",
|
||||
"geo/points",
|
||||
"geo/slope",
|
||||
|
|
@ -364,7 +364,7 @@ const script = {
|
|||
"add/array",
|
||||
"add/three",
|
||||
"geo/base",
|
||||
"geo/render",
|
||||
// "geo/render",
|
||||
"geo/point",
|
||||
"geo/points",
|
||||
"geo/slope",
|
||||
|
|
@ -395,7 +395,7 @@ const script = {
|
|||
"add/array",
|
||||
"add/three",
|
||||
"geo/base",
|
||||
"geo/render",
|
||||
// "geo/render",
|
||||
"geo/point",
|
||||
"geo/slope",
|
||||
"geo/line",
|
||||
|
|
|
|||
|
|
@ -106,17 +106,6 @@
|
|||
return this;
|
||||
};
|
||||
|
||||
// may be faster than the equivalent matrix transform. to be tested
|
||||
// BP.translate = function(x,y,z) {
|
||||
// let off = [x,y,z],
|
||||
// arr = this.attributes.position.array,
|
||||
// len = arr.length;
|
||||
// for (let i=0; i<len; i++) {
|
||||
// arr[i] += off[i%3];
|
||||
// }
|
||||
// return this;
|
||||
// }
|
||||
|
||||
THREE.Object3D.prototype.newGroup = function() {
|
||||
var group = new THREE.Group();
|
||||
this.add(group);
|
||||
|
|
|
|||
|
|
@ -796,6 +796,9 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
|||
ondone('invalid mode: '+settings.mode);
|
||||
}
|
||||
}
|
||||
|
||||
// discard point cache
|
||||
widget.points = undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -815,12 +818,15 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
|||
let mesh = this.mesh,
|
||||
widget = this;
|
||||
if (this.wire) {
|
||||
this.setOpacity(solid_opacity);
|
||||
mesh.remove(this.wire);
|
||||
this.wire = null;
|
||||
this.setOpacity(solid_opacity);
|
||||
}
|
||||
if (set) {
|
||||
widget.wire = base.render.wireframe(mesh, this.getPoints(), color);
|
||||
let geo = new THREE.WireframeGeometry(mesh.geometry);
|
||||
let mat = new THREE.LineBasicMaterial({ color: 0 });
|
||||
let wire = widget.wire = new THREE.LineSegments(geo, mat);
|
||||
mesh.add(wire);
|
||||
}
|
||||
if (opacity !== undefined) {
|
||||
widget.setOpacity(opacity);
|
||||
|
|
|
|||
|
|
@ -1064,7 +1064,8 @@
|
|||
|
||||
renderer = new THREE.WebGLRenderer({
|
||||
antialias: true,
|
||||
preserveDrawingBuffer: true
|
||||
preserveDrawingBuffer: true,
|
||||
logarithmicDepthBuffer: true
|
||||
});
|
||||
camera = ortho ?
|
||||
new THREE.OrthographicCamera(-100 * aspect(), 100 * aspect(), 100, -100, 0.1, 100000) :
|
||||
|
|
|
|||
Loading…
Reference in a new issue