Skip to content

Commit

Permalink
SelectionBox: Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Aug 24, 2021
1 parent 6b9eab9 commit b88cb7f
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions examples/jsm/interactive/SelectionBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class SelectionBox {
this.startPoint = new Vector3();
this.endPoint = new Vector3();
this.collection = [];
this.instances = {};
this.deep = deep;
this.instanceDetection = {};

}

Expand Down Expand Up @@ -175,39 +175,39 @@ class SelectionBox {

if ( object.isMesh || object.isLine || object.isPoints ) {

if ( object instanceof InstancedMesh ) {
if ( object.isInstancedMesh ) {

this.instanceDetection[ object.uuid ] = [];
this.instances[ object.uuid ] = [];

for ( let instanceId = 0; instanceId < object.count; instanceId ++ ) {
for ( let instanceId = 0; instanceId < object.count; instanceId ++ ) {

object.getMatrixAt( instanceId, _matrix );
_matrix.decompose( _center, _quaternion, _scale );
object.getMatrixAt( instanceId, _matrix );
_matrix.decompose( _center, _quaternion, _scale );

if ( frustum.containsPoint( _center ) ) {

this.instanceDetection[ object.uuid ].push( instanceId );
if ( frustum.containsPoint( _center ) ) {

}
this.instances[ object.uuid ].push( instanceId );

}

} else {
}

if ( object.geometry.boundingSphere === null ) object.geometry.computeBoundingSphere();
} else {

_center.copy( object.geometry.boundingSphere.center );
if ( object.geometry.boundingSphere === null ) object.geometry.computeBoundingSphere();

_center.applyMatrix4( object.matrixWorld );
_center.copy( object.geometry.boundingSphere.center );

if ( frustum.containsPoint( _center ) ) {
_center.applyMatrix4( object.matrixWorld );

this.collection.push( object );
if ( frustum.containsPoint( _center ) ) {

}
this.collection.push( object );

}

}

}

if ( object.children.length > 0 ) {
Expand Down

0 comments on commit b88cb7f

Please sign in to comment.