diff --git a/example/googleMapsExample.js b/example/googleMapsExample.js index 833f8604..7e66d55d 100644 --- a/example/googleMapsExample.js +++ b/example/googleMapsExample.js @@ -13,6 +13,7 @@ import { TileCompressionPlugin, UnloadTilesPlugin, GLTFExtensionsPlugin, + BatchedTilesPlugin, } from '3d-tiles-renderer/plugins'; import { Scene, @@ -24,7 +25,6 @@ import { import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'; import { GUI } from 'three/examples/jsm/libs/lil-gui.module.min.js'; import Stats from 'three/examples/jsm/libs/stats.module.js'; -import { BatchedTilesPlugin } from './src/plugins/batched/BatchedTilesPlugin.js'; let controls, scene, renderer, tiles, transition; let statsContainer, stats; @@ -354,20 +354,19 @@ function updateHtml() { if ( batchPlugin ) { let tot = 0; - let totFade = 0; - batchPlugin.batchedMesh._instanceInfo.forEach( info => { + batchPlugin.batchedMesh?._instanceInfo.forEach( info => { if ( info.visible && info.active ) tot ++; } ); - fadePlugin.batchedMesh._instanceInfo.forEach( info => { + fadePlugin.batchedMesh?._instanceInfo.forEach( info => { - if ( info.visible && info.active ) totFade ++; + if ( info.visible && info.active ) tot ++; } ); - str += ', Batched: ' + tot + ', Fade Batched: ' + totFade; + str += ', Batched: ' + tot; } diff --git a/src/plugins/README.md b/src/plugins/README.md index 368334f0..b76dd1ec 100644 --- a/src/plugins/README.md +++ b/src/plugins/README.md @@ -588,8 +588,6 @@ Available options are as follows: ## BatchedTilesPlugin -_available in the examples directory_ - 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. > [!WARNING] diff --git a/src/plugins/index.d.ts b/src/plugins/index.d.ts index fa465500..4bffb1ac 100644 --- a/src/plugins/index.d.ts +++ b/src/plugins/index.d.ts @@ -7,6 +7,7 @@ export { GLTFExtensionsPlugin } from './three/GLTFExtensionsPlugin'; export { ReorientationPlugin } from './three/ReorientationPlugin'; export { UnloadTilesPlugin } from './three/UnloadTilesPlugin'; export { TilesFadePlugin } from './three/fade/TilesFadePlugin'; +export { BatchedTilesPlugin } from './three/batched/BatchedTilesPlugin'; export * from './three/DebugTilesPlugin'; // common plugins diff --git a/src/plugins/index.js b/src/plugins/index.js index 0093e67a..653ed984 100644 --- a/src/plugins/index.js +++ b/src/plugins/index.js @@ -7,6 +7,7 @@ export { GLTFExtensionsPlugin } from './three/GLTFExtensionsPlugin.js'; export { ReorientationPlugin } from './three/ReorientationPlugin.js'; export { UnloadTilesPlugin } from './three/UnloadTilesPlugin.js'; export { TilesFadePlugin } from './three/fade/TilesFadePlugin.js'; +export { BatchedTilesPlugin } from './three/batched/BatchedTilesPlugin.js'; export * from './three/DebugTilesPlugin.js'; // common plugins diff --git a/src/plugins/three/batched/BatchedTilesPlugin.d.ts b/src/plugins/three/batched/BatchedTilesPlugin.d.ts new file mode 100644 index 00000000..e41f170a --- /dev/null +++ b/src/plugins/three/batched/BatchedTilesPlugin.d.ts @@ -0,0 +1,17 @@ +import { Material, WebGLRenderer } from 'three'; + +export class BatchedTilesPlugin { + + constructor( options : { + instanceCount: number, + vertexCount: number, + indexCount: number, + expandPercent: number, + maxInstanceCount: number, + discardOriginalContent: boolean, + + material: Material | null, + renderer: WebGLRenderer | null, + } ); + +} diff --git a/example/src/plugins/batched/BatchedTilesPlugin.js b/src/plugins/three/batched/BatchedTilesPlugin.js similarity index 100% rename from example/src/plugins/batched/BatchedTilesPlugin.js rename to src/plugins/three/batched/BatchedTilesPlugin.js diff --git a/example/src/plugins/batched/ExpandingBatchedMesh.js b/src/plugins/three/batched/ExpandingBatchedMesh.js similarity index 100% rename from example/src/plugins/batched/ExpandingBatchedMesh.js rename to src/plugins/three/batched/ExpandingBatchedMesh.js diff --git a/example/src/plugins/batched/ModelViewBatchedMesh.js b/src/plugins/three/batched/ModelViewBatchedMesh.js similarity index 100% rename from example/src/plugins/batched/ModelViewBatchedMesh.js rename to src/plugins/three/batched/ModelViewBatchedMesh.js diff --git a/example/src/plugins/batched/utilities.js b/src/plugins/three/batched/utilities.js similarity index 100% rename from example/src/plugins/batched/utilities.js rename to src/plugins/three/batched/utilities.js