|
@@ -77,6 +77,8 @@ const _frustum = /*@__PURE__*/ new Frustum();
|
|
|
const _box = /*@__PURE__*/ new Box3();
|
|
|
const _sphere = /*@__PURE__*/ new Sphere();
|
|
|
const _vector = /*@__PURE__*/ new Vector3();
|
|
|
+const _forward = /*@__PURE__*/ new Vector3();
|
|
|
+const _temp = /*@__PURE__*/ new Vector3();
|
|
|
const _renderList = /*@__PURE__*/ new MultiDrawRenderList();
|
|
|
const _mesh = /*@__PURE__*/ new Mesh();
|
|
|
const _batchIntersects = [];
|
|
@@ -1017,6 +1019,7 @@ class BatchedMesh extends Mesh {
|
|
|
// get the camera position in the local frame
|
|
|
_invMatrixWorld.copy( this.matrixWorld ).invert();
|
|
|
_vector.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );
|
|
|
+ _forward.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ).transformDirection( _invMatrixWorld );
|
|
|
|
|
|
for ( let i = 0, l = visibility.length; i < l; i ++ ) {
|
|
|
|
|
@@ -1037,7 +1040,7 @@ class BatchedMesh extends Mesh {
|
|
|
if ( ! culled ) {
|
|
|
|
|
|
// get the distance from camera used for sorting
|
|
|
- const z = _vector.distanceTo( _sphere.center );
|
|
|
+ const z = _temp.subVectors( _sphere.center, _vector ).dot( _forward );
|
|
|
_renderList.push( drawRanges[ i ], z );
|
|
|
|
|
|
}
|