|
@@ -83,7 +83,6 @@ const _mesh = new Mesh();
|
|
const _batchIntersects = [];
|
|
const _batchIntersects = [];
|
|
|
|
|
|
// @TODO: SkinnedMesh support?
|
|
// @TODO: SkinnedMesh support?
|
|
-// @TODO: Future work if needed. Move into the core. Can be optimized more with WEBGL_multi_draw.
|
|
|
|
// @TODO: geometry.groups support?
|
|
// @TODO: geometry.groups support?
|
|
// @TODO: geometry.drawRange support?
|
|
// @TODO: geometry.drawRange support?
|
|
// @TODO: geometry.morphAttributes support?
|
|
// @TODO: geometry.morphAttributes support?
|
|
@@ -135,7 +134,7 @@ class BatchedMesh extends Mesh {
|
|
this._drawRanges = [];
|
|
this._drawRanges = [];
|
|
this._reservedRanges = [];
|
|
this._reservedRanges = [];
|
|
|
|
|
|
- this._visible = [];
|
|
|
|
|
|
+ this._visibility = [];
|
|
this._active = [];
|
|
this._active = [];
|
|
this._bounds = [];
|
|
this._bounds = [];
|
|
|
|
|
|
@@ -438,13 +437,13 @@ class BatchedMesh extends Mesh {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- const visible = this._visible;
|
|
|
|
|
|
+ const visibility = this._visibility;
|
|
const active = this._active;
|
|
const active = this._active;
|
|
const matricesTexture = this._matricesTexture;
|
|
const matricesTexture = this._matricesTexture;
|
|
const matricesArray = this._matricesTexture.image.data;
|
|
const matricesArray = this._matricesTexture.image.data;
|
|
|
|
|
|
// push new visibility states
|
|
// push new visibility states
|
|
- visible.push( true );
|
|
|
|
|
|
+ visibility.push( true );
|
|
active.push( true );
|
|
active.push( true );
|
|
|
|
|
|
// update id
|
|
// update id
|
|
@@ -749,7 +748,7 @@ class BatchedMesh extends Mesh {
|
|
|
|
|
|
setVisibleAt( geometryId, value ) {
|
|
setVisibleAt( geometryId, value ) {
|
|
|
|
|
|
- const visible = this._visible;
|
|
|
|
|
|
+ const visibility = this._visibility;
|
|
const active = this._active;
|
|
const active = this._active;
|
|
const geometryCount = this._geometryCount;
|
|
const geometryCount = this._geometryCount;
|
|
|
|
|
|
@@ -758,21 +757,21 @@ class BatchedMesh extends Mesh {
|
|
if (
|
|
if (
|
|
geometryId >= geometryCount ||
|
|
geometryId >= geometryCount ||
|
|
active[ geometryId ] === false ||
|
|
active[ geometryId ] === false ||
|
|
- visible[ geometryId ] === value
|
|
|
|
|
|
+ visibility[ geometryId ] === value
|
|
) {
|
|
) {
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- visible[ geometryId ] = value;
|
|
|
|
|
|
+ visibility[ geometryId ] = value;
|
|
return this;
|
|
return this;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
getVisibleAt( geometryId ) {
|
|
getVisibleAt( geometryId ) {
|
|
|
|
|
|
- const visible = this._visible;
|
|
|
|
|
|
+ const visibility = this._visibility;
|
|
const active = this._active;
|
|
const active = this._active;
|
|
const geometryCount = this._geometryCount;
|
|
const geometryCount = this._geometryCount;
|
|
|
|
|
|
@@ -783,13 +782,13 @@ class BatchedMesh extends Mesh {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- return visible[ geometryId ];
|
|
|
|
|
|
+ return visibility[ geometryId ];
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
raycast( raycaster, intersects ) {
|
|
raycast( raycaster, intersects ) {
|
|
|
|
|
|
- const visible = this._visible;
|
|
|
|
|
|
+ const visibility = this._visibility;
|
|
const active = this._active;
|
|
const active = this._active;
|
|
const drawRanges = this._drawRanges;
|
|
const drawRanges = this._drawRanges;
|
|
const geometryCount = this._geometryCount;
|
|
const geometryCount = this._geometryCount;
|
|
@@ -814,7 +813,7 @@ class BatchedMesh extends Mesh {
|
|
|
|
|
|
for ( let i = 0; i < geometryCount; i ++ ) {
|
|
for ( let i = 0; i < geometryCount; i ++ ) {
|
|
|
|
|
|
- if ( ! visible[ i ] || ! active[ i ] ) {
|
|
|
|
|
|
+ if ( ! visibility[ i ] || ! active[ i ] ) {
|
|
|
|
|
|
continue;
|
|
continue;
|
|
|
|
|
|
@@ -863,7 +862,7 @@ class BatchedMesh extends Mesh {
|
|
this._drawRanges = source._drawRanges.map( range => ( { ...range } ) );
|
|
this._drawRanges = source._drawRanges.map( range => ( { ...range } ) );
|
|
this._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );
|
|
this._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );
|
|
|
|
|
|
- this._visible = source._visible.slice();
|
|
|
|
|
|
+ this._visibility = source._visibility.slice();
|
|
this._active = source._active.slice();
|
|
this._active = source._active.slice();
|
|
this._bounds = source._bounds.map( bound => ( {
|
|
this._bounds = source._bounds.map( bound => ( {
|
|
boxInitialized: bound.boxInitialized,
|
|
boxInitialized: bound.boxInitialized,
|
|
@@ -907,7 +906,7 @@ class BatchedMesh extends Mesh {
|
|
const index = geometry.getIndex();
|
|
const index = geometry.getIndex();
|
|
const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
|
|
const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
|
|
|
|
|
|
- const visible = this._visible;
|
|
|
|
|
|
+ const visibility = this._visibility;
|
|
const multiDrawStarts = this._multiDrawStarts;
|
|
const multiDrawStarts = this._multiDrawStarts;
|
|
const multiDrawCounts = this._multiDrawCounts;
|
|
const multiDrawCounts = this._multiDrawCounts;
|
|
const drawRanges = this._drawRanges;
|
|
const drawRanges = this._drawRanges;
|
|
@@ -933,9 +932,9 @@ class BatchedMesh extends Mesh {
|
|
// get the camera position
|
|
// get the camera position
|
|
_vector.setFromMatrixPosition( camera.matrixWorld );
|
|
_vector.setFromMatrixPosition( camera.matrixWorld );
|
|
|
|
|
|
- for ( let i = 0, l = visible.length; i < l; i ++ ) {
|
|
|
|
|
|
+ for ( let i = 0, l = visibility.length; i < l; i ++ ) {
|
|
|
|
|
|
- if ( visible[ i ] ) {
|
|
|
|
|
|
+ if ( visibility[ i ] ) {
|
|
|
|
|
|
this.getMatrixAt( i, _matrix );
|
|
this.getMatrixAt( i, _matrix );
|
|
this.getBoundingSphereAt( i, _sphere ).applyMatrix4( _matrix );
|
|
this.getBoundingSphereAt( i, _sphere ).applyMatrix4( _matrix );
|
|
@@ -982,9 +981,9 @@ class BatchedMesh extends Mesh {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- for ( let i = 0, l = visible.length; i < l; i ++ ) {
|
|
|
|
|
|
+ for ( let i = 0, l = visibility.length; i < l; i ++ ) {
|
|
|
|
|
|
- if ( visible[ i ] ) {
|
|
|
|
|
|
+ if ( visibility[ i ] ) {
|
|
|
|
|
|
// determine whether the batched geometry is within the frustum
|
|
// determine whether the batched geometry is within the frustum
|
|
let culled = false;
|
|
let culled = false;
|