Procházet zdrojové kódy

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 před 5 roky
rodič
revize
ca3a8a298e
1 změnil soubory, kde provedl 4 přidání a 0 odebrání
  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 ++ ) {