Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move BatchedTilesPlugin to core plugins #899

Merged
merged 12 commits into from
Dec 25, 2024
11 changes: 5 additions & 6 deletions example/googleMapsExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
TileCompressionPlugin,
UnloadTilesPlugin,
GLTFExtensionsPlugin,
BatchedTilesPlugin,
} from '3d-tiles-renderer/plugins';
import {
Scene,
Expand All @@ -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;
Expand Down Expand Up @@ -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;

}

Expand Down
2 changes: 0 additions & 2 deletions src/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions src/plugins/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/plugins/three/batched/BatchedTilesPlugin.d.ts
Original file line number Diff line number Diff line change
@@ -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,
} );

}
Loading