computeBoundingBox method
void
computeBoundingBox()
inherited
Implementation
void computeBoundingBox() {
boundingBox ??= BoundingBox();
final position = attributes["position"];
final morphAttributesPosition = morphAttributes["position"];
if (position != null && position is GLBufferAttribute) {
console.warning('BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false". $this');
double infinity = 9999999999.0;
boundingBox!.set(Vector3(-infinity, -infinity, -infinity),Vector3(infinity, infinity, infinity));
return;
}
if (position != null) {
boundingBox!.setFromBuffer(position);
// process morph attributes if present
if (morphAttributesPosition != null) {
for (int i = 0, il = morphAttributesPosition.length; i < il; i++) {
final morphAttribute = morphAttributesPosition[i];
_bufferGeometrybox.setFromBuffer(morphAttribute);
if (morphTargetsRelative) {
_bufferGeometryvector.add2(boundingBox!.min, _bufferGeometrybox.min);
boundingBox!.expandByPoint(_bufferGeometryvector);
_bufferGeometryvector.add2(boundingBox!.max, _bufferGeometrybox.max);
boundingBox!.expandByPoint(_bufferGeometryvector);
} else {
boundingBox!.expandByPoint(_bufferGeometrybox.min);
boundingBox!.expandByPoint(_bufferGeometrybox.max);
}
}
}
} else {
boundingBox!.empty();
}
}