Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/base/TilesRendererBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ export class TilesRendererBase {

if ( tile.__active ) {

this.setTileActive( tile, false );
this.invokeOnePlugin( plugin => plugin.setTileActive && plugin.setTileActive( tile, false ) );
tile.__active = false;

}
Expand Down
2 changes: 1 addition & 1 deletion src/base/traverseFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export function toggleTiles( tile, renderer ) {

if ( tile.__wasSetActive !== setActive ) {

renderer.setTileActive( tile, setActive );
renderer.invokeOnePlugin( plugin => plugin.setTileActive && plugin.setTileActive( tile, setActive ) );

}

Expand Down
44 changes: 44 additions & 0 deletions src/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -723,3 +723,47 @@ clearRegions(): void
```

Remove all regions.

## TileFlatteningPlugin

A plugin that takes a shape as a mesh and direction along which to "flatten" vertices to the surface of the shape. Useful for shifting tile geometry to make room for new assets. Not compatible with other plugins that modify geometry such as `BatchedTilesPlugin`.

### hasShape

```js
hasShape( shape: Object3D ): boolean
```

Returns whether the given object has been passed in as a shape.

### addShape

```js
addShape( shape: Object3D, direction: Vector3 ): void
```

Adds the given object as a shape to flatten to in addition to the direction to flatten.

### updateShape

```js
updateShape( shape: Object3D ): void
```

Notifies the plugin that the given shape (geometry, position) has been changed and "tile flattening" needs to be regenerated.

### deleteShape

```js
deleteShape( shape: Object3D ): void
```

Deletes the given shape and regenerates the tile flattening.

### clearShapes

```js
clearShapes(): void
```

Deletes all shapes and resets the tiles.
11 changes: 11 additions & 0 deletions src/plugins/three/TileFlatteningPlugin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Mesh } from 'three';

export class TileFatteningPlugin {

hasShape( mesh: Mesh ): boolean;
addShape( mesh: Mesh, direction: Vector3 ): void;
updateShape( mesh: Mesh ): void;
deleteShape( mesh ): boolean;
clearShapes(): void;

}
Loading
Loading