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
9 changes: 9 additions & 0 deletions docs/api/en/objects/LOD.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ <h3>
Adds a mesh that will display at a certain distance and greater. Typically
the further away the distance, the lower the detail on the mesh.
</p>
<h3>
[method:Boolean removeLevel]( [param:Float distance])
</h3>
<p>
distance - Distance of the level to delete.<br /><br />

Removes an existing level, based on the distance from the camera.
Returns `true` when the level has been removed. Otherwise `false`.
</p>

<h3>[method:Integer getCurrentLevel]()</h3>
<p>Get the currently active LOD level. As index of the levels array.</p>
Expand Down
21 changes: 21 additions & 0 deletions src/objects/LOD.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,27 @@ class LOD extends Object3D {

}

removeLevel( distance ) {

const levels = this.levels;

for ( let i = 0; i < levels.length; i ++ ) {
Comment thread
Mugen87 marked this conversation as resolved.

if ( levels[ i ].distance === distance ) {

const removedElements = levels.splice( i, 1 );
this.remove( removedElements[ 0 ].object );

return true;

}

}

return false;

}

getCurrentLevel() {

return this._currentLevel;
Expand Down