tidy up bounds patch and fix morph code path
This commit is contained in:
parent
d7f0bd09c4
commit
ef4dace758
1 changed files with 13 additions and 16 deletions
|
|
@ -286,17 +286,14 @@ let util = mesh.util = {
|
||||||
|
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
let bounds = util.geoBounds(geometry, object.matrixWorld);
|
let bounds = util.geoBounds(geometry, object.matrixWorld);
|
||||||
let tmp = new THREE.Box3().copy(bounds);
|
let bt = new THREE.Box3().copy(bounds);
|
||||||
let m = new THREE.Matrix4();
|
let m4 = new THREE.Matrix4();
|
||||||
let v = new THREE.Vector3();
|
m4.setPosition(new THREE.Vector3().setFromMatrixPosition(object.matrixWorld));
|
||||||
|
bt.applyMatrix4(m4);
|
||||||
m.setPosition(v.setFromMatrixPosition(object.matrixWorld));
|
box3.union(bt);
|
||||||
tmp.applyMatrix4(m);
|
|
||||||
box3.union(tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const children = object.children;
|
const children = object.children;
|
||||||
|
|
||||||
for (let i = 0, l = children.length; i < l; i++) {
|
for (let i = 0, l = children.length; i < l; i++) {
|
||||||
util.box3expand(box3, children[i]);
|
util.box3expand(box3, children[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -320,17 +317,17 @@ let util = mesh.util = {
|
||||||
const morphAttributesPosition = geometry.morphAttributes.position;
|
const morphAttributesPosition = geometry.morphAttributes.position;
|
||||||
if (morphAttributesPosition) {
|
if (morphAttributesPosition) {
|
||||||
for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
|
for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
|
||||||
const morphAttribute = morphAttributesPosition[i];
|
const box3 = new THREE.Box3().setFromBufferAttribute(morphAttributesPosition[i]);
|
||||||
let box3 = new THREE.Box3().setFromBufferAttribute(morphAttribute);
|
|
||||||
|
|
||||||
if (geometry.morphTargetsRelative) {
|
if (geometry.morphTargetsRelative) {
|
||||||
_vector$8.addVectors(geometry.boundingBox.min, box3.min);
|
let vector = new THREE.Vector3();
|
||||||
geometry.boundingBox.expandByPoint(_vector$8);
|
vector.addVectors(boundingBox.min, box3.min);
|
||||||
_vector$8.addVectors(geometry.boundingBox.max, box3.max);
|
boundingBox.expandByPoint(vector);
|
||||||
geometry.boundingBox.expandByPoint(_vector$8);
|
vector.addVectors(boundingBox.max, box3.max);
|
||||||
|
boundingBox.expandByPoint(vector);
|
||||||
} else {
|
} else {
|
||||||
geometry.boundingBox.expandByPoint(box3.min);
|
boundingBox.expandByPoint(box3.min);
|
||||||
geometry.boundingBox.expandByPoint(box3.max);
|
boundingBox.expandByPoint(box3.max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue