|
@@ -591,6 +591,12 @@ export class Scene extends AbstractScene implements IAnimatable {
|
|
*/
|
|
*/
|
|
public onMeshImportedObservable = new Observable<AbstractMesh>();
|
|
public onMeshImportedObservable = new Observable<AbstractMesh>();
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a user defined funtion to select LOD from a mesh and a camera.
|
|
|
|
+ * By default this function is undefined and Babylon.js will select LOD based on distance to camera
|
|
|
|
+ */
|
|
|
|
+ public customLODSelector: (mesh: AbstractMesh, camera: Camera) => Nullable<AbstractMesh>;
|
|
|
|
+
|
|
// Animations
|
|
// Animations
|
|
|
|
|
|
/** @hidden */
|
|
/** @hidden */
|
|
@@ -3891,7 +3897,7 @@ export class Scene extends AbstractScene implements IAnimatable {
|
|
}
|
|
}
|
|
|
|
|
|
// Switch to current LOD
|
|
// Switch to current LOD
|
|
- const meshLOD = mesh.getLOD(this.activeCamera);
|
|
|
|
|
|
+ const meshLOD = this.customLODSelector ? this.customLODSelector(mesh, this.activeCamera) : mesh.getLOD(this.activeCamera);
|
|
if (meshLOD === undefined || meshLOD === null) {
|
|
if (meshLOD === undefined || meshLOD === null) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|