Selaa lähdekoodia

LOD: Add ability to get current level

Sometimes it's useful to have the current LOD level. This is awkward to do outside of LOD as it involves duplicating the logic inside of LOD.

One use case is the loading of progressively larger textures when the LOD activates a certain level.
donutcoffee 5 vuotta sitten
vanhempi
commit
ca3a8a298e
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      src/objects/LOD.js

+ 4 - 0
src/objects/LOD.js

@@ -32,6 +32,8 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 	constructor: LOD,
 
 	isLOD: true,
+	
+	currentLevel: 0,
 
 	copy: function ( source ) {
 
@@ -146,6 +148,8 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 				}
 
 			}
+			
+			this.currentLevel = i - 1;
 
 			for ( ; i < l; i ++ ) {