major changes to upgrade to 3JS 1.2.5 -- deprecated THREE.Geometry -- breakage may ensue
This commit is contained in:
parent
d230f1e473
commit
6aa78d2a6a
8 changed files with 83 additions and 85 deletions
|
|
@ -207,20 +207,12 @@
|
|||
// synth support widget for each widget group
|
||||
let synth = [];
|
||||
for (let group of kiri.Widget.Groups.list()) {
|
||||
let count = 0;
|
||||
let merged = new THREE.Geometry();
|
||||
for (let widget of group) {
|
||||
if (widget.sups) {
|
||||
for (let sup of Object.values(widget.sups)) {
|
||||
merged.merge(sup.box.geometry, sup.box.matrix);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!count) {
|
||||
let merge = group.filter(w => w.sups).map(w => Object.values(w.sups)).flat();
|
||||
if (!merge.length) {
|
||||
continue;
|
||||
}
|
||||
let bbg = new THREE.BufferGeometry().fromGeometry(merged);
|
||||
let boxen = merge.map(m => m.box.geometry.clone().translate(m.x, m.y, m.z));
|
||||
let bbg = THREE.BufferGeometryUtils.mergeBufferGeometries(boxen);
|
||||
let sw = kiri.newWidget(null, group);
|
||||
let fwp = group[0].track.pos;
|
||||
sw.loadGeometry(bbg);
|
||||
|
|
|
|||
|
|
@ -1323,19 +1323,25 @@
|
|||
point.added = true;
|
||||
}
|
||||
}
|
||||
let filter = isBelt ? (f) => {
|
||||
return f.normal.z < thresh && f.normal.y < -0.001;
|
||||
} : (f) => {
|
||||
return f.normal.z < thresh;
|
||||
let filter = isBelt ? (norm) => {
|
||||
return norm.z < thresh && norm.y < -0.001;
|
||||
} : (norm) => {
|
||||
return norm.z < thresh;
|
||||
};
|
||||
let position = geo.attributes.position;
|
||||
let { position } = geo.attributes;
|
||||
let { itemSize, count, array } = position;
|
||||
for (let i = 0; i<count; i += 3) {
|
||||
let ip = i * itemSize;
|
||||
let a = new THREE.Vector3(array[ip++], array[ip++], array[ip++]);
|
||||
let b = new THREE.Vector3(array[ip++], array[ip++], array[ip++]);
|
||||
let c = new THREE.Vector3(array[ip++], array[ip++], array[ip++]);
|
||||
let norm = THREE.computeFaceNormal(a,b,c);
|
||||
// limit to downward faces
|
||||
if (!filter(norm)) {
|
||||
continue;
|
||||
}
|
||||
// skip tiny faces
|
||||
let area = BASE.newPolygon().addPoints([a,b,c]).area();
|
||||
if (BASE.newPolygon().addPoints([a,b,c]).area() < min) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue