Skip to content

Commit b4e47ed

Browse files
authored
Move BatchedTilesPlugin to core plugins (#899)
* Rearrange functions * clean up * More cleanup * rearrangement * batch tiles plugin rename * Updates * comment * Add display for batched mesh instances * Fix frustum addition * Small updates * Move batched tiles plugin
1 parent dae7c32 commit b4e47ed

File tree

9 files changed

+24
-8
lines changed

9 files changed

+24
-8
lines changed

example/googleMapsExample.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
TileCompressionPlugin,
1414
UnloadTilesPlugin,
1515
GLTFExtensionsPlugin,
16+
BatchedTilesPlugin,
1617
} from '3d-tiles-renderer/plugins';
1718
import {
1819
Scene,
@@ -24,7 +25,6 @@ import {
2425
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
2526
import { GUI } from 'three/examples/jsm/libs/lil-gui.module.min.js';
2627
import Stats from 'three/examples/jsm/libs/stats.module.js';
27-
import { BatchedTilesPlugin } from './src/plugins/batched/BatchedTilesPlugin.js';
2828

2929
let controls, scene, renderer, tiles, transition;
3030
let statsContainer, stats;
@@ -354,20 +354,19 @@ function updateHtml() {
354354
if ( batchPlugin ) {
355355

356356
let tot = 0;
357-
let totFade = 0;
358-
batchPlugin.batchedMesh._instanceInfo.forEach( info => {
357+
batchPlugin.batchedMesh?._instanceInfo.forEach( info => {
359358

360359
if ( info.visible && info.active ) tot ++;
361360

362361
} );
363362

364-
fadePlugin.batchedMesh._instanceInfo.forEach( info => {
363+
fadePlugin.batchedMesh?._instanceInfo.forEach( info => {
365364

366-
if ( info.visible && info.active ) totFade ++;
365+
if ( info.visible && info.active ) tot ++;
367366

368367
} );
369368

370-
str += ', Batched: ' + tot + ', Fade Batched: ' + totFade;
369+
str += ', Batched: ' + tot;
371370

372371
}
373372

src/plugins/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,6 @@ Available options are as follows:
588588

589589
## BatchedTilesPlugin
590590

591-
_available in the examples directory_
592-
593591
Plugin that uses three.js' BatchedMesh to limit the number of draw calls required and improve performance. The BatchedMesh geometry and instance size are automatically resized and optimized as new geometry is added and removed. The max number of instances to generate is limited by the max size of a 3d texture.
594592

595593
> [!WARNING]

src/plugins/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export { GLTFExtensionsPlugin } from './three/GLTFExtensionsPlugin';
77
export { ReorientationPlugin } from './three/ReorientationPlugin';
88
export { UnloadTilesPlugin } from './three/UnloadTilesPlugin';
99
export { TilesFadePlugin } from './three/fade/TilesFadePlugin';
10+
export { BatchedTilesPlugin } from './three/batched/BatchedTilesPlugin';
1011
export * from './three/DebugTilesPlugin';
1112

1213
// common plugins

src/plugins/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export { GLTFExtensionsPlugin } from './three/GLTFExtensionsPlugin.js';
77
export { ReorientationPlugin } from './three/ReorientationPlugin.js';
88
export { UnloadTilesPlugin } from './three/UnloadTilesPlugin.js';
99
export { TilesFadePlugin } from './three/fade/TilesFadePlugin.js';
10+
export { BatchedTilesPlugin } from './three/batched/BatchedTilesPlugin.js';
1011
export * from './three/DebugTilesPlugin.js';
1112

1213
// common plugins
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Material, WebGLRenderer } from 'three';
2+
3+
export class BatchedTilesPlugin {
4+
5+
constructor( options : {
6+
instanceCount: number,
7+
vertexCount: number,
8+
indexCount: number,
9+
expandPercent: number,
10+
maxInstanceCount: number,
11+
discardOriginalContent: boolean,
12+
13+
material: Material | null,
14+
renderer: WebGLRenderer | null,
15+
} );
16+
17+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)