File tree Expand file tree Collapse file tree 1 file changed +26
-6
lines changed Expand file tree Collapse file tree 1 file changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -119,16 +119,36 @@ THREE.Box3.prototype = {
119
119
120
120
}
121
121
122
- } else if ( geometry instanceof THREE . BufferGeometry && geometry . attributes [ 'position' ] !== undefined ) {
122
+ } else if ( geometry instanceof THREE . BufferGeometry ) {
123
123
124
- var positions = geometry . attributes [ 'position' ] . array ;
124
+ var attribute = geometry . attributes . position ;
125
125
126
- for ( var i = 0 , il = positions . length ; i < il ; i += 3 ) {
126
+ if ( attribute !== undefined ) {
127
127
128
- v1 . fromArray ( positions , i ) ;
129
- v1 . applyMatrix4 ( node . matrixWorld ) ;
128
+ var array , offset , stride ;
130
129
131
- scope . expandByPoint ( v1 ) ;
130
+ if ( attribute instanceof THREE . InterleavedBufferAttribute ) {
131
+
132
+ array = attribute . data . array ;
133
+ offset = attribute . offset ;
134
+ stride = attribute . data . stride ;
135
+
136
+ } else {
137
+
138
+ array = attribute . array ;
139
+ offset = 0 ;
140
+ stride = 3 ;
141
+
142
+ }
143
+
144
+ for ( var i = offset , il = array . length ; i < il ; i += stride ) {
145
+
146
+ v1 . fromArray ( array , i ) ;
147
+ v1 . applyMatrix4 ( node . matrixWorld ) ;
148
+
149
+ scope . expandByPoint ( v1 ) ;
150
+
151
+ }
132
152
133
153
}
134
154
You can’t perform that action at this time.
0 commit comments