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/array",
|
||||||
"add/three",
|
"add/three",
|
||||||
"geo/base",
|
"geo/base",
|
||||||
"geo/render",
|
// "geo/render",
|
||||||
"geo/point",
|
"geo/point",
|
||||||
"geo/points",
|
"geo/points",
|
||||||
"geo/slope",
|
"geo/slope",
|
||||||
|
|
@ -364,7 +364,7 @@ const script = {
|
||||||
"add/array",
|
"add/array",
|
||||||
"add/three",
|
"add/three",
|
||||||
"geo/base",
|
"geo/base",
|
||||||
"geo/render",
|
// "geo/render",
|
||||||
"geo/point",
|
"geo/point",
|
||||||
"geo/points",
|
"geo/points",
|
||||||
"geo/slope",
|
"geo/slope",
|
||||||
|
|
@ -395,7 +395,7 @@ const script = {
|
||||||
"add/array",
|
"add/array",
|
||||||
"add/three",
|
"add/three",
|
||||||
"geo/base",
|
"geo/base",
|
||||||
"geo/render",
|
// "geo/render",
|
||||||
"geo/point",
|
"geo/point",
|
||||||
"geo/slope",
|
"geo/slope",
|
||||||
"geo/line",
|
"geo/line",
|
||||||
|
|
|
||||||
|
|
@ -106,17 +106,6 @@
|
||||||
return this;
|
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() {
|
THREE.Object3D.prototype.newGroup = function() {
|
||||||
var group = new THREE.Group();
|
var group = new THREE.Group();
|
||||||
this.add(group);
|
this.add(group);
|
||||||
|
|
|
||||||
|
|
@ -796,6 +796,9 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
ondone('invalid mode: '+settings.mode);
|
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,
|
let mesh = this.mesh,
|
||||||
widget = this;
|
widget = this;
|
||||||
if (this.wire) {
|
if (this.wire) {
|
||||||
|
this.setOpacity(solid_opacity);
|
||||||
mesh.remove(this.wire);
|
mesh.remove(this.wire);
|
||||||
this.wire = null;
|
this.wire = null;
|
||||||
this.setOpacity(solid_opacity);
|
|
||||||
}
|
}
|
||||||
if (set) {
|
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) {
|
if (opacity !== undefined) {
|
||||||
widget.setOpacity(opacity);
|
widget.setOpacity(opacity);
|
||||||
|
|
|
||||||
|
|
@ -1064,7 +1064,8 @@
|
||||||
|
|
||||||
renderer = new THREE.WebGLRenderer({
|
renderer = new THREE.WebGLRenderer({
|
||||||
antialias: true,
|
antialias: true,
|
||||||
preserveDrawingBuffer: true
|
preserveDrawingBuffer: true,
|
||||||
|
logarithmicDepthBuffer: true
|
||||||
});
|
});
|
||||||
camera = ortho ?
|
camera = ortho ?
|
||||||
new THREE.OrthographicCamera(-100 * aspect(), 100 * aspect(), 100, -100, 0.1, 100000) :
|
new THREE.OrthographicCamera(-100 * aspect(), 100 * aspect(), 100, -100, 0.1, 100000) :
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue